Skip to content

Commit c2a94ae

Browse files
Merge branch 'tag-stable-staging-docker-images' into 'master'
Tag docker images from staging builds with CI_COMMIT_REF_SLUG also See merge request https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/7380 Merged-by: Balasankar 'Balu' C <[email protected]> Approved-by: Balasankar 'Balu' C <[email protected]> Co-authored-by: Nailia Iskhakova <[email protected]>
2 parents bd9c95f + 838c542 commit c2a94ae

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/gitlab/tasks/docker_tasks.rake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ namespace :docker do
2828
task :staging do
2929
Gitlab::Util.section('docker:push:staging') do
3030
Build::GitlabImage.tag_and_push_to_gitlab_registry(Build::Info::Docker.tag)
31+
32+
# Also tag with CI_COMMIT_REF_SLUG so that manual testing using Docker
33+
# can use the same image name/tag.
34+
Build::GitlabImage.tag_and_push_to_gitlab_registry(Build::Info::CI.commit_ref_slug)
3135
end
3236
end
3337

spec/lib/gitlab/tasks/docker_tasks_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555

5656
allow(ENV).to receive(:[]).and_call_original
5757
allow(ENV).to receive(:[]).with('CI_REGISTRY_IMAGE').and_return('dev.gitlab.org:5005/gitlab/omnibus-gitlab')
58+
allow(ENV).to receive(:[]).with('CI_COMMIT_REF_SLUG').and_return('foo-bar')
5859
allow(Build::Info::Package).to receive(:name).and_return('gitlab-ce')
5960
allow(Build::Info::Docker).to receive(:tag).and_return('9.0.0')
6061
allow(DockerOperations).to receive(:authenticate).and_return(true)
@@ -65,6 +66,7 @@
6566

6667
it 'pushes to staging correctly' do
6768
expect(dummy_image).to receive(:push).with(dummy_creds, repo_tag: 'dev.gitlab.org:5005/gitlab/omnibus-gitlab/gitlab-ce:9.0.0')
69+
expect(dummy_image).to receive(:push).with(dummy_creds, repo_tag: 'dev.gitlab.org:5005/gitlab/omnibus-gitlab/gitlab-ce:foo-bar')
6870
Rake::Task['docker:push:staging'].invoke
6971
end
7072

0 commit comments

Comments
 (0)