From 74c482d90d41ca063bc9e87baff5fcd4e3a7ef2f Mon Sep 17 00:00:00 2001 From: Bhavin Patel Date: Thu, 27 Mar 2025 16:39:14 -0700 Subject: [PATCH] intentional fail and catch --- .github/workflows/unit-testing.yml | 11 +++++++++-- contentctl.yml | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 3c510f1da0..b3d32c60d2 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -14,7 +14,6 @@ jobs: repository: 'splunk/security_content' #this should be the TARGET repo of the PR. we hardcode it for now ref: ${{ github.base_ref }} - - uses: actions/setup-python@v5 with: python-version: '3.11' #Available versions here - https://github.com/actions/python-versions/releases easy to change/make a matrix/use pypy @@ -36,8 +35,8 @@ jobs: # Instructions for pulling a PR were taken from: # https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally - name: Run ContentCTL test for changes against target branch + id: contentctl_test run: | - echo "Current Branch (Head Ref): ${{ github.head_ref }}" echo "Target Branch (Base Ref): ${{ github.base_ref }}" git pull > /dev/null 2>&1 @@ -47,6 +46,7 @@ jobs: git switch new_branch_for_testing contentctl test --verbose --disable-tqdm --no-enable-integration-testing --container-settings.num-containers 2 --post-test-behavior never_pause mode:changes --mode.target-branch ${{ github.base_ref }} echo "contentctl test - COMPLETED" + echo "exit_code=$?" >> $GITHUB_OUTPUT # Store test_results/summary.yml and dist/DA-ESS-ContentUpdate-latest.tar.gz to job artifact-test_summary_results.zip - name: store_artifacts @@ -69,3 +69,10 @@ jobs: echo "This job will fail if there are failures in unit-testing" python .github/workflows/format_test_results.py >> $GITHUB_STEP_SUMMARY echo "The Unit testing is completed. See details in the unit-testing job summary UI " + + # Fail the job if contentctl test failed + - name: Check contentctl test results + if: steps.contentctl_test.outputs.exit_code != '0' + run: | + echo "::error::contentctl test failed with exit code ${{ steps.contentctl_test.outputs.exit_code }}" + exit 1 \ No newline at end of file diff --git a/contentctl.yml b/contentctl.yml index ed79d50b12..7ae22d3000 100644 --- a/contentctl.yml +++ b/contentctl.yml @@ -30,11 +30,11 @@ splunk_api_username: null post_test_behavior: pause_on_failure apps: - uid: 1621 - title: Splunk_SA_CIM + title: Splunk Common Information Model (CIM) appid: Splunk_SA_CIM version: 6.0.3 description: description of app - hardcoded_path: https://attack-range-appbinaries.s3.us-west-2.amazonaws.com/splunk-common-information-model-cim_603.tgz + hardcoded_path: https://attack-range-appbinaries.s3.us-west-2.amazonaws.com/splunk-common-information-model-(cim)_603.tgz - uid: 6553 title: Splunk Add-on for Okta Identity Cloud appid: Splunk_TA_okta_identity_cloud