diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-03-13 14:01:48 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-03-13 14:01:48 +0100 |
commit | 937e7f9e9669d4939cd6c5055a90339ff79d216b (patch) | |
tree | 5f794b0f892fbbc117101097b805c2da5dcac45e | |
parent | 0cf0a7a898f06fc2a154683e76dc9199832c01c8 (diff) | |
download | gitlab-ce-937e7f9e9669d4939cd6c5055a90339ff79d216b.tar.gz |
Make predefined variables in a collection public by default
-rw-r--r-- | app/models/project.rb | 18 | ||||
-rw-r--r-- | lib/gitlab/ci/variables/collection/item.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/variables/collection_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/ci/build_spec.rb | 8 |
4 files changed, 15 insertions, 15 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 85a4d570e9a..c1d8d43f380 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1574,13 +1574,13 @@ class Project < ActiveRecord::Base visibility = Gitlab::VisibilityLevel.string_level(visibility_level) Gitlab::Ci::Variables::Collection.new.tap do |variables| - variables.append(key: 'CI_PROJECT_ID', value: id.to_s, public: true) - variables.append(key: 'CI_PROJECT_NAME', value: path, public: true) - variables.append(key: 'CI_PROJECT_PATH', value: full_path, public: true) - variables.append(key: 'CI_PROJECT_PATH_SLUG', value: full_path_slug, public: true) - variables.append(key: 'CI_PROJECT_NAMESPACE', value: namespace.full_path, public: true) - variables.append(key: 'CI_PROJECT_URL', value: web_url, public: true) - variables.append(key: 'CI_PROJECT_VISIBILITY', value: visibility, public: true) + variables.append(key: 'CI_PROJECT_ID', value: id.to_s) + variables.append(key: 'CI_PROJECT_NAME', value: path) + variables.append(key: 'CI_PROJECT_PATH', value: full_path) + variables.append(key: 'CI_PROJECT_PATH_SLUG', value: full_path_slug) + variables.append(key: 'CI_PROJECT_NAMESPACE', value: namespace.full_path) + variables.append(key: 'CI_PROJECT_URL', value: web_url) + variables.append(key: 'CI_PROJECT_VISIBILITY', value: visibility) variables.concat(container_registry_variables) variables.concat(auto_devops_variables) end @@ -1590,10 +1590,10 @@ class Project < ActiveRecord::Base Gitlab::Ci::Variables::Collection.new.tap do |variables| return variables unless Gitlab.config.registry.enabled - variables.append(key: 'CI_REGISTRY', value: Gitlab.config.registry.host_port, public: true) + variables.append(key: 'CI_REGISTRY', value: Gitlab.config.registry.host_port) if container_registry_enabled? - variables.append(key: 'CI_REGISTRY_IMAGE', value: container_registry_url, public: true) + variables.append(key: 'CI_REGISTRY_IMAGE', value: container_registry_url) end end end diff --git a/lib/gitlab/ci/variables/collection/item.rb b/lib/gitlab/ci/variables/collection/item.rb index 1ed07cedd55..47e06566607 100644 --- a/lib/gitlab/ci/variables/collection/item.rb +++ b/lib/gitlab/ci/variables/collection/item.rb @@ -9,7 +9,7 @@ module Gitlab @variable = { key: options.fetch(:key), value: options.fetch(:value), - public: options.fetch(:public, false), + public: options.fetch(:public, true), file: options.fetch(:files, false) } end diff --git a/spec/lib/gitlab/ci/variables/collection_spec.rb b/spec/lib/gitlab/ci/variables/collection_spec.rb index c4b2df7dede..9ee39d40625 100644 --- a/spec/lib/gitlab/ci/variables/collection_spec.rb +++ b/spec/lib/gitlab/ci/variables/collection_spec.rb @@ -58,7 +58,7 @@ describe Gitlab::Ci::Variables::Collection do collection = described_class.new([{ key: 'TEST', value: 1 }]) expect(collection.to_runner_variables) - .to eq [{ key: 'TEST', value: 1, public: false }] + .to eq [{ key: 'TEST', value: 1, public: true }] end end end diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index c27313ed88b..1365c1d84d6 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1835,10 +1835,10 @@ describe Ci::Build do end context 'returns variables in valid order' do - let(:build_pre_var) { { key: 'build', value: 'value' } } - let(:project_pre_var) { { key: 'project', value: 'value' } } - let(:pipeline_pre_var) { { key: 'pipeline', value: 'value' } } - let(:build_yaml_var) { { key: 'yaml', value: 'value' } } + let(:build_pre_var) { { key: 'build', value: 'value', public: true } } + let(:project_pre_var) { { key: 'project', value: 'value', public: true } } + let(:pipeline_pre_var) { { key: 'pipeline', value: 'value', public: true } } + let(:build_yaml_var) { { key: 'yaml', value: 'value', public: true } } before do allow(build).to receive(:predefined_variables) { [build_pre_var] } |