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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
5ceb439d
Commit
5ceb439d
authored
Mar 07, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove enforcing uniqueness of build variables
parent
c9d2fd3c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
10 deletions
+9
-10
app/models/ci/build.rb
app/models/ci/build.rb
+1
-1
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+8
-9
No files found.
app/models/ci/build.rb
View file @
5ceb439d
...
...
@@ -268,7 +268,7 @@ module Ci
variables
+=
pipeline
.
pipeline_schedule
.
job_variables
if
pipeline
.
pipeline_schedule
variables
+=
persisted_environment_variables
if
environment
variables
.
reverse
.
uniq
{
|
variable
|
variable
.
fetch
(
:key
)
}.
reverse
variables
end
def
features
...
...
spec/models/ci/build_spec.rb
View file @
5ceb439d
...
...
@@ -1873,14 +1873,13 @@ describe Ci::Build do
pipeline
.
variables
.
build
(
key:
'MYVAR'
,
value:
'pipeline value'
)
end
it
'removes duplicates and leaves the latest occurence'
do
expect
(
subject
.
count
{
|
variable
|
variable
.
fetch
(
:key
)
==
'MYVAR'
})
.
to
be
1
end
it
'overrides YAML variable using a pipeline variable'
do
is_expected
.
not_to
include
(
key:
'MYVAR'
,
value:
'myvar'
,
public:
true
)
is_expected
.
to
include
(
key:
'MYVAR'
,
value:
'pipeline value'
,
public:
false
)
variables
=
subject
.
reverse
.
uniq
{
|
variable
|
variable
[
:key
]
}.
reverse
expect
(
variables
)
.
not_to
include
(
key:
'MYVAR'
,
value:
'myvar'
,
public:
true
)
expect
(
variables
)
.
to
include
(
key:
'MYVAR'
,
value:
'pipeline value'
,
public:
false
)
end
end
...
...
@@ -1921,8 +1920,8 @@ describe Ci::Build do
context
'when build has environment and user-provided variables'
do
let
(
:expected_variables
)
do
predefined_variables
.
map
{
|
variable
|
variable
.
fetch
(
:key
)
}
+
%w[YAML_VARIABLE CI_ENVIRONMENT_NAME CI_ENVIRONMENT_SLUG
CI_ENVIRONMENT_URL]
%w[YAML_VARIABLE CI_ENVIRONMENT_NAME CI_ENVIRONMENT_SLUG
CI_ENVIRONMENT_URL]
end
before
do
...
...
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