Skip to content

Cannot pass $CI_ENVIRONMENT_SLUG to downstream pipeline

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

After #369061 (closed) was fixed, if you use that feature in combination with $CI_ENVIRONMENT_SLUG, the passed variable will be empty.

Steps to reproduce

Upstream pipeline:

deploy:
  trigger:
    project: project-group/my-downstream-project
  environment:
    name: review/$CI_COMMIT_REF_SLUG
    url: http://$CI_ENVIRONMENT_SLUG.example.com
  variables:
    UPSTREAM_ENVIRONMENT_SLUG: $CI_ENVIRONMENT_SLUG

Downstream pipeline:

deploy:
  script: echo "Deploy to http://$UPSTREAM_ENVIRONMENT_SLUG.example.com"
  rules:
    - if: $CI_PIPELINE_SOURCE == "pipeline"

What is the current bug behavior?

Downstream pipeline prints Deploy to http://.example.com

What is the expected correct behavior?

Downstream pipleine should print Deploy to http://review-some-slug.example.com

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:
Proxy:          no
Current User:   git
Using RVM:      no
Ruby Version:   3.0.6p216
Gem Version:    3.4.19
Bundler Version:2.4.19
Rake Version:   13.0.6
Redis Version:  6.0.16
Sidekiq Version:6.5.7
Go Version:     unknown

GitLab information
Version:        16.4.0-ee
Revision:       e4c1c182610
Directory:      /srv/gitlab
DB Adapter:     PostgreSQL
DB Version:     13.9
URL:            https://[REDACTED]
HTTP Clone URL: https://[REDACTED]/some-group/some-project.git
SSH Clone URL:  ssh://git@[REDACTED]:2222/some-group/some-project.git
Elasticsearch:  no
Geo:            no
Using LDAP:     no
Using Omniauth: yes
Omniauth Providers: google_oauth2

GitLab Shell
Version:        14.28.0
Repository storages:
- default:      tcp://gitlab-gitaly-0.gitlab-gitaly.gitlab.svc:8075
GitLab Shell path:              /home/git/gitlab-shell

Gitaly
- default Address:      tcp://gitlab-gitaly-0.gitlab-gitaly.gitlab.svc:8075
- default Version:      16.4.0
- default Git Version:  2.42.0

Results of GitLab application Check

Expand for output related to the GitLab application check
Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 14.28.0 ? ... OK (14.28.0)
Running /home/git/gitlab-shell/bin/check
gitlab-shell self-check failed
  Try fixing it:
  Make sure GitLab is running;
  Check the gitlab-shell configuration file:
  sudo -u git -H editor /home/git/gitlab-shell/config.yml
  Please fix the error above and rerun the checks.

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... no
  Try fixing it:
  sudo -u git -H RAILS_ENV=production bin/background_jobs start
  For more information see:
  doc/install/installation.md in section "Install Init Script"
  see log/sidekiq.log for possible errors
  Please fix the error above and rerun the checks.

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Database config exists? ... yes
Tables are truncated? ... skipped
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Cable config exists? ... yes
Resque config exists? ... 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? ... skipped (no tmp uploads folder yet)
Systemd unit files or init script exist? ... no
  Try fixing it:
  Install the Service
  For more information see:
  doc/install/installation.md in section "Install the Service"
  Please fix the error above and rerun the checks.
Systemd unit files or init script up-to-date? ... can't check because of previous errors
Projects have namespace: ... 
4/1 ... yes
3/2 ... yes
5/3 ... yes
3/5 ... yes
6/6 ... yes
6/14 ... yes
6/15 ... yes
6/16 ... yes
6/17 ... yes
5/18 ... yes
5/19 ... yes
5/20 ... yes
5/21 ... yes
5/22 ... yes
5/23 ... yes
5/24 ... yes
5/25 ... yes
3/26 ... yes
8/28 ... yes
8/29 ... yes
3/30 ... yes
5/63 ... yes
5/96 ... yes
5/97 ... yes
5/98 ... yes
8/133 ... yes
8/134 ... yes
5/135 ... yes
8/136 ... yes
5/137 ... yes
3/170 ... yes
4/171 ... yes
8/205 ... yes
8/238 ... yes
8/239 ... yes
8/240 ... yes
Redis version >= 6.0.0? ... yes
Ruby version >= 3.0.6 ? ... yes (3.0.6)
Git user has default SSH configuration? ... yes
Active users: ... 14
Is authorized keys file accessible? ... skipped (authorized keys not enabled)
GitLab configured to store new projects in hashed storage? ... yes
All projects are in hashed storage? ... yes
Elasticsearch version 7.x-8.x or OpenSearch version 1.x ... skipped (Advanced Search is disabled)
All migrations must be finished before doing a major upgrade ... skipped (Advanced Search is disabled)

Checking GitLab App ... Finished


Checking GitLab subtasks ... Finished

Possible fixes

Edited by 🤖 GitLab Bot 🤖