Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 479191 - tychoeclipsebuilder branch is wrong, for post-build work
Summary: tychoeclipsebuilder branch is wrong, for post-build work
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Releng (show other bugs)
Version: 4.6   Edit
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: 4.5.2   Edit
Assignee: David Williams CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-07 00:39 EDT by David Williams CLA
Modified: 2015-10-08 00:32 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Williams CLA 2015-10-07 00:39:46 EDT
From observing logs in local test builds, it appears 
getEBuilderForDropDir.sh 
does not get the correct branch of "EBuilder" ... always using 'master', instead of R4_5_maintenance (when appropriate).
Comment 1 David Williams CLA 2015-10-07 01:01:23 EDT
This is pretty esoteric, but command currently looks like 
git clone --reference $aggDir ${AGGREGATOR_REPO} ${BUILD_DIR}/${EBUILDER}

re-reading git clone --help, I see I should also use --no-hardlinks (the whole purpose of this copy/clone is to provide a "safe copy" of some files, that won't change, even if anther build starts). 

Hence, command should be 
git clone --reference --no-hardlinks --branch ${EBUILDER_HASH} $aggDir ${AGGREGATOR_REPO} ${BUILD_DIR}/${EBUILDER}

EBUILDER_HASH can be a commit hash, branch, or tag. The help document is explicit the latter two are ok (being 'detached' for tag) ... I assume commit hash would work too? 

To investigate: the --help implies the branch used should be "the HEAD of the branch that is checked out in the reference repository". So ... not sure why that doesn't seem to work ... either the reference is wrong, or, more likely, it is in a "detached" state, and perhaps --reference doesn't really work with detached heads.
Comment 2 David Williams CLA 2015-10-07 02:51:47 EDT
Hmmm, first attempt didn't work. 

Doing git clone using:  --reference --no-hardlinks --branch ${EBUILDER_HASH} ${aggDir} ${AGGREGATOR_REPO} ${BUILD_DIR}/${EBUILDER}
which evaluates to git clone --reference --no-hardlinks --branch a79d1616994f0560a725a429dc8db6ad521f9606 /shared/eclipse/buildsdavidw/4M/gitCache/eclipse.platform.releng.aggregator file:///gitroot/davidw2/platform/eclipse.platform.releng.aggregator.git /shared/eclipse/buildsdavidw/4M/siteDir/eclipse/downloads/drops4/M20151007-0532/eclipse.platform.releng.aggregator
Too many arguments.

I see already one issue is that the local "repo" should directly follow --reference
Comment 3 David Williams CLA 2015-10-07 11:15:08 EDT
Second attempt didn't work either, at least on test machine. 

Doing git clone using:  --no-hardlinks --branch ${EBUILDER_HASH} --reference  ${aggDir} ${AGGREGATOR_REPO} ${BUILD_DIR}/${EBUILDER}
which evaluates to git clone --no-hardlinks --branch 03a73387c86b87c7393b737b3e0c342be1902d46 --reference  /shared/eclipse/buildsdavidw/4M/gitCache/eclipse.platform.releng.aggregator file:///gitroot/davidw2/platform/eclipse.platform.releng.aggregator.git /shared/eclipse/buildsdavidw/4M/siteDir/eclipse/downloads/drops4/M20151007-1237/eclipse.platform.releng.aggregator
Cloning into '/shared/eclipse/buildsdavidw/4M/siteDir/eclipse/downloads/drops4/M20151007-1237/eclipse.platform.releng.aggregator'...
fatal: Remote branch 03a73387c86b87c7393b737b3e0c342be1902d46 not found in upstream origin
fatal: The remote end hung up unexpectedly
[ERROR] Cloning EBUILDER returned non zero return code: 128

This might be a function of test machine, which uses a "mirrored" version of the git repo. But, might be that the 'commit hash' really does not exist or the function doesn't work well with commit hashes, and really needs to be ${BRANCH}. 
[But, technically ${BRANCH} may have changed already?]
Comment 4 David Williams CLA 2015-10-07 11:17:22 EDT
Will remove --branch ${EBUILDER_HASH}

Perhaps lack of --no-hardlinks was the problem all along?
Comment 5 David Williams CLA 2015-10-07 15:14:25 EDT
The problem is not in this apart of the code, and not this copy of eclipse.platform.releng.aggregator. That all looks right, on build machine(s). 

The problem is in 
eclipse.platform.releng.tychoeclipsebuilder

which is a folder, in eclipse.platform.releng.aggregator (not a submodule). 

It is correct in our main repo we build with, but in the copy we make to do post-build work, it is incorrect (we are getting the master version instead of the branch version). 

Perhaps it is that --reference simply "doesn't work"? Or, more likely, we are doing another "copy" (or, pull?) type operation somewhere just for that tychoeclipsebuilder project and at that time "write over" the correct version? 

They symptom I see in log output, is that is is getting the "eclpserun-repo" equivalent, BUT, it is hard coded in the post-build scripts, and the output says it is using the version that is in master, not the branch. 

[This is likely never been noticed before, because until recently, they were always the same version that was hard coded.]
Comment 6 David Williams CLA 2015-10-07 16:20:59 EDT
(In reply to David Williams from comment #5)
> The problem is not in this apart of the code, and not this copy of
> eclipse.platform.releng.aggregator. That all looks right, on build
> machine(s). 

Forget most of this comment. the clone --reference does still checkout 'master' by default. And, in local testing using -branch R4_5_maintenance does provide correct branch ... but, even then, we want the exact same commit, not the branch, and clone doesn't know how to infer what clone -branch (commit hash) means. 

So, I've discovered it will take two steps ... to do the clone --reference, followed by checkout (commit hash). Do not need to specify branch at all, and the "detached head" copy, still has the right content for that commit hash.
Comment 7 David Williams CLA 2015-10-08 00:32:11 EDT
Latest changes look good. 

There's no "diff" that is enlightening, since it too so many changes, but this is the "whole file", 

https://git.eclipse.org/c/platform/eclipse.platform.releng.aggregator.git/tree/production/getEBuilderForDropDir.sh

I ended up taking out the --no-hardlinks flag (upon re-reading help, we should not need that). 

Also turned out, the code to "checkout (commit hash)" was actually "in the file" .. jut hidden in an else clause, instead of being always done.