We are trying to implement a CI plan in which we are attempting to automate the following stages:
Stage 1) Everyday, at 8 PM, merge source_repo to target_repo
Note: target_repo is added as the default repository and remote caching is disabled.
Stage 2) Build new artifacts from target_repo
We can get the merge to work successfully doing this:
Task 1: Source Code Checkout
Task 2: Script
git remote add temp_origin ${bamboo.planRepository.1.repositoryUrl}
git fetch temp_origin source_repo
git merge temp_origin/source_repo
git push temp_origin ${bamboo.planRepository.1.branch}
git remote remove temp_origin
We then attempt to do the build by doing this:
Task 1: Source Code Checkout
Task 2: Call build script
Now, the problem is that the source code checkout of the build is using the revision prior to the merge in Stage 1. This means that the source code checkout is somehow caching or using some stale revision of the target_repo for some reason, even though the merge is successful. I do observe this message only in cases when the build is using a stale version of the target_repo:
You are in 'detached HEAD' state.
Could you please advise what solution would be here to ensure the source code checkout obtains the most current revision of target_repo?
Thank you in advance