File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,14 @@ namespace :gitlab_com do
37
37
# other than `master` in the deployer project
38
38
trigger_ref = Gitlab ::Util . get_env ( 'DEPLOYER_TRIGGER_REF' ) || :master
39
39
40
- current_os = OhaiHelper . fetch_os_with_codename [ 0 ..1 ] . join ( "-" )
40
+ # Find out the OS for which packages are built for. We can not use Ohai for
41
+ # this, as that will return the builder image being used to run this rake
42
+ # task. So, we detect the OS from the path of the packages.
43
+ package_os = Build ::Info ::Package . file_list . map { |path | path . split ( "/" ) [ 1 ] } . uniq . first
44
+
41
45
os_for_deployment = Build ::Info ::Deploy ::OS_MAPPING [ Build ::Info ::Deploy . environment_key ]
42
- if current_os != os_for_deployment
43
- puts "Deployment to #{ deploy_env } not to be triggered from this build (#{ current_os } )."
46
+ if package_os != os_for_deployment
47
+ puts "Deployment to #{ deploy_env } not to be triggered from this build (#{ package_os } )."
44
48
next
45
49
end
46
50
Original file line number Diff line number Diff line change 47
47
48
48
context 'with the auto-deploy tag' do
49
49
before do
50
- allow ( OhaiHelper ) . to receive ( :fetch_os_with_codename ) . and_return ( %w[ ubuntu bionic ] )
50
+ allow ( Dir ) . to receive ( :glob ) . with ( "pkg/**/*.{deb,rpm}" ) . and_return ( %w[ pkg/ ubuntu- bionic/gitlab-ee_16.7.0-ee.0_amd64.deb ] )
51
51
allow ( Build ::Check ) . to receive ( :is_auto_deploy? ) . and_return ( true )
52
52
end
53
53
58
58
59
59
context 'when running on Ubuntu 18.04' do
60
60
before do
61
- allow ( OhaiHelper ) . to receive ( :fetch_os_with_codename ) . and_return ( %w[ ubuntu bionic ] )
61
+ allow ( Dir ) . to receive ( :glob ) . with ( "pkg/**/*.{deb,rpm}" ) . and_return ( %w[ pkg/ ubuntu- bionic/gitlab-ee_16.7.0-ee.0_amd64.deb ] )
62
62
end
63
63
64
64
context 'with a release candidate (RC) tag' do
89
89
90
90
context 'when running on Ubuntu 20.04' do
91
91
before do
92
- allow ( OhaiHelper ) . to receive ( :fetch_os_with_codename ) . and_return ( %w[ ubuntu focal ] )
92
+ allow ( Dir ) . to receive ( :glob ) . with ( "pkg/**/*.{deb,rpm}" ) . and_return ( %w[ pkg/ ubuntu- focal/gitlab-ee_16.7.0-ee.0_amd64.deb ] )
93
93
end
94
94
95
95
context 'with a release candidate (RC) tag' do
You can’t perform that action at this time.
0 commit comments