summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/4_verify/ci_variable/ui_variable_inheritable_when_forward_pipeline_variables_true_spec.rb
blob: 496cc5f8a606ef9e2b8b321a943c0d7b8acab9c6 (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
# 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(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,
        testcase: '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