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
93e481a9
Commit
93e481a9
authored
Apr 14, 2022
by
Tiffany Rea
Committed by
Sanad Liaquat
Apr 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E tests for UI defined pipeline variable inheritance
parent
2fb01fd5
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
320 additions
and
5 deletions
+320
-5
app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue
...javascripts/pipeline_new/components/pipeline_new_form.vue
+3
-0
app/assets/javascripts/pipelines/components/graph/job_item.vue
...ssets/javascripts/pipelines/components/graph/job_item.vue
+2
-1
qa/qa/page/project/pipeline/new.rb
qa/qa/page/project/pipeline/new.rb
+11
-1
qa/qa/page/project/pipeline/show.rb
qa/qa/page/project/pipeline/show.rb
+3
-3
qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_inheritable_when_forward_pipeline_variables_true_spec.rb
..._inheritable_when_forward_pipeline_variables_true_spec.rb
+59
-0
qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_non_inheritable_when_forward_pipeline_variables_false_spec.rb
...inheritable_when_forward_pipeline_variables_false_spec.rb
+86
-0
qa/spec/support/shared_contexts/variable_inheritance_shared_context.rb
...rt/shared_contexts/variable_inheritance_shared_context.rb
+156
-0
No files found.
app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue
View file @
93e481a9
...
...
@@ -396,6 +396,7 @@ export default {
:key=
"variable.uniqueId"
class=
"gl-mb-3 gl-ml-n3 gl-pb-2"
data-testid=
"ci-variable-row"
data-qa-selector=
"ci_variable_row_container"
>
<div
class=
"gl-display-flex gl-align-items-stretch gl-flex-direction-column gl-md-flex-direction-row"
...
...
@@ -411,6 +412,7 @@ export default {
:placeholder=
"s__('CiVariables|Input variable key')"
:class=
"$options.formElementClasses"
data-testid=
"pipeline-form-ci-variable-key"
data-qa-selector=
"ci_variable_key_field"
@
change=
"addEmptyVariable(refFullName)"
/>
<gl-form-textarea
...
...
@@ -420,6 +422,7 @@ export default {
:style=
"$options.textAreaStyle"
:no-resize=
"false"
data-testid=
"pipeline-form-ci-variable-value"
data-qa-selector=
"ci_variable_value_field"
/>
<
template
v-if=
"variables.length > 1"
>
...
...
app/assets/javascripts/pipelines/components/graph/job_item.vue
View file @
93e481a9
...
...
@@ -234,8 +234,9 @@ export default {
:title="tooltipText"
:class="jobClasses"
:href="detailsPath"
class="js-pipeline-graph-job-link
qa-job-link
menu-item gl-text-gray-900 gl-active-text-decoration-none gl-focus-text-decoration-none gl-hover-text-decoration-none gl-w-full"
class="js-pipeline-graph-job-link menu-item gl-text-gray-900 gl-active-text-decoration-none gl-focus-text-decoration-none gl-hover-text-decoration-none gl-w-full"
:data-testid="testId"
data-qa-selector="job_link"
@click="jobItemClick"
@mouseout="hideTooltips"
>
...
...
qa/qa/page/project/pipeline/new.rb
View file @
93e481a9
...
...
@@ -7,10 +7,20 @@ module QA
class
New
<
QA
::
Page
::
Base
view
'app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue'
do
element
:run_pipeline_button
,
required:
true
element
:ci_variable_row_container
element
:ci_variable_key_field
element
:ci_variable_value_field
end
def
click_run_pipeline_button
click_element
:run_pipeline_button
click_element
(
:run_pipeline_button
,
Page
::
Project
::
Pipeline
::
Show
)
end
def
add_variable
(
key
,
value
,
row_index:
0
)
within_element_by_index
(
:ci_variable_row_container
,
row_index
)
do
fill_element
(
:ci_variable_key_field
,
key
)
fill_element
(
:ci_variable_value_field
,
value
)
end
end
end
end
...
...
qa/qa/page/project/pipeline/show.rb
View file @
93e481a9
...
...
@@ -8,7 +8,7 @@ module QA
include
Component
::
CiBadgeLink
view
'app/assets/javascripts/vue_shared/components/header_ci_component.vue'
do
element
:pipeline_header
element
:pipeline_header
,
required:
true
end
view
'app/assets/javascripts/pipelines/components/graph/graph_component.vue'
do
...
...
@@ -16,8 +16,8 @@ module QA
end
view
'app/assets/javascripts/pipelines/components/graph/job_item.vue'
do
element
:job_item_container
element
:job_link
element
:job_item_container
,
required:
true
element
:job_link
,
required:
true
element
:job_action_button
end
...
...
qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_inheritable_when_forward_pipeline_variables_true_spec.rb
0 → 100644
View file @
93e481a9
# frozen_string_literal: true
module
QA
# Running with FF :ci_trigger_forward_variables
RSpec
.
describe
'Verify'
,
:runner
do
describe
'UI defined variable'
do
include_context
'variable inheritance test prep'
before
do
add_ci_file
(
downstream1_project
,
[
downstream1_ci_file
])
add_ci_file
(
upstream_project
,
[
upstream_ci_file
,
upstream_child1_ci_file
])
start_pipeline_with_variable
Page
::
Project
::
Pipeline
::
Show
.
perform
do
|
show
|
Support
::
Waiter
.
wait_until
{
show
.
passed?
}
end
end
it
(
'is inheritable when forward:pipeline_variables is true'
,
:aggregate_failures
,
test_case:
'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/358197'
)
do
visit_job_page
(
'child1'
,
'child1_job'
)
verify_job_log_shows_variable_value
page
.
go_back
visit_job_page
(
'downstream1'
,
'downstream1_job'
)
verify_job_log_shows_variable_value
end
def
upstream_ci_file
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
stages:
- test
- deploy
child1_trigger:
stage: test
trigger:
include: .child1-ci.yml
forward:
pipeline_variables: true
downstream1_trigger:
stage: deploy
trigger:
project:
#{
downstream1_project
.
full_path
}
forward:
pipeline_variables: true
YAML
}
end
end
end
end
qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_non_inheritable_when_forward_pipeline_variables_false_spec.rb
0 → 100644
View file @
93e481a9
# frozen_string_literal: true
module
QA
# Running with FF :ci_trigger_forward_variables
RSpec
.
describe
'Verify'
,
:runner
do
describe
'UI defined variable'
do
include_context
'variable inheritance test prep'
before
do
add_ci_file
(
downstream1_project
,
[
downstream1_ci_file
])
add_ci_file
(
downstream2_project
,
[
downstream2_ci_file
])
add_ci_file
(
upstream_project
,
[
upstream_ci_file
,
upstream_child1_ci_file
,
upstream_child2_ci_file
])
start_pipeline_with_variable
Page
::
Project
::
Pipeline
::
Show
.
perform
do
|
show
|
Support
::
Waiter
.
wait_until
{
show
.
passed?
}
end
end
it
(
'is not inheritable when forward:pipeline_variables is false'
,
:aggregate_failures
,
test_case:
'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/358199'
)
do
visit_job_page
(
'child1'
,
'child1_job'
)
verify_job_log_does_not_show_variable_value
page
.
go_back
visit_job_page
(
'downstream1'
,
'downstream1_job'
)
verify_job_log_does_not_show_variable_value
end
it
(
'is not inheritable by default'
,
:aggregate_failures
,
test_case:
'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/358200'
)
do
visit_job_page
(
'child2'
,
'child2_job'
)
verify_job_log_does_not_show_variable_value
page
.
go_back
visit_job_page
(
'downstream2'
,
'downstream2_job'
)
verify_job_log_does_not_show_variable_value
end
def
upstream_ci_file
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
stages:
- test
- deploy
child1_trigger:
stage: test
trigger:
include: .child1-ci.yml
forward:
pipeline_variables: false
# default behavior
child2_trigger:
stage: test
trigger:
include: .child2-ci.yml
downstream1_trigger:
stage: deploy
trigger:
project:
#{
downstream1_project
.
full_path
}
forward:
pipeline_variables: false
# default behavior
downstream2_trigger:
stage: deploy
trigger:
project:
#{
downstream2_project
.
full_path
}
YAML
}
end
end
end
end
qa/spec/support/shared_contexts/variable_inheritance_shared_context.rb
0 → 100644
View file @
93e481a9
# frozen_string_literal: true
module
QA
# TODO:
# Remove FF :ci_trigger_forward_variables
# when https://gitlab.com/gitlab-org/gitlab/-/issues/355572 is closed
RSpec
.
shared_context
'variable inheritance test prep'
,
feature_flag:
{
name:
'ci_trigger_forward_variables'
,
scope: :global
}
do
let
(
:random_string
)
{
Faker
::
Alphanumeric
.
alphanumeric
(
number:
8
)
}
let
(
:group
)
do
Resource
::
Group
.
fabricate_via_api!
do
|
group
|
group
.
path
=
"group-for-variable-inheritance-
#{
random_string
}
"
end
end
let
(
:upstream_project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
group
=
group
project
.
name
=
'upstream-variable-inheritance'
project
.
description
=
'Project for pipeline with variable defined via UI - Upstream'
end
end
let
(
:downstream1_project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
group
=
group
project
.
name
=
'downstream1-variable-inheritance'
project
.
description
=
'Project for pipeline with variable defined via UI - Downstream'
end
end
let
(
:downstream2_project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
group
=
group
project
.
name
=
'downstream2-variable-inheritance'
project
.
description
=
'Project for pipeline with variable defined via UI - Downstream'
end
end
let!
(
:runner
)
do
Resource
::
Runner
.
fabricate!
do
|
runner
|
runner
.
token
=
group
.
reload!
.
runners_token
runner
.
name
=
random_string
runner
.
tags
=
[
random_string
]
end
end
before
do
Runtime
::
Feature
.
enable
(
:ci_trigger_forward_variables
)
Flow
::
Login
.
sign_in
end
after
do
runner
.
remove_via_api!
Runtime
::
Feature
.
disable
(
:ci_trigger_forward_variables
)
end
def
start_pipeline_with_variable
upstream_project
.
visit!
Flow
::
Pipeline
.
wait_for_latest_pipeline
Page
::
Project
::
Pipeline
::
Index
.
perform
(
&
:click_run_pipeline_button
)
Page
::
Project
::
Pipeline
::
New
.
perform
do
|
new
|
new
.
add_variable
(
'TEST_VAR'
,
'This is great!'
)
new
.
click_run_pipeline_button
end
end
def
add_ci_file
(
project
,
files
)
Resource
::
Repository
::
Commit
.
fabricate_via_api!
do
|
commit
|
commit
.
project
=
project
commit
.
commit_message
=
'Add CI config file'
commit
.
add_files
(
files
)
end
end
def
visit_job_page
(
pipeline_title
,
job_name
)
Page
::
Project
::
Pipeline
::
Show
.
perform
do
|
show
|
show
.
expand_child_pipeline
(
title:
pipeline_title
)
show
.
click_job
(
job_name
)
end
end
def
verify_job_log_shows_variable_value
Page
::
Project
::
Job
::
Show
.
perform
do
|
show
|
show
.
wait_until
{
show
.
successful?
}
expect
(
show
.
output
).
to
have_content
(
'This is great!'
)
end
end
def
verify_job_log_does_not_show_variable_value
Page
::
Project
::
Job
::
Show
.
perform
do
|
show
|
show
.
wait_until
{
show
.
successful?
}
expect
(
show
.
output
).
to
have_no_content
(
'This is great!'
)
end
end
def
upstream_child1_ci_file
{
file_path:
'.child1-ci.yml'
,
content:
<<~
YAML
child1_job:
stage: test
tags: ["
#{
random_string
}
"]
script:
- echo $TEST_VAR
- echo Done!
YAML
}
end
def
upstream_child2_ci_file
{
file_path:
'.child2-ci.yml'
,
content:
<<~
YAML
child2_job:
stage: test
tags: ["
#{
random_string
}
"]
script:
- echo $TEST_VAR
- echo Done!
YAML
}
end
def
downstream1_ci_file
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
downstream1_job:
stage: deploy
tags: ["
#{
random_string
}
"]
script:
- echo $TEST_VAR
- echo Done!
YAML
}
end
def
downstream2_ci_file
{
file_path:
'.gitlab-ci.yml'
,
content:
<<~
YAML
downstream2_job:
stage: deploy
tags: ["
#{
random_string
}
"]
script:
- echo $TEST_VAR
- echo Done!
YAML
}
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