@@ -309,6 +309,7 @@ jobs:
309309 name : package-deployment
310310 path : build/package/deployment**
311311 if : always()
312+
312313 security-virustotal :
313314 continue-on-error : true
314315 name : security-virustotal
@@ -326,6 +327,7 @@ jobs:
326327 vt_api_key : ${{ secrets.VT_API_KEY }}
327328 files : |
328329 build/package/*
330+
329331 test-inventory :
330332 runs-on : ubuntu-latest
331333 # Map a step output to a job output
@@ -336,6 +338,7 @@ jobs:
336338 modinput_functional : ${{ steps.testset.outputs.modinput_functional }}
337339 requirement_test : ${{ steps.testset.outputs.requirement_test }}
338340 scripted_inputs : ${{ steps.testset.outputs.scripted_inputs }}
341+ escu : ${{ steps.testset.outputs.escu }}
339342 steps :
340343 - uses : actions/checkout@v3
341344 - id : testset
@@ -1592,6 +1595,183 @@ jobs:
15921595 path : " ${{ needs.setup.outputs.directory-path }}/test-results/*.xml"
15931596 reporter : java-junit
15941597
1598+ run-escu-tests :
1599+ if : ${{ needs.test-inventory.outputs.escu == 'true' && ( github.base_ref == 'main' || github.ref_name == 'main' || github.base_ref == 'develop' || github.ref_name == 'develop' ) }}
1600+ needs :
1601+ - build
1602+ - test-inventory
1603+ - setup
1604+ - meta
1605+ runs-on : ubuntu-latest
1606+ strategy :
1607+ fail-fast : false
1608+ matrix :
1609+ splunk : ${{ fromJson(needs.meta.outputs.matrix_latestSplunk) }}
1610+ container :
1611+ image : ghcr.io/splunk/workflow-engine-base:2.0.3
1612+ env :
1613+ ARGO_SERVER : ${{ needs.setup.outputs.argo-server }}
1614+ ARGO_HTTP1 : ${{ needs.setup.outputs.argo-http1 }}
1615+ ARGO_SECURE : ${{ needs.setup.outputs.argo-secure }}
1616+ ARGO_BASE_HREF : ${{ needs.setup.outputs.argo-href }}
1617+ ARGO_NAMESPACE : ${{ needs.setup.outputs.argo-namespace }}
1618+ SPLUNK_VERSION_BASE : ${{ matrix.splunk.version }}${{ secrets.OTHER_TA_REQUIRED_CONFIGS }}
1619+ TEST_TYPE : " escu"
1620+ steps :
1621+ - uses : actions/checkout@v3
1622+ with :
1623+ submodules : recursive
1624+ - name : Configure AWS credentials
1625+ uses : aws-actions/configure-aws-credentials@v1
1626+ with :
1627+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
1628+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
1629+ aws-region : ${{ secrets.AWS_DEFAULT_REGION }}
1630+ - name : Read secrets from AWS Secrets Manager into environment variables
1631+ id : get-argo-token
1632+ run : |
1633+ ARGO_TOKEN=$(aws secretsmanager get-secret-value --secret-id ta-github-workflow-automation-token | jq -r '.SecretString')
1634+ echo "::set-output name=argo-token::$ARGO_TOKEN"
1635+ - name : create job name
1636+ id : create-job-name
1637+ shell : bash
1638+ run : |
1639+ RANDOM_STRING=$(head -3 /dev/urandom | tr -cd '[:lower:]' | cut -c -4)
1640+ JOB_NAME=${{ needs.setup.outputs.job-name }}-${RANDOM_STRING}
1641+ JOB_NAME=${JOB_NAME//TEST-TYPE/${{ env.TEST_TYPE }}}
1642+ JOB_NAME=${JOB_NAME//[_.]/-}
1643+ JOB_NAME=$(echo "$JOB_NAME" | tr '[:upper:]' '[:lower:]')
1644+ echo "::set-output name=job-name::$JOB_NAME"
1645+ - name : get escu detections
1646+ id : get-escu-detections
1647+ run : |
1648+ RUN_TEST=false
1649+ # shellcheck disable=SC2002
1650+ DETECTIONS=$(cat tests/escu/.escu_detections | tr '\n' ',' | tr -d "[:space:]")
1651+ if [ -z "$DETECTIONS" ]
1652+ then
1653+ echo "Detection list is empty."
1654+ else
1655+ RUN_TEST=true
1656+ fi
1657+ DETECTIONS="-tf $DETECTIONS"
1658+ echo "::set-output name=escu-detections::$DETECTIONS"
1659+ echo "::set-output name=escu-test-run::$RUN_TEST"
1660+ - name : run-tests
1661+ id : run-tests
1662+ if : ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
1663+ env :
1664+ ARGO_TOKEN : ${{ steps.get-argo-token.outputs.argo-token }}
1665+ uses : splunk/wfe-test-runner-action@v1.6.1
1666+ with :
1667+ splunk : ${{ matrix.splunk.version }}${{ secrets.OTHER_TA_REQUIRED_CONFIGS }}
1668+ test-type : ${{ env.TEST_TYPE }}
1669+ test-args : ${{ steps.get-escu-detections.outputs.escu-detections }}
1670+ job-name : ${{ steps.create-job-name.outputs.job-name }}
1671+ labels : ${{ needs.setup.outputs.labels }}
1672+ workflow-tmpl-name : ${{ needs.setup.outputs.argo-workflow-tmpl-name }}
1673+ workflow-template-ns : ${{ needs.setup.outputs.argo-namespace }}
1674+ delay-destroy : " No"
1675+ addon-url : ${{ needs.setup.outputs.addon-upload-path }}
1676+ addon-name : ${{ needs.setup.outputs.addon-name }}
1677+ vendor-version : ${{ matrix.vendor-version.image }}
1678+ sc4s-version : " No"
1679+ - name : Check if pod was deleted
1680+ id : is-pod-deleted
1681+ if : ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
1682+ shell : bash
1683+ env :
1684+ ARGO_TOKEN : ${{ steps.get-argo-token.outputs.argo-token }}
1685+ run : |
1686+ set -o xtrace
1687+ if argo watch ${{ steps.run-tests.outputs.workflow-name }} -n workflows | grep "pod deleted"; then
1688+ echo "::set-output name=retry-workflow::true"
1689+ fi
1690+ - name : Retrying workflow
1691+ id : retry-wf
1692+ shell : bash
1693+ env :
1694+ ARGO_TOKEN : ${{ steps.get-argo-token.outputs.argo-token }}
1695+ if : ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
1696+ run : |
1697+ set -o xtrace
1698+ set +e
1699+ if [[ "${{ steps.is-pod-deleted.outputs.retry-workflow }}" == "true" ]]
1700+ then
1701+ WORKFLOW_NAME=$(argo resubmit -v -o json -n workflows "${{ steps.run-tests.outputs.workflow-name }}" | jq -r .metadata.name)
1702+ echo "::set-output name=workflow-name::$WORKFLOW_NAME"
1703+ 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 ..."
1704+ else
1705+ echo "No retry required"
1706+ argo wait "${{ steps.run-tests.outputs.workflow-name }}" -n workflows
1707+ argo watch "${{ steps.run-tests.outputs.workflow-name }}" -n workflows | grep "test-addon"
1708+ fi
1709+ - name : check if workflow completed
1710+ env :
1711+ ARGO_TOKEN : ${{ steps.get-argo-token.outputs.argo-token }}
1712+ if : ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
1713+ shell : bash
1714+ run : |
1715+ set +e
1716+ # shellcheck disable=SC2157
1717+ if [ -z "${{ steps.retry-wf.outputs.workflow-name }}" ]; then
1718+ WORKFLOW_NAME=${{ steps.run-tests.outputs.workflow-name }}
1719+ else
1720+ WORKFLOW_NAME="${{ steps.retry-wf.outputs.workflow-name }}"
1721+ fi
1722+ ARGO_STATUS=$(argo get "${WORKFLOW_NAME}" -n workflows -o json | jq -r '.status.phase')
1723+ echo "Status of workflow:" "$ARGO_STATUS"
1724+ while [ "$ARGO_STATUS" == "Running" ] || [ "$ARGO_STATUS" == "Pending" ]
1725+ do
1726+ echo "... argo Workflow ${WORKFLOW_NAME} is running, waiting for it to complete."
1727+ argo wait "${WORKFLOW_NAME}" -n workflows || true
1728+ ARGO_STATUS=$(argo get "${WORKFLOW_NAME}" -n workflows -o json | jq -r '.status.phase')
1729+ done
1730+ - name : pull artifacts from s3 bucket
1731+ if : ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
1732+ run : |
1733+ echo "pulling artifacts"
1734+ 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 }}/
1735+ tar -xf ${{ needs.setup.outputs.directory-path }}/${{ steps.create-job-name.outputs.job-name }}.tgz -C ${{ needs.setup.outputs.directory-path }}
1736+ - name : pull logs from s3 bucket
1737+ if : ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
1738+ run : |
1739+ # shellcheck disable=SC2157
1740+ if [ -z "${{ steps.retry-wf.outputs.workflow-name }}" ]; then
1741+ WORKFLOW_NAME=${{ steps.run-tests.outputs.workflow-name }}
1742+ else
1743+ WORKFLOW_NAME="${{ steps.retry-wf.outputs.workflow-name }}"
1744+ fi
1745+ echo "pulling logs"
1746+ mkdir -p ${{ needs.setup.outputs.directory-path }}/argo-logs
1747+ aws s3 cp s3://${{ needs.setup.outputs.s3-bucket }}/${WORKFLOW_NAME}/ ${{ needs.setup.outputs.directory-path }}/argo-logs/ --recursive
1748+ - uses : actions/upload-artifact@v3
1749+ if : ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
1750+ with :
1751+ name : archive splunk ${{ matrix.splunk.version }}${{ secrets.OTHER_TA_REQUIRED_CONFIGS }} ${{ env.TEST_TYPE }} ${{ matrix.vendor-version.image }} ${{ steps.os-name-version.outputs.os-name }} ${{ steps.os-name-version.outputs.os-version }} tests artifacts
1752+ path : |
1753+ ${{ needs.setup.outputs.directory-path }}/test-results
1754+ - uses : actions/upload-artifact@v3
1755+ if : ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
1756+ with :
1757+ name : archive splunk ${{ matrix.splunk.version }}${{ secrets.OTHER_TA_REQUIRED_CONFIGS }} ${{ env.TEST_TYPE }} ${{ matrix.vendor-version.image }} ${{ steps.os-name-version.outputs.os-name }} ${{ steps.os-name-version.outputs.os-version }} tests logs
1758+ path : |
1759+ ${{ needs.setup.outputs.directory-path }}/argo-logs
1760+ - name : Upload results
1761+ if : ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
1762+ uses : actions/upload-artifact@v3
1763+ with :
1764+ name : escu-test-result
1765+ path : |
1766+ ${{ needs.setup.outputs.directory-path }}/test-results/escu-result.xml
1767+ - name : Test Report
1768+ uses : dorny/test-reporter@v1
1769+ if : ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
1770+ with :
1771+ name : splunk ${{ matrix.splunk.version }}${{ secrets.OTHER_TA_REQUIRED_CONFIGS }} ${{ env.TEST_TYPE }} ${{ matrix.vendor-version.image }} test report
1772+ path : " ${{ needs.setup.outputs.directory-path }}/test-results/*.xml"
1773+ reporter : java-junit
1774+
15951775 validate-pr-title :
15961776 name : Validate PR title
15971777 if : github.event_name == 'pull_request'
@@ -1650,6 +1830,7 @@ jobs:
16501830 if : always() && needs.pre-publish.result == 'success' && github.event_name != 'pull_request' && github.event_name != 'schedule'
16511831 needs :
16521832 - pre-publish
1833+ - run-escu-tests
16531834 runs-on : ubuntu-latest
16541835 steps :
16551836 - name : Checkout
@@ -1703,6 +1884,14 @@ jobs:
17031884 with :
17041885 name : cim-field-report
17051886 path : download/artifacts/deployment
1887+ - name : Download escu-test-results
1888+ id : download-escu-xml
1889+ if : ${{ steps.semantic.outputs.new_release_published == 'true' }}
1890+ continue-on-error : true
1891+ uses : actions/download-artifact@v3
1892+ with :
1893+ name : escu-test-result
1894+ path : download/artifacts/deployment
17061895 - name : List of assets
17071896 if : ${{ steps.semantic.outputs.new_release_published == 'true' }}
17081897 run : |
0 commit comments