diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-05-21 16:26:51 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-05-21 16:26:51 +0300 |
commit | 723b2471dc3538fd61a05d6251363e6d0ad66394 (patch) | |
tree | e5d94b4372fcf79e7ba4af3cd889e42593bc4c99 /spec/services | |
parent | 7100f89f32b9cc95b03ea4e557f969da2b47e121 (diff) | |
parent | cd7702e5cd4ffcb1989d5fe758e3971a8952c5c0 (diff) |
Merge branch 'fix/gb/exclude-persisted-variables-from-environment-name' into 'master'
Do not allow to use `CI_PIPELINE_ID` in environment name
Closes #46443
See merge request gitlab-org/gitlab-ce!19032
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/ci/create_pipeline_service_spec.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index 9a0b6efd8a9..2b88fcc9a96 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -395,7 +395,27 @@ describe Ci::CreatePipelineService do result = execute_service expect(result).to be_persisted - expect(Environment.find_by(name: "review/master")).not_to be_nil + expect(Environment.find_by(name: "review/master")).to be_present + end + end + + context 'with environment name including persisted variables' do + before do + config = YAML.dump( + deploy: { + environment: { name: "review/id1$CI_PIPELINE_ID/id2$CI_BUILD_ID" }, + script: 'ls' + } + ) + + stub_ci_pipeline_yaml_file(config) + end + + it 'skipps persisted variables in environment name' do + result = execute_service + + expect(result).to be_persisted + expect(Environment.find_by(name: "review/id1/id2")).to be_present end end |