Skip to content

Commit 6dd311b

Browse files
feat: remove escu tests from reusable workflow (#234)
PR removes ESCU tests execution from reusable workflow. Currently ESCU tests are not working, and due to lack of test data it is not possible to execute them properly. Test runs: splunk/splunk-add-on-for-google-workspace#542 splunk/splunk-add-on-for-microsoft-sysmon#313
1 parent 9b8154c commit 6dd311b

File tree

1 file changed

+2
-276
lines changed

1 file changed

+2
-276
lines changed

.github/workflows/reusable-build-test-release.yml

Lines changed: 2 additions & 276 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,15 @@ jobs:
7272
delay-destroy-ko: ${{ steps.delay-destroy-setup.outputs.delay-destroy-ko }}
7373
delay-destroy-ui: ${{ steps.delay-destroy-setup.outputs.delay-destroy-ui }}
7474
delay-destroy-modinput_functional: ${{ steps.delay-destroy-setup.outputs.delay-destroy-modinput_functional }}
75-
delay-destroy-escu: ${{ steps.delay-destroy-setup.outputs.delay-destroy-escu }}
7675
delay-destroy-scripted_inputs: ${{ steps.delay-destroy-setup.outputs.delay-destroy-scripted_inputs }}
7776
delay-destroy-requirement_test: ${{ steps.delay-destroy-setup.outputs.delay-destroy-requirement_test }}
7877
execute-ko: ${{ steps.delay-destroy-setup.outputs.execute-ko }}
7978
execute-ui: ${{ steps.delay-destroy-setup.outputs.execute-ui }}
80-
execute-escu: ${{ steps.delay-destroy-setup.outputs.execute-escu }}
8179
execute-modinput_functional: ${{ steps.delay-destroy-setup.outputs.execute-modinput_functional }}
8280
execute-scripted_inputs: ${{ steps.delay-destroy-setup.outputs.execute-scripted_inputs }}
8381
execute-requirement_test: ${{ steps.delay-destroy-setup.outputs.execute-requirement_test }}
8482
execute-knowledge-labeled: ${{ steps.configure-tests-on-labels.outputs.execute_knowledge_labeled }}
8583
execute-ui-labeled: ${{ steps.configure-tests-on-labels.outputs.execute_ui_labeled }}
86-
execute-escu-labeled: ${{ steps.configure-tests-on-labels.outputs.execute_escu_labeled }}
8784
execute-modinput-labeled: ${{ steps.configure-tests-on-labels.outputs.execute_modinput_functional_labeled }}
8885
execute-scripted_inputs-labeled: ${{ steps.configure-tests-on-labels.outputs.execute_scripted_inputs_labeled }}
8986
execute-requirement-labeled: ${{ steps.configure-tests-on-labels.outputs.execute_requirement_test_labeled }}
@@ -115,7 +112,7 @@ jobs:
115112
PR_BODY: ${{ github.event.pull_request.body }}
116113
run: |
117114
set +e
118-
TESTSET="knowledge ui modinput_functional scripted_inputs escu requirement_test"
115+
TESTSET="knowledge ui modinput_functional scripted_inputs requirement_test"
119116
echo "testset=$TESTSET" >> "$GITHUB_OUTPUT"
120117
SKIP_WORKFLOW="No"
121118
if [[ '${{ github.event.action }}' == 'labeled' && '${{ github.event.label.name }}' == 'preserve_infra' ]]; then
@@ -147,38 +144,31 @@ jobs:
147144
if [[ '${{ github.event.label.name }}' == 'preserve_infra' ]]; then
148145
echo "$PR_BODY" >> body.txt
149146
tests=$(grep -i "^preserve:" body.txt | { grep -v grep || true; })
150-
if [[ $tests =~ "escu" ]]; then
151-
echo "preserve_infra for escu test-type is not supported yet"
152-
fi
153147
for test_type in $TESTSET; do
154148
if [[ $tests =~ $test_type ]]; then
155149
eval EXECUTE_$test_type="Yes"
156150
eval DELAY_DESTROY_$test_type="Yes"
157151
fi
158152
done
159153
fi
160-
# PRESERVE_INFRA for escu test-type is not supported yet.
161-
DELAY_DESTROY_escu="No"
162154
{
163155
echo "delay-destroy-ko=$DELAY_DESTROY_knowledge"
164156
echo "delay-destroy-ui=$DELAY_DESTROY_ui"
165157
echo "delay-destroy-modinput_functional=$DELAY_DESTROY_modinput_functional"
166158
echo "delay-destroy-scripted_inputs=$DELAY_DESTROY_scripted_inputs"
167-
echo "delay-destroy-escu=$DELAY_DESTROY_escu"
168159
echo "delay-destroy-requirement_test=$DELAY_DESTROY_requirement_test"
169160
echo "execute-ko=$EXECUTE_knowledge"
170161
echo "execute-ui=$EXECUTE_ui"
171162
echo "execute-modinput_functional=$EXECUTE_modinput_functional"
172163
echo "execute-scripted_inputs=$EXECUTE_scripted_inputs"
173-
echo "execute-escu=$EXECUTE_escu"
174164
echo "execute-requirement_test=$EXECUTE_requirement_test"
175165
} >> "$GITHUB_OUTPUT"
176166
- name: configure tests based on labels
177167
id: configure-tests-on-labels
178168
run: |
179169
set +e
180170
declare -A EXECUTE_LABELED
181-
TESTSET=("execute_knowledge" "execute_ui" "execute_modinput_functional" "execute_scripted_inputs" "execute_escu" "execute_requirement_test")
171+
TESTSET=("execute_knowledge" "execute_ui" "execute_modinput_functional" "execute_scripted_inputs" "execute_requirement_test")
182172
for test_type in "${TESTSET[@]}"; do
183173
EXECUTE_LABELED["$test_type"]="false"
184174
done
@@ -427,7 +417,6 @@ jobs:
427417
modinput_functional: ${{ steps.testset.outputs.modinput_functional }}
428418
requirement_test: ${{ steps.testset.outputs.requirement_test }}
429419
scripted_inputs: ${{ steps.testset.outputs.scripted_inputs }}
430-
escu: ${{ steps.testset.outputs.escu }}
431420
ucc_modinput_functional: ${{ steps.modinput-version.outputs.ucc_modinput_tests }}
432421
steps:
433422
- uses: actions/checkout@v3
@@ -2469,260 +2458,6 @@ jobs:
24692458
path: |
24702459
${{ needs.setup.outputs.directory-path }}/diag*
24712460
2472-
run-escu-tests:
2473-
if: ${{ !cancelled() && needs.build.result == 'success' && needs.test-inventory.outputs.escu == 'true' && ( github.base_ref == 'main' || github.ref_name == 'main' || github.base_ref == 'develop' || github.ref_name == 'develop' ) && (needs.setup-workflow.outputs.execute-escu == 'Yes' || needs.setup-workflow.outputs.execute-escu-labeled == 'true') }}
2474-
needs:
2475-
- build
2476-
- test-inventory
2477-
- setup
2478-
- meta
2479-
- setup-workflow
2480-
runs-on: ubuntu-latest
2481-
strategy:
2482-
fail-fast: false
2483-
matrix:
2484-
splunk: ${{ fromJson(needs.meta.outputs.matrix_latestSplunk) }}
2485-
container:
2486-
image: ghcr.io/splunk/workflow-engine-base:2.0.12
2487-
env:
2488-
ARGO_SERVER: ${{ needs.setup.outputs.argo-server }}
2489-
ARGO_HTTP1: ${{ needs.setup.outputs.argo-http1 }}
2490-
ARGO_SECURE: ${{ needs.setup.outputs.argo-secure }}
2491-
ARGO_BASE_HREF: ${{ needs.setup.outputs.argo-href }}
2492-
ARGO_NAMESPACE: ${{ needs.setup.outputs.argo-namespace }}
2493-
SPLUNK_VERSION_BASE: ${{ matrix.splunk.version }}${{ secrets.OTHER_TA_REQUIRED_CONFIGS }}
2494-
TEST_TYPE: "escu"
2495-
permissions:
2496-
actions: read
2497-
deployments: read
2498-
contents: read
2499-
packages: read
2500-
statuses: read
2501-
checks: write
2502-
steps:
2503-
- uses: actions/checkout@v3
2504-
with:
2505-
submodules: recursive
2506-
- name: configure git # This step configures git to omit "dubious git ownership error" in later test-reporter stage
2507-
id: configure-git
2508-
run: |
2509-
git --version
2510-
git_path="$(pwd)"
2511-
echo "$git_path"
2512-
git config --global --add safe.directory "$git_path"
2513-
- name: capture start time
2514-
id: capture-start-time
2515-
run: |
2516-
echo "start_time=$(date +%s)" >> "$GITHUB_OUTPUT"
2517-
- name: Configure AWS credentials
2518-
uses: aws-actions/configure-aws-credentials@v2
2519-
with:
2520-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
2521-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
2522-
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
2523-
- name: Read secrets from AWS Secrets Manager into environment variables
2524-
id: get-argo-token
2525-
run: |
2526-
ARGO_TOKEN=$(aws secretsmanager get-secret-value --secret-id "${{ needs.setup-workflow.outputs.argo_token_secret_id_k8s }}" | jq -r '.SecretString')
2527-
echo "argo-token=$ARGO_TOKEN" >> "$GITHUB_OUTPUT"
2528-
- name: create job name
2529-
id: create-job-name
2530-
shell: bash
2531-
run: |
2532-
RANDOM_STRING=$(head -3 /dev/urandom | tr -cd '[:lower:]' | cut -c -4)
2533-
JOB_NAME=${{ needs.setup.outputs.job-name }}-${RANDOM_STRING}
2534-
JOB_NAME=${JOB_NAME//TEST-TYPE/${{ env.TEST_TYPE }}}
2535-
JOB_NAME=${JOB_NAME//[_.]/-}
2536-
JOB_NAME=$(echo "$JOB_NAME" | tr '[:upper:]' '[:lower:]')
2537-
echo "job-name=$JOB_NAME" >> "$GITHUB_OUTPUT"
2538-
- name: Splunk instance details
2539-
id: splunk-instance-details
2540-
if: ${{ needs.setup-workflow.outputs.delay-destroy-escu == 'Yes' }}
2541-
shell: bash
2542-
run: |
2543-
BOLD="\033[1m"
2544-
NORMAL="\033[0m"
2545-
echo "Splunk Web UI will be available at https://${{ steps.create-job-name.outputs.job-name }}.${{ needs.setup.outputs.spl-host-suffix }}:8000 after test execution starts"
2546-
echo -e "Splunk username is${BOLD} admin${NORMAL}"
2547-
echo "Splunk password is available in SecretServer shared folder: Shared Splunk - GDI - Lab Credentials under SPLUNK_DEPLOYMENT_PASSWORD"
2548-
- name: get escu detections
2549-
id: get-escu-detections
2550-
run: |
2551-
RUN_TEST=false
2552-
# shellcheck disable=SC2002
2553-
DETECTIONS=$(cat tests/escu/.escu_detections | tr '\n' ',' | tr -d "[:space:]")
2554-
if [ -z "$DETECTIONS" ]
2555-
then
2556-
echo "Detection list is empty."
2557-
else
2558-
RUN_TEST=true
2559-
fi
2560-
DETECTIONS="-tf $DETECTIONS"
2561-
{
2562-
echo "escu-detections=$DETECTIONS"
2563-
echo "escu-test-run=$RUN_TEST"
2564-
} >> "$GITHUB_OUTPUT"
2565-
- name: run-tests
2566-
id: run-tests
2567-
timeout-minutes: 340
2568-
continue-on-error: true
2569-
if: ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
2570-
env:
2571-
ARGO_TOKEN: ${{ steps.get-argo-token.outputs.argo-token }}
2572-
uses: splunk/wfe-test-runner-action@v1.6
2573-
with:
2574-
splunk: ${{ matrix.splunk.version }}${{ secrets.OTHER_TA_REQUIRED_CONFIGS }}
2575-
test-type: ${{ env.TEST_TYPE }}
2576-
test-args: ${{ steps.get-escu-detections.outputs.escu-detections }}
2577-
job-name: ${{ steps.create-job-name.outputs.job-name }}
2578-
labels: ${{ needs.setup.outputs.labels }}
2579-
workflow-tmpl-name: ${{ needs.setup.outputs.argo-workflow-tmpl-name }}
2580-
workflow-template-ns: ${{ needs.setup.outputs.argo-namespace }}
2581-
delay-destroy: ${{ needs.setup-workflow.outputs.delay-destroy-escu }}
2582-
addon-url: ${{ needs.setup.outputs.addon-upload-path }}
2583-
addon-name: ${{ needs.setup.outputs.addon-name }}
2584-
vendor-version: ${{ matrix.vendor-version.image }}
2585-
sc4s-version: "No"
2586-
k8s-manifests-branch: ${{ needs.setup.outputs.k8s-manifests-branch }}
2587-
- name: calculate timeout
2588-
id: calculate-timeout
2589-
run: |
2590-
start_time=${{ steps.capture-start-time.outputs.start_time }}
2591-
current_time=$(date +%s)
2592-
remaining_time_minutes=$(( 350-((current_time-start_time)/60) ))
2593-
echo "remaining_time_minutes=$remaining_time_minutes" >> "$GITHUB_OUTPUT"
2594-
- name: Check if pod was deleted
2595-
id: is-pod-deleted
2596-
timeout-minutes: ${{ fromJson(steps.calculate-timeout.outputs.remaining_time_minutes) }}
2597-
if: ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
2598-
shell: bash
2599-
env:
2600-
ARGO_TOKEN: ${{ steps.get-argo-token.outputs.argo-token }}
2601-
run: |
2602-
set -o xtrace
2603-
if argo watch ${{ steps.run-tests.outputs.workflow-name }} -n workflows | grep "pod deleted"; then
2604-
echo "retry-workflow=true" >> "$GITHUB_OUTPUT"
2605-
fi
2606-
- name: Cancel workflow
2607-
env:
2608-
ARGO_TOKEN: ${{ steps.get-argo-token.outputs.argo-token }}
2609-
if: ${{ cancelled() }}
2610-
run: |
2611-
cancel_response=$(argo submit -v -o json --from wftmpl/${{ needs.setup.outputs.argo-cancel-workflow-tmpl-name }} -l workflows.argoproj.io/workflow-template=${{ needs.setup.outputs.argo-cancel-workflow-tmpl-name }} --argo-base-href '' -p workflow-to-cancel=${{ steps.run-tests.outputs.workflow-name }})
2612-
cancel_workflow_name=$( echo "$cancel_response" |jq -r '.metadata.name' )
2613-
cancel_logs=$(argo logs --follow "$cancel_workflow_name" -n workflows)
2614-
if echo "$cancel_logs" | grep -q "workflow ${{ steps.run-tests.outputs.workflow-name }} stopped"; then
2615-
echo "Workflow ${{ steps.run-tests.outputs.workflow-name }} stopped"
2616-
else
2617-
echo "Workflow ${{ steps.run-tests.outputs.workflow-name }} didn't stop"
2618-
exit 1
2619-
fi
2620-
- name: Retrying workflow
2621-
id: retry-wf
2622-
shell: bash
2623-
env:
2624-
ARGO_TOKEN: ${{ steps.get-argo-token.outputs.argo-token }}
2625-
if: ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
2626-
run: |
2627-
set -o xtrace
2628-
set +e
2629-
if [[ "${{ steps.is-pod-deleted.outputs.retry-workflow }}" == "true" ]]
2630-
then
2631-
WORKFLOW_NAME=$(argo resubmit -v -o json -n workflows "${{ steps.run-tests.outputs.workflow-name }}" | jq -r .metadata.name)
2632-
echo "workflow-name=$WORKFLOW_NAME" >> "$GITHUB_OUTPUT"
2633-
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 ..."
2634-
else
2635-
echo "No retry required"
2636-
argo wait "${{ steps.run-tests.outputs.workflow-name }}" -n workflows
2637-
argo watch "${{ steps.run-tests.outputs.workflow-name }}" -n workflows | grep "test-addon"
2638-
fi
2639-
- name: check if workflow completed
2640-
env:
2641-
ARGO_TOKEN: ${{ steps.get-argo-token.outputs.argo-token }}
2642-
if: ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
2643-
shell: bash
2644-
run: |
2645-
set +e
2646-
# shellcheck disable=SC2157
2647-
if [ -z "${{ steps.retry-wf.outputs.workflow-name }}" ]; then
2648-
WORKFLOW_NAME=${{ steps.run-tests.outputs.workflow-name }}
2649-
else
2650-
WORKFLOW_NAME="${{ steps.retry-wf.outputs.workflow-name }}"
2651-
fi
2652-
ARGO_STATUS=$(argo get "${WORKFLOW_NAME}" -n workflows -o json | jq -r '.status.phase')
2653-
echo "Status of workflow:" "$ARGO_STATUS"
2654-
while [ "$ARGO_STATUS" == "Running" ] || [ "$ARGO_STATUS" == "Pending" ]
2655-
do
2656-
echo "... argo Workflow ${WORKFLOW_NAME} is running, waiting for it to complete."
2657-
argo wait "${WORKFLOW_NAME}" -n workflows || true
2658-
ARGO_STATUS=$(argo get "${WORKFLOW_NAME}" -n workflows -o json | jq -r '.status.phase')
2659-
done
2660-
- name: pull artifacts from s3 bucket
2661-
if: ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
2662-
run: |
2663-
echo "pulling artifacts"
2664-
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 }}/
2665-
tar -xf ${{ needs.setup.outputs.directory-path }}/${{ steps.create-job-name.outputs.job-name }}.tgz -C ${{ needs.setup.outputs.directory-path }}
2666-
- name: pull logs from s3 bucket
2667-
if: ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
2668-
run: |
2669-
# shellcheck disable=SC2157
2670-
if [ -z "${{ steps.retry-wf.outputs.workflow-name }}" ]; then
2671-
WORKFLOW_NAME=${{ steps.run-tests.outputs.workflow-name }}
2672-
else
2673-
WORKFLOW_NAME="${{ steps.retry-wf.outputs.workflow-name }}"
2674-
fi
2675-
echo "pulling logs"
2676-
mkdir -p ${{ needs.setup.outputs.directory-path }}/argo-logs
2677-
aws s3 cp s3://${{ needs.setup.outputs.s3-bucket }}/${WORKFLOW_NAME}/ ${{ needs.setup.outputs.directory-path }}/argo-logs/ --recursive
2678-
- uses: actions/upload-artifact@v3
2679-
if: ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
2680-
with:
2681-
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
2682-
path: |
2683-
${{ needs.setup.outputs.directory-path }}/test-results
2684-
- uses: actions/upload-artifact@v3
2685-
if: ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
2686-
with:
2687-
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
2688-
path: |
2689-
${{ needs.setup.outputs.directory-path }}/argo-logs
2690-
- name: Upload results
2691-
if: ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' }}
2692-
uses: actions/upload-artifact@v3
2693-
with:
2694-
name: escu-test-result
2695-
path: |
2696-
${{ needs.setup.outputs.directory-path }}/test-results/escu-result.xml
2697-
- name: Test Report
2698-
id: test_report
2699-
uses: dorny/test-reporter@v1.7.0
2700-
if: ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' && !cancelled() && !contains(matrix.splunk.version, 'unreleased-python3_9')}}
2701-
with:
2702-
name: splunk ${{ matrix.splunk.version }}${{ secrets.OTHER_TA_REQUIRED_CONFIGS }} ${{ env.TEST_TYPE }} ${{ matrix.vendor-version.image }} test report
2703-
path: "${{ needs.setup.outputs.directory-path }}/test-results/*.xml"
2704-
reporter: java-junit
2705-
- name: Test Report Python 3.9
2706-
continue-on-error: true
2707-
id: test_report_python_3_9
2708-
uses: dorny/test-reporter@v1.7.0
2709-
if: ${{ steps.get-escu-detections.outputs.escu-test-run == 'true' && !cancelled() && contains(matrix.splunk.version, 'unreleased-python3_9')}}
2710-
with:
2711-
name: splunk ${{ matrix.splunk.version }}${{ secrets.OTHER_TA_REQUIRED_CONFIGS }} ${{ env.TEST_TYPE }} ${{ matrix.vendor-version.image }} test report
2712-
path: "${{ needs.setup.outputs.directory-path }}/test-results/*.xml"
2713-
reporter: java-junit
2714-
- name: pull diag from s3 bucket
2715-
if: ${{ failure() && steps.test_report.outputs.conclusion == 'failure' }}
2716-
run: |
2717-
echo "pulling diag"
2718-
aws s3 cp s3://${{ needs.setup.outputs.s3-bucket }}/diag-${{ steps.create-job-name.outputs.job-name }}/diag-${{ steps.create-job-name.outputs.job-name }}.tgz ${{ needs.setup.outputs.directory-path }}/
2719-
- uses: actions/upload-artifact@v3
2720-
if: ${{ failure() && steps.test_report.outputs.conclusion == 'failure' }}
2721-
with:
2722-
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 diag
2723-
path: |
2724-
${{ needs.setup.outputs.directory-path }}/diag*
2725-
27262461
pre-publish:
27272462
if: ${{ !cancelled() }}
27282463
# The following line will rename 'pre-publish' to 'pre-publish-not_main_pr' when PR is created towards main branch
@@ -2769,7 +2504,6 @@ jobs:
27692504
if: ${{ !cancelled() && needs.pre-publish.result == 'success' && github.event_name != 'pull_request' && github.event_name != 'schedule' }}
27702505
needs:
27712506
- pre-publish
2772-
- run-escu-tests
27732507
runs-on: ubuntu-latest
27742508
permissions:
27752509
contents: write
@@ -2815,14 +2549,6 @@ jobs:
28152549
with:
28162550
name: cim-field-report
28172551
path: download/artifacts/deployment
2818-
- name: Download escu-test-results
2819-
id: download-escu-xml
2820-
if: ${{ steps.semantic.outputs.new_release_published == 'true' }}
2821-
continue-on-error: true
2822-
uses: actions/download-artifact@v3
2823-
with:
2824-
name: escu-test-result
2825-
path: download/artifacts/deployment
28262552
- name: List of assets
28272553
if: ${{ steps.semantic.outputs.new_release_published == 'true' }}
28282554
run: |

0 commit comments

Comments
 (0)