I am trying to determine why my git submodule changes don't make it onto the Go agents.
Can someone tell me what git commands are executed by a Go (2.2.0) agent when getting material from a git repository? In particular how submodules are pulled, both for initial cloning and subsequent updates.
Comments
6 comments
Actually, I'm curious about this too (But for different reasons). For some reason Go takes foreeeeeever to check if a repo has any changes or when it pulls the latest.
Hi Jon,
Just so we understand the problem better, are these the steps that reproduce the problem?
- You push a change to submodule
- You pull that change in parent(which uses submodule and is configured as material for the pipeline)
- You commit the change (lets call it 'sub update')
- Go auto/manual trigger uses 'sub update' revision
- Go agent picks up work(a job from the first stage of the pipeline that is scheduled off 'sub update' revision)
- Go agent fails the job because one of the submodules is not updated.
If your failure scenario is different, can you please clarify what are the major steps that make it fail?
Regards,
Sachin & JJ
@Sachin & JJ
I have resolved my problem now, but I am still interested in the answer to this question.
To be clear, I do not think there is any problem with Go (or git). It is a just a case of my changes not making it into git where I expected them to be. The aim of my question was to get a series of commands I could run on a local command-line in order to see which revisions get pulled down, inspect the status of the repositories etc.
The answer I was looking for would be something like:
For updates
cd <material destination directory>
git pull origin <branch>
git submodule update --init
For intial builds
cd <material destination directory>
git clone <repo url>
git submodule ...
The steps are as you describe: I commit and push to a submodule and it's parent. When the pipeline is triggered, a Go agent fails the job because an item of the submodule is at the wrong version.
Thanks for your reply,
Jon
Hi Jon,
The sequence of commands that the agent executes for an existing repositiory:
git fetch origin
git gc --auto
git reset --hard
git config --get-regexp ^submodule\..+\.url
for every submodule folder
git config --remove-section (for every submodule.<submodule-folder>)
deletes submodule folder
end
git submodule update --init
git submodule status
Thanks.
JJ & Sachin
Thanks Sachin, that's exactly what I was looking for. Are you able to give me the commands when the repository doesn't already exist?
https://github.com/gocd/gocd/blob/3cfb0a62fccabcc9e345df39cbede86c6cbea6db/domain/src/com/thoughtworks/go/domain/materials/git/GitCommand.java
Please sign in to leave a comment.