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
005a00d3
Commit
005a00d3
authored
Oct 16, 2020
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch '206929-fix-workflow-rules-variable-access' into 'master'"
This reverts merge request !44935
parent
56168614
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
2 additions
and
169 deletions
+2
-169
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+1
-1
changelogs/unreleased/206929-fix-workflow-rules-variable-access.yml
.../unreleased/206929-fix-workflow-rules-variable-access.yml
+0
-5
spec/services/ci/create_downstream_pipeline_service_spec.rb
spec/services/ci/create_downstream_pipeline_service_spec.rb
+0
-35
spec/services/ci/create_pipeline_service_spec.rb
spec/services/ci/create_pipeline_service_spec.rb
+1
-105
spec/services/ci/pipeline_trigger_service_spec.rb
spec/services/ci/pipeline_trigger_service_spec.rb
+0
-23
No files found.
app/services/ci/create_pipeline_service.rb
View file @
005a00d3
...
@@ -14,8 +14,8 @@ module Ci
...
@@ -14,8 +14,8 @@ module Ci
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Config
::
Process
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Config
::
Process
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
RemoveUnwantedChatJobs
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
RemoveUnwantedChatJobs
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Skip
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Skip
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Seed
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
EvaluateWorkflowRules
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
EvaluateWorkflowRules
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Seed
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Limit
::
Size
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Limit
::
Size
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Validate
::
External
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Validate
::
External
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Populate
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Populate
,
...
...
changelogs/unreleased/206929-fix-workflow-rules-variable-access.yml
deleted
100644 → 0
View file @
56168614
---
title
:
Fix workflow:rules not accessing passed-upstream and trigger variables
merge_request
:
44935
author
:
type
:
fixed
spec/services/ci/create_downstream_pipeline_service_spec.rb
View file @
005a00d3
...
@@ -581,40 +581,5 @@ RSpec.describe Ci::CreateDownstreamPipelineService, '#execute' do
...
@@ -581,40 +581,5 @@ RSpec.describe Ci::CreateDownstreamPipelineService, '#execute' do
)
)
end
end
end
end
context
'when downstream pipeline has workflow rule'
do
before
do
stub_ci_pipeline_yaml_file
(
config
)
end
let
(
:config
)
do
<<-
EOY
workflow:
rules:
- if: $my_var
regular-job:
script: 'echo Hello, World!'
EOY
end
context
'when passing the required variable'
do
before
do
bridge
.
yaml_variables
=
[{
key:
'my_var'
,
value:
'var'
,
public:
true
}]
end
it
'creates the pipeline'
do
expect
{
service
.
execute
(
bridge
)
}.
to
change
(
downstream_project
.
ci_pipelines
,
:count
).
by
(
1
)
expect
(
bridge
.
reload
).
to
be_success
end
end
context
'when not passing the required variable'
do
it
'does not create the pipeline'
do
expect
{
service
.
execute
(
bridge
)
}.
not_to
change
(
downstream_project
.
ci_pipelines
,
:count
)
end
end
end
end
end
end
end
spec/services/ci/create_pipeline_service_spec.rb
View file @
005a00d3
...
@@ -41,9 +41,7 @@ RSpec.describe Ci::CreatePipelineService do
...
@@ -41,9 +41,7 @@ RSpec.describe Ci::CreatePipelineService do
save_on_errors:
save_on_errors
,
save_on_errors:
save_on_errors
,
trigger_request:
trigger_request
,
trigger_request:
trigger_request
,
merge_request:
merge_request
,
merge_request:
merge_request
,
external_pull_request:
external_pull_request
)
do
|
pipeline
|
external_pull_request:
external_pull_request
)
yield
(
pipeline
)
if
block_given?
end
end
end
# rubocop:enable Metrics/ParameterLists
# rubocop:enable Metrics/ParameterLists
...
@@ -2276,108 +2274,6 @@ RSpec.describe Ci::CreatePipelineService do
...
@@ -2276,108 +2274,6 @@ RSpec.describe Ci::CreatePipelineService do
end
end
end
end
end
end
context
'with workflow rules with persisted variables'
do
let
(
:config
)
do
<<-
EOY
workflow:
rules:
- if: $CI_COMMIT_REF_NAME == "master"
regular-job:
script: 'echo Hello, World!'
EOY
end
context
'with matches'
do
it
'creates a pipeline'
do
expect
(
pipeline
).
to
be_persisted
expect
(
build_names
).
to
contain_exactly
(
'regular-job'
)
end
end
context
'with no matches'
do
let
(
:ref_name
)
{
'refs/heads/feature'
}
it
'does not create a pipeline'
do
expect
(
pipeline
).
not_to
be_persisted
end
end
end
context
'with workflow rules with pipeline variables'
do
let
(
:pipeline
)
do
execute_service
(
variables_attributes:
variables_attributes
)
end
let
(
:config
)
do
<<-
EOY
workflow:
rules:
- if: $SOME_VARIABLE
regular-job:
script: 'echo Hello, World!'
EOY
end
context
'with matches'
do
let
(
:variables_attributes
)
do
[{
key:
'SOME_VARIABLE'
,
secret_value:
'SOME_VAR'
}]
end
it
'creates a pipeline'
do
expect
(
pipeline
).
to
be_persisted
expect
(
build_names
).
to
contain_exactly
(
'regular-job'
)
end
end
context
'with no matches'
do
let
(
:variables_attributes
)
{
{}
}
it
'does not create a pipeline'
do
expect
(
pipeline
).
not_to
be_persisted
end
end
end
context
'with workflow rules with trigger variables'
do
let
(
:pipeline
)
do
execute_service
do
|
pipeline
|
pipeline
.
variables
.
build
(
variables
)
end
end
let
(
:config
)
do
<<-
EOY
workflow:
rules:
- if: $SOME_VARIABLE
regular-job:
script: 'echo Hello, World!'
EOY
end
context
'with matches'
do
let
(
:variables
)
do
[{
key:
'SOME_VARIABLE'
,
secret_value:
'SOME_VAR'
}]
end
it
'creates a pipeline'
do
expect
(
pipeline
).
to
be_persisted
expect
(
build_names
).
to
contain_exactly
(
'regular-job'
)
end
end
context
'with no matches'
do
let
(
:variables
)
{
{}
}
it
'does not create a pipeline'
do
expect
(
pipeline
).
not_to
be_persisted
end
end
end
end
end
end
end
...
...
spec/services/ci/pipeline_trigger_service_spec.rb
View file @
005a00d3
...
@@ -161,29 +161,6 @@ RSpec.describe Ci::PipelineTriggerService do
...
@@ -161,29 +161,6 @@ RSpec.describe Ci::PipelineTriggerService do
expect
(
result
[
:pipeline
].
variables
.
map
{
|
v
|
{
v
.
key
=>
v
.
value
}
}.
first
).
to
eq
(
variables
)
expect
(
result
[
:pipeline
].
variables
.
map
{
|
v
|
{
v
.
key
=>
v
.
value
}
}.
first
).
to
eq
(
variables
)
expect
(
job
.
sourced_pipelines
.
last
.
pipeline_id
).
to
eq
(
result
[
:pipeline
].
id
)
expect
(
job
.
sourced_pipelines
.
last
.
pipeline_id
).
to
eq
(
result
[
:pipeline
].
id
)
end
end
context
'when the config has workflow rule with the variable'
do
let
(
:config
)
do
<<-
EOY
workflow:
rules:
- if: $AAA
regular-job:
script: 'echo Hello, World!'
EOY
end
before
do
stub_ci_pipeline_yaml_file
(
config
)
end
it
'runs the pipeline'
do
expect
{
result
}.
to
change
{
Ci
::
Pipeline
.
count
}.
by
(
1
)
expect
(
result
[
:status
]).
to
eq
(
:success
)
end
end
end
end
end
end
...
...
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