Skip to content
Snippets Groups Projects
Commit f7190f68 authored by Stan Hu's avatar Stan Hu
Browse files

Disable version files for merge requests targeting stable branches

Merge requests targeting stable branches should use the VERSION files
in the Omnibus repo because the `gitlab-qa-ee` and other images with
the SHA value may no longer exist due to container registry cleanup
policies.

Relates to a discussion in
https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/7679.
parent 2f28d8ff
No related branches found
No related tags found
1 merge request!139Merge upstream Omnibus GitLab into Omnibus Heptapod
......@@ -49,7 +49,7 @@
def generate_version_files
# Do not build version facts for tags and stable branches because
# those jobs MUST use the VERSION files
return if Build::Check.on_tag? || Build::Check.on_stable_branch?
return if Build::Check.on_tag? || Build::Check.on_stable_branch? || Build::Check.mr_targetting_stable_branch?
get_component_shas('build_facts/version-manifest.json').each do |component, sha|
File.write("build_facts/#{component}_version", sha) unless sha.nil?
......
......@@ -145,6 +145,21 @@
before do
allow(Build::Check).to receive(:on_tag?).and_return(false)
allow(Build::Check).to receive(:on_stable_branch?).and_return(true)
allow(Build::Check).to receive(:mr_targetting_stable_branch?).and_return(false)
end
it 'does not generate version files as build facts' do
expect(described_class).not_to receive(:get_component_shas)
described_class.generate_version_files
end
end
context 'on branches targetting a stable branch' do
before do
allow(Build::Check).to receive(:on_tag?).and_return(false)
allow(Build::Check).to receive(:on_stable_branch?).and_return(false)
allow(Build::Check).to receive(:mr_targetting_stable_branch?).and_return(true)
end
it 'does not generate version files as build facts' do
......@@ -158,6 +173,7 @@
before do
allow(Build::Check).to receive(:on_tag?).and_return(false)
allow(Build::Check).to receive(:on_stable_branch?).and_return(false)
allow(Build::Check).to receive(:mr_targetting_stable_branch?).and_return(false)
allow(described_class).to receive(:get_component_shas).and_return(component_shas)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment