summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_non_inheritable_when_forward_pipeline_variables_false_spec.rb
blob: 2a0aaf6d7a30b59c9fd4488aae1f5e7d1fdd989d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# 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.describe 'Verify', :runner, feature_flag: {
    name: 'ci_trigger_forward_variables',
    scope: :global
  } 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,
        testcase: '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,
        testcase: '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