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
3737 # other than `master` in the deployer project
3838 trigger_ref = Gitlab ::Util . get_env ( 'DEPLOYER_TRIGGER_REF' ) || :master
3939
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+
4145 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 } )."
4448 next
4549 end
4650
Original file line number Diff line number Diff line change 4747
4848 context 'with the auto-deploy tag' do
4949 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 ] )
5151 allow ( Build ::Check ) . to receive ( :is_auto_deploy? ) . and_return ( true )
5252 end
5353
5858
5959 context 'when running on Ubuntu 18.04' do
6060 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 ] )
6262 end
6363
6464 context 'with a release candidate (RC) tag' do
8989
9090 context 'when running on Ubuntu 20.04' do
9191 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 ] )
9393 end
9494
9595 context 'with a release candidate (RC) tag' do
You can’t perform that action at this time.
0 commit comments