Commit 937e7f9e authored by Grzegorz Bizon's avatar Grzegorz Bizon

Make predefined variables in a collection public by default

parent 0cf0a7a8
......@@ -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
......
......@@ -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
......
......@@ -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
......@@ -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] }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment