File tree Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ def api_v4_url
34
34
Gitlab ::Util . get_env ( 'CI_API_V4_URL' )
35
35
end
36
36
37
+ def commit_ref_slug
38
+ Gitlab ::Util . get_env ( 'CI_COMMIT_REF_SLUG' )
39
+ end
40
+
37
41
def artifact_url ( job_name , file_path )
38
42
client = Gitlab ::APIClient . new
39
43
target_job_id = client . get_job_id ( job_name )
Original file line number Diff line number Diff line change 1
1
require 'docker'
2
2
require_relative '../docker_operations'
3
3
require_relative '../build/info'
4
+ require_relative '../build/info/ci'
4
5
require_relative '../build/check'
5
6
require_relative '../build/gitlab_image'
6
7
require_relative "../util.rb"
@@ -61,6 +62,10 @@ namespace :docker do
61
62
task :triggered do
62
63
Gitlab ::Util . section ( 'docker:push:triggered' ) do
63
64
Build ::GitlabImage . tag_and_push_to_gitlab_registry ( Build ::Info ::Docker . tag )
65
+
66
+ # Also tag with CI_COMMIT_REF_SLUG so that manual testing using Docker
67
+ # can use the same image name/tag.
68
+ Build ::GitlabImage . tag_and_push_to_gitlab_registry ( Build ::Info ::CI . commit_ref_slug )
64
69
end
65
70
end
66
71
end
Original file line number Diff line number Diff line change 90
90
end
91
91
92
92
it 'pushes triggered images correctly' do
93
+ allow ( ENV ) . to receive ( :[] ) . with ( 'CI_COMMIT_REF_SLUG' ) . and_return ( 'foo-bar' )
93
94
allow ( ENV ) . to receive ( :[] ) . with ( 'CI_REGISTRY_IMAGE' ) . and_return ( 'registry.gitlab.com/gitlab-org/omnibus-gitlab' )
94
95
allow ( ENV ) . to receive ( :[] ) . with ( "IMAGE_TAG" ) . and_return ( "omnibus-12345" )
95
96
allow ( Build ::Info ::Docker ) . to receive ( :tag ) . and_call_original
96
97
97
98
expect ( dummy_image ) . to receive ( :push ) . with ( dummy_creds , repo_tag : 'registry.gitlab.com/gitlab-org/omnibus-gitlab/gitlab-ce:omnibus-12345' )
99
+ expect ( dummy_image ) . to receive ( :push ) . with ( dummy_creds , repo_tag : 'registry.gitlab.com/gitlab-org/omnibus-gitlab/gitlab-ce:foo-bar' )
98
100
Rake ::Task [ 'docker:push:triggered' ] . invoke
99
101
end
100
102
end
You can’t perform that action at this time.
0 commit comments