GoCD devs: can anyone tell me what GoCD uses to actually clone from Git?
is it JGit?
arvindsv
It's JGit only for /var/lib/go-server/db/config.git. Only. For everything else, it is system git.
tedbot
arvindsv: thanks for answering, though I can't believe that's true, as I have tests that show file permission discrepancies b/w repo clones
the clones being one cloned using GoCD, and the other using system Git
we'd really like to use GoCD, but we can't count on it to accurately reproduce what's in our repos, we'd avoid it like the plague
but *if
so please show me my error
arvindsv
Are these clones on the server (/var/lib/go-server/pipelines/flyweight) or clones on the agent (before starting a build). Either way, my answer stands. It uses JGit internally only.
Ok. I see it. You changed it in config-server/pom.xml. As far as I know, that doesn't even go to the agent side. Let me confirm. Give me a minute.
tedbot
yeah, that change might be unrelated to my problem if it doesn't affect the agents...however, the problem stills stands - file permission differences cloning via GoCD vs command line Git
arvindsv
Ok. I've verified that all the 3 agent JARs don't even have JGit in them:
$ unzip -l agent-launcher.jar | grep -i git
$ unzip -l agent.jar | grep -i git
$ unzip -l agent-bootstrapper.jar | grep -i git
Ok, let's go ahead now and see what the problem is.
tedbot
that's great
arvindsv
Do you have a public repo I can use to reproduce this?
I see your script.
Do you want me to run it get a repo?
tedbot
run it after you have two git repos -- one from GoCD and one done by hand
arvindsv
Yes, I see that it is only comparing repo permissions.
tedbot
you can see in the linked GoCD gist where I was running this on the agent
correct...file perms
arvindsv
Sorry, file perms, yes.
tedbot
which is a problem I've run into over the years when using JGit
arvindsv
So, when the output says this:
0644 0664 ./agent/bamboo-android/Dockerfile
Oh.
I see.
tedbot
yep
arvindsv
0664 and 0644.
Ok.
tedbot
and 775 -> 755
that's classic JGit behavior
arvindsv
That just looks like the umask of the go user is set to 020.
Can you verify that?
tedbot
yep...processing...
arvindsv
If it is 020, then every file should get masked by that, and should produce behavior that you're seeing.
tedbot
0002
arvindsv
Ok. Can you do a git clone now, as go user?
tedbot
cloned
arvindsv
Ok, is it 644 or 664?
tedbot
the test results posted were done as the go user
verifying....
664 with the cli clone, 644 with GoCD clone
as the go user
arvindsv
Alright. And, 664 is the correct one, right?
tedbot
yes, that's correcyt
*correct
arvindsv
Do you have full control over this box? It sounds like a Docker container. Is that right?
tedbot
yes
on both counts
but, it should be noted that this same setup (Docker container, etc) does not have this problem when I do this same test with Bamboo
its clone and the cli clone are identical
arvindsv
I'd like to move /usr/bin/git to /usr/bin/git.old and log everything that calls /usr/bin/git. Something like:
#!/bin/bash
echo "$(date): git $@"
exec /usr/bin/git.old "$@"
Sure, I'm not saying it's a problem with Docker, etc.
Was just wondering whether we could make the change above.
Since it's a container, it should be ok.
Actually, if you can change that to:
echo "$(date): git $@" >>/tmp/git.log
that'll be better.
tedbot
k, sec...copy/pasta isn't great over my IM client
arvindsv
Ok. Adding a bit more:
echo "$(date): $(pwd): git $@" >>/tmp/git.log
Also, don't forget to chmod +x /usr/bin/git
tedbot
git.old doesn't exist though
what are you trying to do with this script?
arvindsv
mv /usr/bin/git to /usr/bin/git.old
tedbot
ok
arvindsv
I want to log all args that come in. All calls to git.
tedbot
oh I see...and you typed that earlier...didn't see that
arvindsv
Ah, ok. So yes, mv that, and then this script is the new git. For now.
tedbot
ok, that's all set...I'll run another build in GoCD