diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 84145f1..3d1b211 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -6,6 +6,11 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 + - name: install libcurl & libcurl4-openssl-dev + # these packages are required to build native extensions for the 'patron' gem + run: | + sudo apt-get update + sudo apt-get install -y libcurl4 libcurl4-openssl-dev - uses: ruby/setup-ruby@v1 with: ruby-version: 2.6 @@ -23,6 +28,11 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 + - name: install libcurl & libcurl4-openssl-dev + # these packages are required to build native extensions for the 'patron' gem + run: | + sudo apt-get update + sudo apt-get install -y libcurl4 libcurl4-openssl-dev - uses: ruby/setup-ruby@v1 with: ruby-version: 2.6 diff --git a/spec/run_cd4pe_job_spec.rb b/spec/run_cd4pe_job_spec.rb index 0963629..c919404 100644 --- a/spec/run_cd4pe_job_spec.rb +++ b/spec/run_cd4pe_job_spec.rb @@ -246,6 +246,15 @@ end + + it 'Fails the job if the job script fails' do + File.write(@job_script, "exit 1;") + + job_helper = CD4PEJobRunner.new(windows_job: @windows_job, working_dir: @working_dir, job_token: @job_token, web_ui_endpoint: @web_ui_endpoint, job_owner: @job_owner, job_instance_id: @job_instance_id, logger: @logger, secrets: @secrets) + output = job_helper.run_job + + expect(output[:job][:exit_code]).to eq(1) + end end diff --git a/tasks/run_cd4pe_job.rb b/tasks/run_cd4pe_job.rb index 696d067..82f6301 100644 --- a/tasks/run_cd4pe_job.rb +++ b/tasks/run_cd4pe_job.rb @@ -409,7 +409,7 @@ def run_with_system(manifest_type) cmd_to_execute = local_job_script if (@windows_job) - cmd_to_execute = "powershell \"& {&'#{local_job_script}'}\"" + cmd_to_execute = "powershell \"& {&'#{local_job_script}';exit $LASTEXITCODE}\"" end run_system_cmd(cmd_to_execute)