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
9f7deb85
Commit
9f7deb85
authored
May 18, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not allow to use `CI_PIPELINE_ID` in environment name
parent
769c4a61
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+7
-2
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+22
-0
No files found.
app/models/ci/pipeline.rb
View file @
9f7deb85
...
...
@@ -523,9 +523,14 @@ module Ci
strong_memoize
(
:legacy_trigger
)
{
trigger_requests
.
first
}
end
def
persisted_variables
Gitlab
::
Ci
::
Variables
::
Collection
.
new
.
tap
do
|
variables
|
variables
.
append
(
key:
'CI_PIPELINE_ID'
,
value:
id
.
to_s
)
if
persisted?
end
end
def
predefined_variables
Gitlab
::
Ci
::
Variables
::
Collection
.
new
.
append
(
key:
'CI_PIPELINE_ID'
,
value:
id
.
to_s
)
persisted_variables
.
append
(
key:
'CI_CONFIG_PATH'
,
value:
ci_yaml_file_path
)
.
append
(
key:
'CI_PIPELINE_SOURCE'
,
value:
source
.
to_s
)
.
append
(
key:
'CI_COMMIT_MESSAGE'
,
value:
git_commit_message
)
...
...
spec/models/ci/pipeline_spec.rb
View file @
9f7deb85
...
...
@@ -167,6 +167,28 @@ describe Ci::Pipeline, :mailer do
end
end
describe
'#persisted_variables'
do
context
'when pipeline is not persisted yet'
do
subject
{
build
(
:ci_pipeline
).
persisted_variables
}
it
'does not contain some variables'
do
keys
=
subject
.
map
{
|
variable
|
variable
[
:key
]
}
expect
(
keys
).
not_to
include
'CI_PIPELINE_ID'
end
end
context
'when pipeline is persisted'
do
subject
{
build_stubbed
(
:ci_pipeline
).
persisted_variables
}
it
'does not contain some variables'
do
keys
=
subject
.
map
{
|
variable
|
variable
[
:key
]
}
expect
(
keys
).
to
include
'CI_PIPELINE_ID'
end
end
end
describe
'#predefined_variables'
do
subject
{
pipeline
.
predefined_variables
}
...
...
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