"Could not connect to the CI server. Please check your settings and try again" error when it should not run in merge request using `only: - tags@project`

Summary

"Could not connect to the CI server. Please check your settings and try again" error when using only: - tags@backend/myproject on all jobs (build, publish) in the .gitlab-ci.yml file.

Steps to reproduce

The .gitlab-ci.yml is configured so that only tagged commits. So merge requests should not run.

  1. The .gitlab-ci.yml file consists of the following structure:
stages:
  - build
  - publish

variables:
  MYGLOBALVARS: MYVALUES

.env:production: &env_production
  environment:
    name: production
    url: https://somewhere.tld
  variables:
    MOREVARS: MOREVALUES

build:
  stage: build
  image: myregistry.tld/myimage:version
  script:
    - echo "do something"
    - touch file.txt
    - tar czf file.gz file.txt
  artifacts:
    expire_in: 1 week
    paths:
      - file.gz
  tags:
    - thisrunner

.publish: &publish_job
  stage: publish
  image: myregistry.tld/myimage:version
  dependencies:
    - build
  script:
    - echo "do something"
  when: manual
  only:
    - tags@backend/myproject
  tags:
    - thisrunner

publish:production:
  <<: *env_production
  <<: *publish_job
  1. Remove the only: under the build job, so it looks as shown above.
  2. Commit the file and make a merge request.
  3. The build job runs, but the publish:production job does not run waiting for manual execution, which works as expected.
  4. Add to the build job:
  only:
    - tags@backend/myproject

and remove when: manual from the publish:production job, so that both build and publish jobs should only run when a tag is pushed.

So it looks like:

stages:
  - build
  - publish

variables:
  MYGLOBALVARS: MYVALUES

.env:production: &env_production
  environment:
    name: production
    url: https://somewhere.tld
  variables:
    MOREVARS: MOREVALUES

build:
  stage: build
  image: myregistry.tld/myimage:version
  script:
    - echo "do something"
    - touch file.txt
    - tar czf file.gz file.txt
  artifacts:
    expire_in: 1 week
    paths:
      - file.gz
  only:
    - tags@backend/myproject
  tags:
    - thisrunner

.publish: &publish_job
  stage: publish
  image: myregistry.tld/myimage:version
  dependencies:
    - build
  script:
    - echo "do something"
  only:
    - tags@backend/myproject
  tags:
    - thisrunner

publish:production:
  <<: *env_production
  <<: *publish_job
  1. Rebase and push the commit. Nothing should run, which is the case in the merge request. But the red merge button is not expected to be red and the the error shows up (see screenshot). Instead it should not be trying to connect to the CI server.

  2. See the error (screenshot below).

Example Project

N/A

What is the current bug behavior?

Getting error and red merge button when all jobs have:

  only:
    - tags@backend/myproject

See screenshot.

What is the expected correct behavior?

No error and a normal (non-red) merge button.

Relevant logs and/or screenshots

Screen_Shot_2018-10-25_at_22.16.28

Results of GitLab environment info

Expand for output related to GitLab environment info

System information System: Ubuntu 16.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.4.4p296 Gem Version: 2.7.6 Bundler Version:1.16.2 Rake Version: 12.3.1 Redis Version: 3.2.12 Git Version: 2.18.1 Sidekiq Version:5.2.1 Go Version: unknown

GitLab information Version: 11.4.0-ee Revision: cfe266c Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql DB Version: 9.6.6 URL: [REDACTED] HTTP Clone URL: [REDACTED] SSH Clone URL: [REDACTED] Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers: google_oauth2, github

GitLab Shell Version: 8.3.3 Repository storage paths:

  • default: /mnt/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 >= 8.3.3 ? ... OK (8.3.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: ... 12/1 ... repository is empty 8/2 ... ok 8/3 ... ok 8/4 ... ok 8/5 ... ok 8/6 ... ok 8/7 ... ok 8/8 ... ok 8/9 ... ok 8/10 ... ok 13/11 ... ok 8/12 ... repository is empty 8/13 ... ok 2/14 ... ok 2/15 ... ok 5/16 ... ok 14/17 ... ok 5/18 ... ok 20/19 ... ok 20/20 ... ok 20/21 ... ok 21/22 ... ok 14/23 ... ok 8/24 ... ok 8/25 ... ok 8/26 ... ok 5/27 ... ok 5/28 ... ok 5/29 ... ok 19/31 ... ok 2/33 ... ok 7/34 ... ok 7/35 ... ok 7/36 ... ok 2/37 ... ok 2/38 ... ok 26/39 ... ok 11/40 ... ok 8/41 ... ok 19/42 ... ok 19/43 ... ok 20/44 ... ok 19/45 ... ok 19/46 ... ok 20/47 ... ok 2/48 ... ok 8/49 ... ok 2/50 ... ok 14/51 ... ok 8/52 ... ok 19/53 ... ok 7/54 ... ok 19/55 ... ok 19/56 ... ok 7/57 ... ok 8/58 ... ok 13/59 ... ok 32/60 ... ok 32/61 ... ok 25/62 ... ok 2/63 ... ok 8/64 ... ok 33/65 ... ok 5/66 ... ok 25/67 ... ok 19/68 ... ok 25/69 ... ok 25/70 ... ok 25/71 ... ok 31/72 ... ok 31/73 ... ok 7/74 ... ok 19/75 ... ok 31/76 ... ok 24/77 ... ok 5/78 ... ok 14/80 ... repository is empty 28/82 ... ok 26/83 ... ok 13/85 ... ok 13/86 ... ok 11/87 ... ok 2/88 ... ok 2/89 ... repository is empty 17/90 ... repository is empty 5/91 ... ok 21/92 ... ok 11/94 ... ok 13/96 ... ok 7/98 ... ok 26/99 ... ok 8/100 ... ok 8/102 ... ok 19/103 ... ok 28/104 ... ok 24/105 ... ok 25/106 ... ok 19/107 ... ok 7/108 ... ok 8/109 ... ok 33/110 ... ok 24/111 ... ok 28/112 ... repository is empty 31/113 ... ok 2/114 ... ok 7/115 ... ok 2/116 ... ok 2/117 ... ok 33/118 ... ok 24/119 ... ok 5/120 ... ok 7/121 ... ok 24/122 ... ok 36/123 ... ok 33/124 ... ok 36/125 ... ok 26/126 ... ok 13/127 ... ok 33/128 ... ok 33/129 ... ok 24/131 ... ok 7/132 ... ok 13/133 ... ok 33/134 ... ok 19/135 ... ok 5/136 ... ok 5/137 ... ok 40/138 ... ok 7/139 ... ok 36/140 ... ok 26/141 ... ok 13/142 ... ok 39/143 ... ok 8/144 ... ok 7/145 ... ok 38/146 ... ok 41/147 ... ok 41/148 ... ok 40/149 ... ok 7/150 ... ok 39/151 ... ok 13/152 ... ok 31/155 ... ok 31/156 ... ok 7/157 ... ok 38/158 ... ok 7/159 ... ok 25/160 ... ok 40/162 ... ok 40/163 ... ok 21/164 ... ok 33/165 ... ok 33/166 ... ok 39/167 ... ok 13/168 ... ok 7/169 ... ok 30/170 ... ok 26/171 ... ok 45/172 ... ok 7/173 ... ok 8/174 ... ok 25/175 ... ok 11/176 ... ok 8/177 ... ok 28/178 ... ok 33/180 ... ok 33/181 ... ok 7/182 ... ok 7/183 ... ok 36/185 ... ok 7/186 ... ok 13/187 ... ok 36/188 ... ok 36/189 ... ok 28/190 ... ok 28/191 ... ok 28/192 ... ok 33/193 ... ok 43/194 ... ok 30/195 ... ok 7/196 ... ok 33/197 ... ok 7/198 ... ok 5/199 ... ok 5/200 ... ok 7/201 ... ok 28/202 ... ok 21/203 ... ok 13/204 ... ok 22/205 ... ok 33/206 ... ok 36/207 ... ok 33/208 ... ok 13/209 ... ok 13/210 ... ok 5/211 ... ok 11/212 ... ok 5/213 ... ok 28/214 ... ok 25/215 ... ok 2/216 ... ok 29/217 ... ok 13/218 ... ok 36/219 ... ok 49/220 ... repository is empty 25/221 ... ok 33/222 ... ok 43/223 ... ok 2/224 ... ok 21/225 ... ok 25/226 ... ok 2/227 ... ok 29/228 ... ok 28/229 ... ok 43/230 ... ok 2/231 ... ok 36/232 ... ok 43/233 ... ok 2/234 ... ok 2/235 ... ok 49/236 ... ok 43/238 ... ok 41/239 ... ok 25/240 ... ok 7/241 ... ok 8/242 ... ok 8/243 ... ok 43/244 ... ok 5/245 ... ok 2/246 ... ok 2/247 ... ok 5/248 ... ok 43/249 ... ok 28/250 ... ok 2/251 ... ok 25/252 ... ok 25/253 ... ok 54/254 ... ok 55/255 ... ok 21/256 ... ok 2/257 ... ok 55/259 ... ok 55/260 ... ok 13/261 ... repository is empty 26/262 ... ok 52/263 ... 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: ... 12/1 ... yes 8/2 ... yes 8/3 ... yes 8/4 ... yes 8/5 ... yes 8/6 ... yes 8/7 ... yes 8/8 ... yes 8/9 ... yes 8/10 ... yes 13/11 ... yes 8/12 ... yes 8/13 ... yes 2/14 ... yes 2/15 ... yes 5/16 ... yes 14/17 ... yes 5/18 ... yes 20/19 ... yes 20/20 ... yes 20/21 ... yes 21/22 ... yes 14/23 ... yes 8/24 ... yes 8/25 ... yes 8/26 ... yes 5/27 ... yes 5/28 ... yes 5/29 ... yes 19/31 ... yes 2/33 ... yes 7/34 ... yes 7/35 ... yes 7/36 ... yes 2/37 ... yes 2/38 ... yes 26/39 ... yes 11/40 ... yes 8/41 ... yes 19/42 ... yes 19/43 ... yes 20/44 ... yes 19/45 ... yes 19/46 ... yes 20/47 ... yes 2/48 ... yes 8/49 ... yes 2/50 ... yes 14/51 ... yes 8/52 ... yes 19/53 ... yes 7/54 ... yes 19/55 ... yes 19/56 ... yes 7/57 ... yes 8/58 ... yes 13/59 ... yes 32/60 ... yes 32/61 ... yes 25/62 ... yes 2/63 ... yes 8/64 ... yes 33/65 ... yes 5/66 ... yes 25/67 ... yes 19/68 ... yes 25/69 ... yes 25/70 ... yes 25/71 ... yes 31/72 ... yes 31/73 ... yes 7/74 ... yes 19/75 ... yes 31/76 ... yes 24/77 ... yes 5/78 ... yes 14/80 ... yes 28/82 ... yes 26/83 ... yes 13/85 ... yes 13/86 ... yes 11/87 ... yes 2/88 ... yes 2/89 ... yes 17/90 ... yes 5/91 ... yes 21/92 ... yes 11/94 ... yes 13/96 ... yes 7/98 ... yes 26/99 ... yes 8/100 ... yes 8/102 ... yes 19/103 ... yes 28/104 ... yes 24/105 ... yes 25/106 ... yes 19/107 ... yes 7/108 ... yes 8/109 ... yes 33/110 ... yes 24/111 ... yes 28/112 ... yes 31/113 ... yes 2/114 ... yes 7/115 ... yes 2/116 ... yes 2/117 ... yes 33/118 ... yes 24/119 ... yes 5/120 ... yes 7/121 ... yes 24/122 ... yes 36/123 ... yes 33/124 ... yes 36/125 ... yes 26/126 ... yes 13/127 ... yes 33/128 ... yes 33/129 ... yes 24/131 ... yes 7/132 ... yes 13/133 ... yes 33/134 ... yes 19/135 ... yes 5/136 ... yes 5/137 ... yes 40/138 ... yes 7/139 ... yes 36/140 ... yes 26/141 ... yes 13/142 ... yes 39/143 ... yes 8/144 ... yes 7/145 ... yes 38/146 ... yes 41/147 ... yes 41/148 ... yes 40/149 ... yes 7/150 ... yes 39/151 ... yes 13/152 ... yes 31/155 ... yes 31/156 ... yes 7/157 ... yes 38/158 ... yes 7/159 ... yes 25/160 ... yes 40/162 ... yes 40/163 ... yes 21/164 ... yes 33/165 ... yes 33/166 ... yes 39/167 ... yes 13/168 ... yes 7/169 ... yes 30/170 ... yes 26/171 ... yes 45/172 ... yes 7/173 ... yes 8/174 ... yes 25/175 ... yes 11/176 ... yes 8/177 ... yes 28/178 ... yes 33/180 ... yes 33/181 ... yes 7/182 ... yes 7/183 ... yes 36/185 ... yes 7/186 ... yes 13/187 ... yes 36/188 ... yes 36/189 ... yes 28/190 ... yes 28/191 ... yes 28/192 ... yes 33/193 ... yes 43/194 ... yes 30/195 ... yes 7/196 ... yes 33/197 ... yes 7/198 ... yes 5/199 ... yes 5/200 ... yes 7/201 ... yes 28/202 ... yes 21/203 ... yes 13/204 ... yes 22/205 ... yes 33/206 ... yes 36/207 ... yes 33/208 ... yes 13/209 ... yes 13/210 ... yes 5/211 ... yes 11/212 ... yes 5/213 ... yes 28/214 ... yes 25/215 ... yes 2/216 ... yes 29/217 ... yes 13/218 ... yes 36/219 ... yes 49/220 ... yes 25/221 ... yes 33/222 ... yes 43/223 ... yes 2/224 ... yes 21/225 ... yes 25/226 ... yes 2/227 ... yes 29/228 ... yes 28/229 ... yes 43/230 ... yes 2/231 ... yes 36/232 ... yes 43/233 ... yes 2/234 ... yes 2/235 ... yes 49/236 ... yes 43/238 ... yes 41/239 ... yes 25/240 ... yes 7/241 ... yes 8/242 ... yes 8/243 ... yes 43/244 ... yes 5/245 ... yes 2/246 ... yes 2/247 ... yes 5/248 ... yes 43/249 ... yes 28/250 ... yes 2/251 ... yes 25/252 ... yes 25/253 ... yes 54/254 ... yes 55/255 ... yes 21/256 ... yes 2/257 ... yes 55/259 ... yes 55/260 ... yes 13/261 ... yes 26/262 ... yes 52/263 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.4.4) Git version >= 2.9.5 ? ... yes (2.18.1) Git user has default SSH configuration? ... yes Active users: ... 32 Elasticsearch version 5.1 - 5.5? ... skipped (elasticsearch is disabled)

Checking GitLab ... Finished

Possible fixes

N/A

Edited: edit reproduction instructions for clarity.

Edited Jul 27, 2020 by Jason Yavorsky
Assignee Loading
Time tracking Loading