Skip to content

Commit ef895d0

Browse files
Robert Marshallbalasankarc
andcommitted
Merge branch 'fix-nightly-in-canonical-rat-2' into 'master'
Ensure nightly pipelines are correctly detected in Canonical Closes https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/8451 See merge request https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/7484 Merged-by: Robert Marshall <[email protected]> Approved-by: Robert Marshall <[email protected]> Co-authored-by: Balasankar 'Balu' C <[email protected]>
2 parents 6329fe0 + 4b8ab3c commit ef895d0

File tree

9 files changed

+52
-49
lines changed

9 files changed

+52
-49
lines changed

gitlab-ci-config/dev-gitlab-org.yml

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -433,37 +433,6 @@ Raspberry-Pi-2-Bookworm-branch:
433433
image: "${BUILDER_IMAGE_REGISTRY}/rpi_12:${BUILDER_IMAGE_REVISION}"
434434
extends: .rpi_branch_template
435435

436-
# This job runs only on nightly EE builds
437-
RAT-Nightly:
438-
stage: slow_jobs
439-
image: "${BUILDER_IMAGE_REGISTRY}/ubuntu_22.04:${BUILDER_IMAGE_REVISION}"
440-
script:
441-
- bundle exec rake qa:rat:nightly
442-
cache: !reference [.branch-cache]
443-
needs:
444-
- Ubuntu-22.04-branch
445-
allow_failure: true
446-
rules:
447-
- !reference [.default_rules, rules]
448-
- if: '$PIPELINE_TYPE == "EE_NIGHTLY_BUILD_PIPELINE"'
449-
450-
# This job runs only on nightly EE builds
451-
RAT-Nightly-FIPS:
452-
stage: slow_jobs
453-
image: "${BUILDER_IMAGE_REGISTRY}/almalinux_8_fips:${BUILDER_IMAGE_REVISION}"
454-
variables:
455-
USE_SYSTEM_SSL: "true"
456-
RAT_REFERENCE_ARCHITECTURE: "omnibus-gitlab-mrs-fips"
457-
script:
458-
- bundle exec rake qa:rat:nightly
459-
cache: !reference [.branch-cache]
460-
needs:
461-
- AlmaLinux-8-fips-branch
462-
allow_failure: true
463-
rules:
464-
- !reference [.default_rules, rules]
465-
- if: '$PIPELINE_TYPE == "EE_NIGHTLY_BUILD_PIPELINE"'
466-
467436
############################
468437
# Release pipeline #
469438
############################

gitlab-ci-config/gitlab-com.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,9 +667,15 @@ RAT:
667667
- if: '$PIPELINE_TYPE == "TRIGGERED_EE_PIPELINE"'
668668
when: manual
669669
allow_failure: true
670+
- if: '$PIPELINE_TYPE == "EE_NIGHTLY_BUILD_PIPELINE"'
671+
allow_failure: true
670672
needs:
673+
- job: Ubuntu-22.04-branch
674+
artifacts: false
675+
optional: true
671676
- job: Trigger:package
672677
artifacts: false
678+
optional: true
673679
- job: generate-facts
674680
artifacts: true
675681

@@ -679,8 +685,12 @@ RAT:FIPS:
679685
PACKAGE_URL: ${RAT_FIPS_PACKAGE_URL}
680686
REFERENCE_ARCHITECTURE: ${RAT_FIPS_REFERENCE_ARCHITECTURE}
681687
needs:
688+
- job: Ubuntu-20.04-fips-branch
689+
artifacts: false
690+
optional: true
682691
- job: Trigger:package:fips
683692
artifacts: false
693+
optional: true
684694
- job: generate-facts
685695
artifacts: true
686696

gitlab-ci-config/workflow-rules.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ workflow:
4343
- if: '$PIPELINE_TYPE == null && $CI_PROJECT_PATH == $CANONICAL_PROJECT_PATH && $CI_PIPELINE_SOURCE == "merge_request_event"'
4444
variables:
4545
PIPELINE_TYPE: GITLAB_MR_PIPELINE
46-
- if: '$PIPELINE_TYPE == null && $CI_PROJECT_PATH == $CANONICAL_PROJECT_PATH && $CI_COMMIT_REF_PROTECTED == "true"'
47-
variables:
48-
PIPELINE_TYPE: PROTECTED_TEST_PIPELINE
4946
- if: '$PIPELINE_TYPE == null && $NIGHTLY && $CI_COMMIT_BRANCH && ($ee == "true" || $GITLAB_VERSION =~ /-ee$/)'
5047
variables:
5148
PIPELINE_TYPE: EE_NIGHTLY_BUILD_PIPELINE
@@ -94,6 +91,9 @@ workflow:
9491
PIPELINE_TYPE: EE_TAG_BUILD_PIPELINE
9592
CACHE_EDITION: "EE"
9693
GITLAB_EDITION: "Enterprise Edition"
94+
- if: '$PIPELINE_TYPE == null && $CI_PROJECT_PATH == $CANONICAL_PROJECT_PATH && $CI_COMMIT_REF_PROTECTED == "true"'
95+
variables:
96+
PIPELINE_TYPE: PROTECTED_TEST_PIPELINE
9797
- if: '$PIPELINE_TYPE == null && $CI_PROJECT_PATH == $SECURITY_PROJECT_PATH && $CI_PIPELINE_SOURCE == "merge_request_event"'
9898
variables:
9999
PIPELINE_TYPE: GITLAB_MR_PIPELINE

lib/gitlab/aws_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def create_ami
2929
architecture = 'amd64'
3030
end
3131

32-
@download_url = Build::Info::CI.package_download_url(job_name: "Ubuntu-20.04", arch: architecture)
32+
@download_url = Build::Info::CI.branch_build_package_download_url(job_name: "Ubuntu-20.04", arch: architecture)
3333

3434
system(*%W[support/packer/packer_ami.sh #{@version} #{@type} #{@download_url} #{Build::Info::CI.job_token} #{@license_file}])
3535
end

lib/gitlab/build/facts.rb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,17 @@ def get_component_shas(version_manifest_file = 'version-manifest.json')
3030
softwares = version_manifest['software']
3131
results = {}
3232
Gitlab::Version::COMPONENTS_ENV_VARS.keys.map do |component|
33-
next unless softwares.key?(component)
33+
# For both `gitlab-rails` and `gitlab-rails-ee`, the key in
34+
# version-manifest.json is `gitlab-rails`
35+
version_manifest_key = if component == 'gitlab-rails' || component == 'gitlab-rails-ee'
36+
'gitlab-rails'
37+
else
38+
component
39+
end
3440

35-
results[component] = softwares[component]['locked_version']
41+
next unless softwares.key?(version_manifest_key)
42+
43+
results[component] = softwares[version_manifest_key]['locked_version']
3644
end
3745

3846
results
@@ -83,8 +91,8 @@ def qa_trigger_vars
8391
GITLAB_SEMVER_VERSION=#{Build::Info::Git.latest_stable_tag.tr('+', '-')}
8492
RAT_REFERENCE_ARCHITECTURE=#{Gitlab::Util.get_env('RAT_REFERENCE_ARCHITECTURE') || 'omnibus-gitlab-mrs'}
8593
RAT_FIPS_REFERENCE_ARCHITECTURE=#{Gitlab::Util.get_env('RAT_FIPS_REFERENCE_ARCHITECTURE') || 'omnibus-gitlab-mrs-fips-ubuntu'}
86-
RAT_PACKAGE_URL=#{Gitlab::Util.get_env('PACKAGE_URL') || Build::Info::CI.triggered_package_download_url(fips: false)}
87-
RAT_FIPS_PACKAGE_URL=#{Gitlab::Util.get_env('FIPS_PACKAGE_URL') || Build::Info::CI.triggered_package_download_url(fips: true)}
94+
RAT_PACKAGE_URL=#{Build::Info::CI.package_download_url}
95+
RAT_FIPS_PACKAGE_URL=#{Build::Info::CI.fips_package_download_url}
8896
]
8997
end
9098

lib/gitlab/build/info/ci.rb

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,26 @@ def commit_ref_slug
3838
Gitlab::Util.get_env('CI_COMMIT_REF_SLUG')
3939
end
4040

41+
def package_download_url
42+
return Gitlab::Util.get_env('PACKAGE_URL') if Gitlab::Util.get_env('PACKAGE_URL')
43+
44+
# For builds running in dev.gitlab.org, or nightly pipelines in .com,
45+
# use the artifact from `Ubuntu-22.04-branch` job. For the other build,
46+
# which is essentially in triggered pipeline, use artifact from
47+
# `Trigger:package` job.
48+
if /dev.gitlab.org/.match?(Build::Info::CI.api_v4_url) || Build::Check.is_nightly?
49+
Build::Info::CI.branch_build_package_download_url
50+
else
51+
Build::Info::CI.triggered_package_download_url(fips: false)
52+
end
53+
end
54+
55+
def fips_package_download_url
56+
return Gitlab::Util.get_env('FIPS_PACKAGE_URL') if Gitlab::Util.get_env('FIPS_PACKAGE_URL')
57+
58+
Build::Info::CI.triggered_package_download_url(fips: false)
59+
end
60+
4161
def artifact_url(job_name, file_path)
4262
client = Gitlab::APIClient.new
4363
target_job_id = client.get_job_id(job_name)
@@ -55,7 +75,7 @@ def triggered_package_download_url(fips: Build::Check.use_system_ssl?)
5575
artifact_url(job_name, package_path)
5676
end
5777

58-
def package_download_url(job_name: "Ubuntu-22.04", arch: 'amd64')
78+
def branch_build_package_download_url(job_name: "Ubuntu-22.04", arch: 'amd64')
5979
case job_name
6080
when /AlmaLinux-8/
6181
# In EL world, amd64 is called x86_64

lib/gitlab/build/info/docker.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@ def tag
1414
def release_file_contents
1515
repo = Gitlab::Util.get_env('PACKAGECLOUD_REPO') # Target repository
1616

17-
download_url = if /dev.gitlab.org/.match?(Build::Info::CI.api_v4_url) || Build::Check.is_nightly?
18-
Build::Info::CI.package_download_url
19-
else
20-
Build::Info::CI.triggered_package_download_url
21-
end
22-
17+
download_url = Build::Info::CI.package_download_url
2318
raise "Unable to identify package download URL." unless download_url
2419

2520
contents = []

spec/lib/gitlab/build/facts_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
let(:component_shas) do
7070
{
7171
'gitlab-rails' => '6f286d7717f419489a08a9918621f438256e397b',
72+
'gitlab-rails-ee' => '6f286d7717f419489a08a9918621f438256e397b',
7273
'gitaly' => 'b55578ec476e8bc8ecd9775ee7e9960b52e0f6e0',
7374
'gitlab-shell' => '264d63e81cbf08e3ae75e84433b8d09af15f351f',
7475
'gitlab-pages' => 'b0cb1f0c0783db2f5176301e6528fe41e1b42abf',

spec/lib/gitlab/tasks/aws_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def deregister_image(parameters)
4949
allow(Build::Check).to receive(:on_tag?).and_return(true)
5050
allow(Build::Check).to receive(:is_auto_deploy?).and_return(false)
5151
allow(Build::Check).to receive(:is_rc_tag?).and_return(false)
52-
allow(Build::Info::CI).to receive(:package_download_url).and_return('http://example.com')
52+
allow(Build::Info::CI).to receive(:branch_build_package_download_url).and_return('http://example.com')
5353
end
5454

5555
it 'should identify ce category correctly, if specified' do
@@ -129,7 +129,7 @@ def deregister_image(parameters)
129129
allow(Build::Check).to receive(:on_tag?).and_return(true)
130130
allow(Build::Check).to receive(:is_auto_deploy?).and_return(false)
131131
allow(Build::Check).to receive(:is_rc_tag?).and_return(true)
132-
allow(Build::Info::CI).to receive(:package_download_url).and_return('http://example.com')
132+
allow(Build::Info::CI).to receive(:branch_build_package_download_url).and_return('http://example.com')
133133
end
134134

135135
it 'does not do anything' do
@@ -144,7 +144,7 @@ def deregister_image(parameters)
144144
allow(Build::Check).to receive(:on_tag?).and_return(true)
145145
allow(Build::Check).to receive(:is_auto_deploy?).and_return(true)
146146
allow(Build::Check).to receive(:is_rc_tag?).and_return(false)
147-
allow(Build::Info::CI).to receive(:package_download_url).and_return('http://example.com')
147+
allow(Build::Info::CI).to receive(:branch_build_package_download_url).and_return('http://example.com')
148148
end
149149

150150
it 'does not do anything' do

0 commit comments

Comments
 (0)