Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
937e7f9e
Commit
937e7f9e
authored
Mar 13, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make predefined variables in a collection public by default
parent
0cf0a7a8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
15 deletions
+15
-15
app/models/project.rb
app/models/project.rb
+9
-9
lib/gitlab/ci/variables/collection/item.rb
lib/gitlab/ci/variables/collection/item.rb
+1
-1
spec/lib/gitlab/ci/variables/collection_spec.rb
spec/lib/gitlab/ci/variables/collection_spec.rb
+1
-1
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+4
-4
No files found.
app/models/project.rb
View file @
937e7f9e
...
...
@@ -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
...
...
lib/gitlab/ci/variables/collection/item.rb
View file @
937e7f9e
...
...
@@ -9,7 +9,7 @@ module Gitlab
@variable
=
{
key:
options
.
fetch
(
:key
),
value:
options
.
fetch
(
:value
),
public:
options
.
fetch
(
:public
,
fals
e
),
public:
options
.
fetch
(
:public
,
tru
e
),
file:
options
.
fetch
(
:files
,
false
)
}
end
...
...
spec/lib/gitlab/ci/variables/collection_spec.rb
View file @
937e7f9e
...
...
@@ -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:
fals
e
}]
.
to
eq
[{
key:
'TEST'
,
value:
1
,
public:
tru
e
}]
end
end
end
spec/models/ci/build_spec.rb
View file @
937e7f9e
...
...
@@ -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
]
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment