Skip to content

Commit

Permalink
feat: sample unification (#96)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: removing jobs not needed after sample unification
  • Loading branch information
uoboda-splunk authored Sep 8, 2022
1 parent 97175ef commit 2c77946
Showing 1 changed file with 0 additions and 194 deletions.
194 changes: 0 additions & 194 deletions .github/workflows/reusable-build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,6 @@ jobs:
id: matrix
uses: splunk/[email protected]

compliance-sample-scanner:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: sample-scanner
uses: splunk/addonfactory-sample-scanner@v1
id: sample-scanner
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GH_TOKEN }}

fossa-scan:
continue-on-error: true
runs-on: ubuntu-latest
Expand Down Expand Up @@ -410,30 +399,6 @@ jobs:
name: test-results-unit-python_${{ matrix.python-version }}
path: test-results/*

run-requirements-unit-tests:
if: ${{ needs.test-inventory.outputs.requirement_test == 'true' }}
runs-on: ubuntu-latest
needs:
- build
- test-inventory
steps:
- uses: actions/checkout@v3
- name: Install Python 3
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: run-tests
uses: splunk/[email protected]
with:
input-files: tests/requirement_test/logs
- name: Archive production artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: |
test_*.txt
appinspect:
name: quality-appinspect-${{ matrix.tags }}
needs: build
Expand Down Expand Up @@ -777,162 +742,6 @@ jobs:
path: "${{ needs.setup.outputs.directory-path }}/test-results/*.xml"
reporter: java-junit

run-requirement-tests:
if: ${{ needs.test-inventory.outputs.requirement_test == 'true' }}
needs:
- build
- test-inventory
- setup
- meta
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
splunk: ${{ fromJson(needs.meta.outputs.matrix_latestSplunk) }}
sc4s: ${{ fromJson(needs.meta.outputs.matrix_supportedSC4S) }}
container:
image: ghcr.io/splunk/workflow-engine-base:2.0.3
env:
ARGO_SERVER: ${{ needs.setup.outputs.argo-server }}
ARGO_HTTP1: ${{ needs.setup.outputs.argo-http1 }}
ARGO_SECURE: ${{ needs.setup.outputs.argo-secure }}
ARGO_BASE_HREF: ${{ needs.setup.outputs.argo-href }}
ARGO_NAMESPACE: ${{ needs.setup.outputs.argo-namespace }}
TEST_TYPE: "requirement_test"
TEST_ARGS: ""
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Read secrets from AWS Secrets Manager into environment variables
id: get-argo-token
run: |
ARGO_TOKEN=$(aws secretsmanager get-secret-value --secret-id ta-github-workflow-automation-token | jq -r '.SecretString')
echo "::set-output name=argo-token::$ARGO_TOKEN"
- name: create job name
id: create-job-name
shell: bash
run: |
RANDOM_STRING=$(head -3 /dev/urandom | tr -cd '[:lower:]' | cut -c -4)
JOB_NAME=${{ needs.setup.outputs.job-name }}-${RANDOM_STRING}
JOB_NAME=${JOB_NAME//TEST-TYPE/${{ env.TEST_TYPE }}}
JOB_NAME=${JOB_NAME//[_.]/-}
JOB_NAME=$(echo "$JOB_NAME" | tr '[:upper:]' '[:lower:]')
echo "::set-output name=job-name::$JOB_NAME"
- name: run-tests
id: run-tests
env:
ARGO_TOKEN: ${{ steps.get-argo-token.outputs.argo-token }}
uses: splunk/[email protected]
with:
splunk: ${{ matrix.splunk.version }}
test-type: ${{ env.TEST_TYPE }}
test-args: ""
job-name: ${{ steps.create-job-name.outputs.job-name }}
labels: ${{ needs.setup.outputs.labels }}
workflow-tmpl-name: ${{ needs.setup.outputs.argo-workflow-tmpl-name }}
workflow-template-ns: ${{ needs.setup.outputs.argo-namespace }}
delay-destroy: "No"
addon-url: ${{ needs.setup.outputs.addon-upload-path }}
addon-name: ${{ needs.setup.outputs.addon-name }}
sc4s-version: ${{ matrix.sc4s.version }}
sc4s-docker-registry: ${{ matrix.sc4s.docker_registry }}
- name: Check if pod was deleted
id: is-pod-deleted
if: always()
shell: bash
env:
ARGO_TOKEN: ${{ steps.get-argo-token.outputs.argo-token }}
run: |
set -o xtrace
if argo watch ${{ steps.run-tests.outputs.workflow-name }} -n workflows | grep "pod deleted"; then
echo "::set-output name=retry-workflow::true"
fi
- name: Retrying workflow
id: retry-wf
shell: bash
env:
ARGO_TOKEN: ${{ steps.get-argo-token.outputs.argo-token }}
if: always()
run: |
set -o xtrace
set +e
if [[ "${{ steps.is-pod-deleted.outputs.retry-workflow }}" == "true" ]]
then
WORKFLOW_NAME=$(argo resubmit -v -o json -n workflows "${{ steps.run-tests.outputs.workflow-name }}" | jq -r .metadata.name)
echo "::set-output name=workflow-name::$$WORKFLOW_NAME"
argo logs --follow "${WORKFLOW_NAME}" -n workflows || echo "... there was an error fetching logs, the workflow is still in progress. please wait for the workflow to complete ..."
else
echo "No retry required"
argo wait "${{ steps.run-tests.outputs.workflow-name }}" -n workflows
argo watch "${{ steps.run-tests.outputs.workflow-name }}" -n workflows | grep "test-addon"
fi
- name: check if workflow completed
env:
ARGO_TOKEN: ${{ steps.get-argo-token.outputs.argo-token }}
shell: bash
if: always()
run: |
set +e
# shellcheck disable=SC2157
if [ -z "${{ steps.retry-wf.outputs.workflow-name }}" ]; then
WORKFLOW_NAME=${{ steps.run-tests.outputs.workflow-name }}
else
WORKFLOW_NAME="${{ steps.retry-wf.outputs.workflow-name }}"
fi
ARGO_STATUS=$(argo get "${WORKFLOW_NAME}" -n workflows -o json | jq -r '.status.phase')
echo "Status of workflow:" "$ARGO_STATUS"
while [ "$ARGO_STATUS" == "Running" ] || [ "$ARGO_STATUS" == "Pending" ]
do
echo "... argo Workflow ${WORKFLOW_NAME} is running, waiting for it to complete."
argo wait "${WORKFLOW_NAME}" -n workflows || true
ARGO_STATUS=$(argo get "${WORKFLOW_NAME}" -n workflows -o json | jq -r '.status.phase')
done
- name: pull artifacts from s3 bucket
if: always()
run: |
echo "pulling artifacts"
aws s3 cp s3://${{ needs.setup.outputs.s3-bucket }}/artifacts-${{ steps.create-job-name.outputs.job-name }}/${{ steps.create-job-name.outputs.job-name }}.tgz ${{ needs.setup.outputs.directory-path }}/
tar -xf ${{ needs.setup.outputs.directory-path }}/${{ steps.create-job-name.outputs.job-name }}.tgz -C ${{ needs.setup.outputs.directory-path }}
- name: pull logs from s3 bucket
if: always()
run: |
# shellcheck disable=SC2157
if [ -z "${{ steps.retry-wf.outputs.workflow-name }}" ]; then
WORKFLOW_NAME=${{ steps.run-tests.outputs.workflow-name }}
else
WORKFLOW_NAME="${{ steps.retry-wf.outputs.workflow-name }}"
fi
echo "pulling logs"
mkdir -p ${{ needs.setup.outputs.directory-path }}/argo-logs
aws s3 cp s3://${{ needs.setup.outputs.s3-bucket }}/${WORKFLOW_NAME}/ ${{ needs.setup.outputs.directory-path }}/argo-logs/ --recursive
- uses: actions/upload-artifact@v3
if: always()
with:
name: archive splunk ${{ matrix.splunk.version }} ${{ env.TEST_TYPE }} tests artifacts
path: |
${{ needs.setup.outputs.directory-path }}/test-results
- uses: actions/upload-artifact@v3
if: always()
with:
name: archive splunk ${{ matrix.splunk.version }} ${{ env.TEST_TYPE }} tests logs
path: |
${{ needs.setup.outputs.directory-path }}/argo-logs
- name: Test Report
uses: dorny/test-reporter@v1
if: always()
with:
name: splunk ${{ matrix.splunk.version }} ${{ env.TEST_TYPE }} test report
path: "${{ needs.setup.outputs.directory-path }}/test-results/*.xml"
reporter: java-junit

run-ui-tests:
if: ${{ needs.test-inventory.outputs.ui == 'true' }}
needs:
Expand Down Expand Up @@ -1788,7 +1597,6 @@ jobs:
if: always()
needs:
- meta
- compliance-sample-scanner
- compliance-copyrights
- lint
- review_secrets
Expand All @@ -1797,13 +1605,11 @@ jobs:
- security-virustotal
- test-inventory
- run-unit-tests
- run-requirements-unit-tests
- appinspect
- setup
- run-knowledge-tests
- run-modinput-tests
- run-ui-tests
- run-requirement-tests
- validate-pr-title
runs-on: ubuntu-latest
env:
Expand Down

0 comments on commit 2c77946

Please sign in to comment.