GitlabRunner does not check out the latest commit but the previous one
Summary
CI via gitlab-runner
does not check out the latest commit on the docker image, but uses the previous commit. This is wrong!
Steps to reproduce
I was able to reproduce this multiple times in our self-hosted GitLab CE instance.
Every time I committed the CI process used the previous instead of the current commit.
What is the current bug behavior?
Look at the commit id of the job on the right (this is the ID I would expect the CI job to use).
Then look at the gitlab runner log. It shows a differnt ID in "HEAD is now at..." message. It's the previous commit id.
What is the expected correct behavior?
I would expect gitlab-runner to use the latest commit.
Relevant logs and/or screenshots
see above.
This is the CI template:
variables:
# This will supress any download for dependencies and plugins or upload messages which would clutter the console log.
# `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work.
MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
# As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used
# when running from the command line.
# `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins.
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
# fetch submodules
GIT_SUBMODULE_STRATEGY: recursive
# copy settings.xml with our company Artifactory settings to /root/.m2/settings.xml
before_script:
- .gitlab-ci/artifactory-access/copy-settings.sh
# deploy SNAPSHOTS and RELEASE versions automatically to our Artifactory system
deploy:jdk7:
stage: deploy
image: maven:3.3-jdk-7
script:
- 'mvn $MAVEN_CLI_OPTS deploy'
artifacts:
paths:
- target/*.jar
expire_in: 3 weeks
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
~# sudo gitlab-rake gitlab:env:infoSystem information System: Ubuntu 16.04 Current User: git Using RVM: no Ruby Version: 2.3.6p384 Gem Version: 2.6.13 Bundler Version:1.13.7 Rake Version: 12.3.0 Redis Version: 3.2.11 Git Version: 2.14.3 Sidekiq Version:5.0.5 Go Version: unknown
GitLab information Version: 10.5.2 Revision: b951e0d Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://sub.host.tld HTTP Clone URL: https://sub.host.tld/some-group/some-project.git SSH Clone URL: git@sub.host.tld:some-group/some-project.git Using LDAP: no Using Omniauth: yes Omniauth Providers: github
GitLab Shell Version: 6.0.3 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
~# sudo gitlab-rake gitlab:check SANITIZE=true Checking GitLab Shell ...GitLab Shell version >= 6.0.3 ? ... OK (6.0.3) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 2/3 ... ok 2/4 ... ok 3/6 ... ok 17/7 ... ok 17/8 ... ok 2/9 ... ok 17/10 ... ok 2/11 ... ok 3/12 ... ok 2/13 ... ok 2/14 ... ok 2/15 ... ok 2/16 ... ok 2/17 ... ok 2/18 ... ok 3/19 ... ok 54/20 ... ok 2/21 ... ok 3/22 ... ok 54/25 ... ok 8/26 ... ok 19/27 ... ok 19/28 ... ok 19/29 ... ok 31/30 ... ok 17/31 ... ok 31/32 ... ok 10/33 ... ok 31/34 ... ok 3/35 ... ok 3/36 ... ok 1/37 ... ok 32/38 ... ok 32/39 ... ok 1/40 ... ok 32/41 ... ok 17/42 ... ok 17/43 ... ok 3/44 ... ok 36/46 ... ok 17/48 ... ok 54/51 ... ok 26/52 ... repository is empty 27/57 ... ok 27/58 ... ok 27/60 ... ok 27/61 ... ok 28/63 ... ok 28/64 ... ok 28/66 ... ok 28/69 ... ok 29/70 ... ok 28/72 ... ok 45/73 ... ok 45/74 ... ok 2/75 ... ok 28/76 ... ok 29/77 ... ok 10/78 ... ok 17/79 ... ok 10/80 ... ok 3/81 ... ok 52/82 ... ok 10/83 ... ok 36/84 ... ok 30/85 ... ok 26/86 ... ok 34/90 ... ok 45/91 ... ok 9/92 ... ok 10/95 ... repository is empty 36/96 ... ok 32/97 ... ok 10/98 ... ok 19/99 ... ok 36/100 ... ok 3/101 ... ok 3/102 ... ok 17/103 ... ok 36/106 ... ok 17/110 ... ok 48/111 ... ok 17/112 ... ok 48/114 ... ok 16/115 ... ok 29/116 ... ok 3/117 ... ok 9/118 ... ok 26/119 ... ok 16/120 ... ok 25/121 ... ok 13/122 ... ok 24/123 ... ok 8/124 ... repository is empty 25/126 ... ok 25/127 ... ok 26/128 ... ok 45/129 ... ok 54/130 ... ok 17/131 ... ok 17/132 ... ok 31/133 ... ok 34/135 ... ok 31/137 ... ok 10/138 ... ok 10/139 ... ok 17/140 ... ok 27/141 ... ok 10/142 ... repository is empty 48/143 ... ok 29/144 ... ok 10/145 ... ok 17/146 ... ok 28/148 ... ok 10/149 ... ok 10/150 ... ok 1/151 ... ok 41/152 ... ok 17/153 ... ok 10/155 ... ok 17/156 ... ok 3/157 ... ok 48/158 ... ok 17/160 ... ok 17/161 ... ok 10/162 ... ok 17/163 ... ok 17/164 ... ok 28/165 ... ok 48/166 ... ok 26/167 ... ok 17/168 ... ok 28/169 ... ok 26/171 ... ok 26/172 ... ok 17/173 ... ok 45/174 ... ok 45/175 ... ok 45/176 ... ok 45/177 ... ok 2/179 ... ok 54/180 ... ok 17/181 ... ok 17/182 ... ok 24/183 ... ok 54/185 ... ok 48/186 ... ok 48/187 ... repository is empty 3/188 ... ok 36/189 ... ok 28/190 ... repository is empty 17/191 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 2/3 ... yes 2/4 ... yes 3/6 ... yes 17/7 ... yes 17/8 ... yes 2/9 ... yes 17/10 ... yes 2/11 ... yes 3/12 ... yes 2/13 ... yes 2/14 ... yes 2/15 ... yes 2/16 ... yes 2/17 ... yes 2/18 ... yes 3/19 ... yes 54/20 ... yes 2/21 ... yes 3/22 ... yes 54/25 ... yes 8/26 ... yes 19/27 ... yes 19/28 ... yes 19/29 ... yes 31/30 ... yes 17/31 ... yes 31/32 ... yes 10/33 ... yes 31/34 ... yes 3/35 ... yes 3/36 ... yes 1/37 ... yes 32/38 ... yes 32/39 ... yes 1/40 ... yes 32/41 ... yes 17/42 ... yes 17/43 ... yes 3/44 ... yes 36/46 ... yes 17/48 ... yes 54/51 ... yes 26/52 ... yes 27/57 ... yes 27/58 ... yes 27/60 ... yes 27/61 ... yes 28/63 ... yes 28/64 ... yes 28/66 ... yes 28/69 ... yes 29/70 ... yes 28/72 ... yes 45/73 ... yes 45/74 ... yes 2/75 ... yes 28/76 ... yes 29/77 ... yes 10/78 ... yes 17/79 ... yes 10/80 ... yes 3/81 ... yes 52/82 ... yes 10/83 ... yes 36/84 ... yes 30/85 ... yes 26/86 ... yes 34/90 ... yes 45/91 ... yes 9/92 ... yes 10/95 ... yes 36/96 ... yes 32/97 ... yes 10/98 ... yes 19/99 ... yes 36/100 ... yes 3/101 ... yes 3/102 ... yes 17/103 ... yes 36/106 ... yes 17/110 ... yes 48/111 ... yes 17/112 ... yes 48/114 ... yes 16/115 ... yes 29/116 ... yes 3/117 ... yes 9/118 ... yes 26/119 ... yes 16/120 ... yes 25/121 ... yes 13/122 ... yes 24/123 ... yes 8/124 ... yes 25/126 ... yes 25/127 ... yes 26/128 ... yes 45/129 ... yes 54/130 ... yes 17/131 ... yes 17/132 ... yes 31/133 ... yes 34/135 ... yes 31/137 ... yes 10/138 ... yes 10/139 ... yes 17/140 ... yes 27/141 ... yes 10/142 ... yes 48/143 ... yes 29/144 ... yes 10/145 ... yes 17/146 ... yes 28/148 ... yes 10/149 ... yes 10/150 ... yes 1/151 ... yes 41/152 ... yes 17/153 ... yes 10/155 ... yes 17/156 ... yes 3/157 ... yes 48/158 ... yes 17/160 ... yes 17/161 ... yes 10/162 ... yes 17/163 ... yes 17/164 ... yes 28/165 ... yes 48/166 ... yes 26/167 ... yes 17/168 ... yes 28/169 ... yes 26/171 ... yes 26/172 ... yes 17/173 ... yes 45/174 ... yes 45/175 ... yes 45/176 ... yes 45/177 ... yes 2/179 ... yes 54/180 ... yes 17/181 ... yes 17/182 ... yes 24/183 ... yes 54/185 ... yes 48/186 ... yes 48/187 ... yes 3/188 ... yes 36/189 ... yes 28/190 ... yes 17/191 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.3.6) Git version >= 2.9.5 ? ... yes (2.14.3) Git user has default SSH configuration? ... yes Active users: ... 25
Checking GitLab ... Finished