46
46
type : string
47
47
default : >-
48
48
["ubuntu:14.04", "ubuntu:16.04","ubuntu:18.04","ubuntu:22.04", "ubuntu:24.04", "redhat:8.4", "redhat:8.5", "redhat:8.6", "redhat:8.8"]
49
+ upgrade-tests-ta-versions :
50
+ required : false
51
+ description : " List with TA versions (in 'X.X.X' format) that should be used as starting points for upgrade tests. If not provided,
52
+ the latest TA version will be used. Example: ['7.6.0', '7.7.0']"
53
+ type : string
54
+ default : >-
55
+ ["latest"]
49
56
secrets :
50
57
GH_TOKEN_ADMIN :
51
58
description : Github admin token
@@ -120,6 +127,7 @@ jobs:
120
127
execute-ucc-modinput-labeled : ${{ steps.configure-tests-on-labels.outputs.execute_ucc_modinput_functional_labeled }}
121
128
execute-scripted_inputs-labeled : ${{ steps.configure-tests-on-labels.outputs.execute_scripted_inputs_labeled }}
122
129
execute-requirement-labeled : ${{ steps.configure-tests-on-labels.outputs.execute_requirement_test_labeled }}
130
+ execute-upgrade-labeled : ${{ steps.configure-tests-on-labels.outputs.execute_upgrade_test_labeled }}
123
131
s3_bucket_k8s : ${{ steps.k8s-environment.outputs.s3_bucket }}
124
132
argo_server_domain_k8s : ${{ steps.k8s-environment.outputs.argo_server_domain }}
125
133
argo_token_secret_id_k8s : ${{ steps.k8s-environment.outputs.argo_token_secret_id }}
@@ -148,7 +156,7 @@ jobs:
148
156
run : |
149
157
set +e
150
158
declare -A EXECUTE_LABELED
151
- TESTSET=("execute_knowledge" "execute_ui" "execute_modinput_functional" "execute_ucc_modinput_functional" "execute_scripted_inputs" "execute_requirement_test")
159
+ TESTSET=("execute_knowledge" "execute_ui" "execute_modinput_functional" "execute_ucc_modinput_functional" "execute_scripted_inputs" "execute_requirement_test" "execute_upgrade" )
152
160
for test_type in "${TESTSET[@]}"; do
153
161
EXECUTE_LABELED["$test_type"]="false"
154
162
done
@@ -164,7 +172,10 @@ jobs:
164
172
done
165
173
elif ${{ github.base_ref == 'main' }} || ${{ contains(github.event.pull_request.labels.*.name, 'execute_all_tests') }}; then
166
174
for test_type in "${TESTSET[@]}"; do
167
- EXECUTE_LABELED["$test_type"]="true"
175
+ # Exclude upgrade tests on PRs to main
176
+ if [[ "$test_type" != "execute_upgrade" ]]; then
177
+ EXECUTE_LABELED["$test_type"]="true"
178
+ fi
168
179
done
169
180
else
170
181
for test_type in "${TESTSET[@]}"; do
@@ -178,19 +189,28 @@ jobs:
178
189
if ${{ github.ref_name == 'main' }} || ${{ github.ref_name == 'develop' }} ||
179
190
${{ startsWith(github.ref_name, 'release/') && inputs.execute-tests-on-push-to-release == 'true' }} ; then
180
191
for test_type in "${TESTSET[@]}"; do
181
- EXECUTE_LABELED["$test_type"]="true"
192
+ # Exclude upgrade tests on push to main
193
+ if [[ "$test_type" != "execute_upgrade" ]]; then
194
+ EXECUTE_LABELED["$test_type"]="true"
195
+ fi
182
196
done
183
197
fi
184
198
;;
185
199
"schedule")
186
200
for test_type in "${TESTSET[@]}"; do
187
- EXECUTE_LABELED["$test_type"]="true"
201
+ # Exclude upgrade tests in scheduled runs
202
+ if [[ "$test_type" != "execute_upgrade" ]]; then
203
+ EXECUTE_LABELED["$test_type"]="true"
204
+ fi
188
205
done
189
206
;;
190
207
"workflow_dispatch")
191
208
if ${{ inputs.custom-version != '' }} ; then
192
209
for test_type in "${TESTSET[@]}"; do
193
- EXECUTE_LABELED["$test_type"]="true"
210
+ # Exclude upgrade tests in custom releases
211
+ if [[ "$test_type" != "execute_upgrade" ]]; then
212
+ EXECUTE_LABELED["$test_type"]="true"
213
+ fi
194
214
done
195
215
fi
196
216
;;
@@ -345,6 +365,7 @@ jobs:
345
365
requirement_test : ${{ steps.testset.outputs.requirement_test }}
346
366
scripted_inputs : ${{ steps.testset.outputs.scripted_inputs }}
347
367
ucc_modinput_functional : ${{ steps.testset.outputs.ucc_modinput_functional }}
368
+ upgrade : ${{ steps.testset.outputs.upgrade }}
348
369
steps :
349
370
- uses : actions/checkout@v4
350
371
- id : testset
@@ -2538,6 +2559,269 @@ jobs:
2538
2559
with :
2539
2560
name : |
2540
2561
summary-ucc_modinput*
2562
+
2563
+ run-upgrade-tests :
2564
+ if : ${{ !cancelled() && needs.build.result == 'success' && needs.test-inventory.outputs.upgrade == 'true' }}
2565
+ needs :
2566
+ - build
2567
+ - test-inventory
2568
+ - setup
2569
+ - meta
2570
+ - setup-workflow
2571
+ runs-on : ubuntu-latest
2572
+ strategy :
2573
+ fail-fast : false
2574
+ matrix :
2575
+ splunk : ${{ fromJson(needs.meta.outputs.matrix_supportedSplunk) }}
2576
+ vendor-version : ${{ fromJson(needs.meta.outputs.matrix_supportedModinputFunctionalVendors) }}
2577
+ ta-version-from-upgrade : ${{ fromJson(inputs.upgrade-tests-ta-versions) }}
2578
+ container :
2579
+ image : ghcr.io/splunk/workflow-engine-base:4.1.0
2580
+ env :
2581
+ ARGO_SERVER : ${{ needs.setup.outputs.argo-server }}
2582
+ ARGO_HTTP1 : ${{ needs.setup.outputs.argo-http1 }}
2583
+ ARGO_SECURE : ${{ needs.setup.outputs.argo-secure }}
2584
+ ARGO_BASE_HREF : ${{ needs.setup.outputs.argo-href }}
2585
+ ARGO_NAMESPACE : ${{ needs.setup.outputs.argo-namespace }}
2586
+ SPLUNK_VERSION_BASE : ${{ matrix.splunk.version }}${{ secrets.OTHER_TA_REQUIRED_CONFIGS }}
2587
+ TEST_TYPE : " upgrade"
2588
+ TEST_ARGS : " "
2589
+ permissions :
2590
+ actions : read
2591
+ deployments : read
2592
+ contents : read
2593
+ packages : read
2594
+ statuses : read
2595
+ checks : write
2596
+ steps :
2597
+ - uses : actions/checkout@v4
2598
+ with :
2599
+ submodules : recursive
2600
+ - name : configure git # This step configures git to omit "dubious git ownership error" in later test-reporter stage
2601
+ id : configure-git
2602
+ run : |
2603
+ git --version
2604
+ git_path="$(pwd)"
2605
+ echo "$git_path"
2606
+ git config --global --add safe.directory "$git_path"
2607
+ - name : capture start time
2608
+ id : capture-start-time
2609
+ run : |
2610
+ echo "start_time=$(date +%s)" >> "$GITHUB_OUTPUT"
2611
+ - name : Configure AWS credentials
2612
+ uses : aws-actions/configure-aws-credentials@v4
2613
+ with :
2614
+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
2615
+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
2616
+ aws-region : ${{ secrets.AWS_DEFAULT_REGION }}
2617
+ - name : Read secrets from AWS Secrets Manager into environment variables
2618
+ id : get-argo-token
2619
+ run : |
2620
+ ARGO_TOKEN=$(aws secretsmanager get-secret-value --secret-id "${{ needs.setup-workflow.outputs.argo_token_secret_id_k8s }}" | jq -r '.SecretString')
2621
+ echo "argo-token=$ARGO_TOKEN" >> "$GITHUB_OUTPUT"
2622
+ - name : create job name
2623
+ id : create-job-name
2624
+ shell : bash
2625
+ run : |
2626
+ RANDOM_STRING=$(head -3 /dev/urandom | tr -cd '[:lower:]' | cut -c -4)
2627
+ JOB_NAME=${{ needs.setup.outputs.job-name }}-${RANDOM_STRING}
2628
+ JOB_NAME=${JOB_NAME//TEST-TYPE/${{ env.TEST_TYPE }}}
2629
+ JOB_NAME=${JOB_NAME//[_.]/-}
2630
+ JOB_NAME=$(echo "$JOB_NAME" | tr '[:upper:]' '[:lower:]')
2631
+ echo "job-name=$JOB_NAME" >> "$GITHUB_OUTPUT"
2632
+ - name : run-tests
2633
+ id : run-tests
2634
+ timeout-minutes : 340
2635
+ continue-on-error : true
2636
+ env :
2637
+ ARGO_TOKEN : ${{ steps.get-argo-token.outputs.argo-token }}
2638
+ uses : splunk/wfe-test-runner-action@feat/ADDON-73868-add-inputs-for-upgrade-tests # TODO: add correct branch name
2639
+ with :
2640
+ splunk : ${{ matrix.splunk.version }}${{ secrets.OTHER_TA_REQUIRED_CONFIGS }}
2641
+ test-type : ${{ env.TEST_TYPE }}
2642
+ test-args : ${{ env.TEST_ARGS }}
2643
+ job-name : ${{ steps.create-job-name.outputs.job-name }}
2644
+ labels : ${{ needs.setup.outputs.labels }}
2645
+ workflow-tmpl-name : ${{ needs.setup.outputs.argo-workflow-tmpl-name }}
2646
+ workflow-template-ns : ${{ needs.setup.outputs.argo-namespace }}
2647
+ addon-url : ${{ needs.setup.outputs.addon-upload-path }}
2648
+ addon-name : ${{ needs.setup.outputs.addon-name }}
2649
+ vendor-version : ${{ matrix.vendor-version.image }}
2650
+ sc4s-version : " No"
2651
+ k8s-manifests-branch : ${{ needs.setup.outputs.k8s-manifests-branch }}
2652
+ ta-upgrade-version : ${{ matrix.ta-version-from-upgrade }}
2653
+ - name : Read secrets from AWS Secrets Manager again into environment variables in case credential rotation
2654
+ id : update-argo-token
2655
+ if : ${{ !cancelled() }}
2656
+ run : |
2657
+ ARGO_TOKEN=$(aws secretsmanager get-secret-value --secret-id "${{ needs.setup-workflow.outputs.argo_token_secret_id_k8s }}" | jq -r '.SecretString')
2658
+ echo "argo-token=$ARGO_TOKEN" >> "$GITHUB_OUTPUT"
2659
+ - name : calculate timeout
2660
+ id : calculate-timeout
2661
+ run : |
2662
+ start_time=${{ steps.capture-start-time.outputs.start_time }}
2663
+ current_time=$(date +%s)
2664
+ remaining_time_minutes=$(( 350-((current_time-start_time)/60) ))
2665
+ echo "remaining_time_minutes=$remaining_time_minutes" >> "$GITHUB_OUTPUT"
2666
+ - name : Check if pod was deleted
2667
+ id : is-pod-deleted
2668
+ timeout-minutes : ${{ fromJson(steps.calculate-timeout.outputs.remaining_time_minutes) }}
2669
+ if : ${{ !cancelled() }}
2670
+ shell : bash
2671
+ env :
2672
+ ARGO_TOKEN : ${{ steps.update-argo-token.outputs.argo-token }}
2673
+ run : |
2674
+ set -o xtrace
2675
+ if argo watch ${{ steps.run-tests.outputs.workflow-name }} -n workflows | grep "pod deleted"; then
2676
+ echo "retry-workflow=true" >> "$GITHUB_OUTPUT"
2677
+ fi
2678
+ - name : Cancel workflow
2679
+ env :
2680
+ ARGO_TOKEN : ${{ steps.get-argo-token.outputs.argo-token }}
2681
+ if : ${{ cancelled() || steps.is-pod-deleted.outcome != 'success' }}
2682
+ run : |
2683
+ 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 }})
2684
+ cancel_workflow_name=$( echo "$cancel_response" |jq -r '.metadata.name' )
2685
+ cancel_logs=$(argo logs --follow "$cancel_workflow_name" -n workflows)
2686
+ if echo "$cancel_logs" | grep -q "workflow ${{ steps.run-tests.outputs.workflow-name }} stopped"; then
2687
+ echo "Workflow ${{ steps.run-tests.outputs.workflow-name }} stopped"
2688
+ else
2689
+ echo "Workflow ${{ steps.run-tests.outputs.workflow-name }} didn't stop"
2690
+ exit 1
2691
+ fi
2692
+ - name : Retrying workflow
2693
+ id : retry-wf
2694
+ shell : bash
2695
+ env :
2696
+ ARGO_TOKEN : ${{ steps.update-argo-token.outputs.argo-token }}
2697
+ if : ${{ !cancelled() }}
2698
+ run : |
2699
+ set -o xtrace
2700
+ set +e
2701
+ if [[ "${{ steps.is-pod-deleted.outputs.retry-workflow }}" == "true" ]]
2702
+ then
2703
+ WORKFLOW_NAME=$(argo resubmit -v -o json -n workflows "${{ steps.run-tests.outputs.workflow-name }}" | jq -r .metadata.name)
2704
+ echo "workflow-name=$WORKFLOW_NAME" >> "$GITHUB_OUTPUT"
2705
+ 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 ..."
2706
+ else
2707
+ echo "No retry required"
2708
+ argo wait "${{ steps.run-tests.outputs.workflow-name }}" -n workflows
2709
+ argo watch "${{ steps.run-tests.outputs.workflow-name }}" -n workflows | grep "test-addon"
2710
+ fi
2711
+ - name : check if workflow completed
2712
+ env :
2713
+ ARGO_TOKEN : ${{ steps.update-argo-token.outputs.argo-token }}
2714
+ if : ${{ !cancelled() }}
2715
+ shell : bash
2716
+ run : |
2717
+ set +e
2718
+ # shellcheck disable=SC2157
2719
+ if [ -z "${{ steps.retry-wf.outputs.workflow-name }}" ]; then
2720
+ WORKFLOW_NAME=${{ steps.run-tests.outputs.workflow-name }}
2721
+ else
2722
+ WORKFLOW_NAME="${{ steps.retry-wf.outputs.workflow-name }}"
2723
+ fi
2724
+ ARGO_STATUS=$(argo get "${WORKFLOW_NAME}" -n workflows -o json | jq -r '.status.phase')
2725
+ echo "Status of workflow:" "$ARGO_STATUS"
2726
+ while [ "$ARGO_STATUS" == "Running" ] || [ "$ARGO_STATUS" == "Pending" ]
2727
+ do
2728
+ echo "... argo Workflow ${WORKFLOW_NAME} is running, waiting for it to complete."
2729
+ argo wait "${WORKFLOW_NAME}" -n workflows || true
2730
+ ARGO_STATUS=$(argo get "${WORKFLOW_NAME}" -n workflows -o json | jq -r '.status.phase')
2731
+ done
2732
+ - name : pull artifacts from s3 bucket
2733
+ if : ${{ !cancelled() }}
2734
+ run : |
2735
+ echo "pulling artifacts"
2736
+ 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 }}/
2737
+ tar -xf ${{ needs.setup.outputs.directory-path }}/${{ steps.create-job-name.outputs.job-name }}.tgz -C ${{ needs.setup.outputs.directory-path }}
2738
+ - name : pull logs from s3 bucket
2739
+ if : ${{ !cancelled() }}
2740
+ run : |
2741
+ # shellcheck disable=SC2157
2742
+ if [ -z "${{ steps.retry-wf.outputs.workflow-name }}" ]; then
2743
+ WORKFLOW_NAME=${{ steps.run-tests.outputs.workflow-name }}
2744
+ else
2745
+ WORKFLOW_NAME="${{ steps.retry-wf.outputs.workflow-name }}"
2746
+ fi
2747
+ echo "pulling logs"
2748
+ mkdir -p ${{ needs.setup.outputs.directory-path }}/argo-logs
2749
+ aws s3 cp s3://${{ needs.setup.outputs.s3-bucket }}/${WORKFLOW_NAME}/ ${{ needs.setup.outputs.directory-path }}/argo-logs/ --recursive
2750
+ - uses : actions/upload-artifact@v4
2751
+ if : ${{ !cancelled() }}
2752
+ with :
2753
+ name : archive splunk ${{ matrix.splunk.version }}${{ secrets.OTHER_TA_REQUIRED_CONFIGS }} ${{ env.TEST_TYPE }} ${{ matrix.vendor-version.image }} ${{ matrix.ta-version-from-upgrade }} tests artifacts
2754
+ path : |
2755
+ ${{ needs.setup.outputs.directory-path }}/test-results
2756
+ - uses : actions/upload-artifact@v4
2757
+ if : ${{ !cancelled() }}
2758
+ with :
2759
+ name : archive splunk ${{ matrix.splunk.version }}${{ secrets.OTHER_TA_REQUIRED_CONFIGS }} ${{ env.TEST_TYPE }} ${{ matrix.vendor-version.image }} ${{ matrix.ta-version-from-upgrade }} tests logs
2760
+ path : |
2761
+ ${{ needs.setup.outputs.directory-path }}/argo-logs
2762
+ - name : Test Report
2763
+ id : test_report
2764
+
2765
+ if : ${{ !cancelled() }}
2766
+ with :
2767
+ name : splunk ${{ matrix.splunk.version }}${{ secrets.OTHER_TA_REQUIRED_CONFIGS }} ${{ env.TEST_TYPE }} ${{ matrix.vendor-version.image }} test report
2768
+ path : " ${{ needs.setup.outputs.directory-path }}/test-results/*.xml"
2769
+ reporter : java-junit
2770
+ - name : Parse JUnit XML
2771
+ if : ${{ !cancelled() }}
2772
+ run : |
2773
+ apt-get install -y libxml2-utils
2774
+ junit_xml_path="${{ needs.setup.outputs.directory-path }}/test-results"
2775
+ junit_xml_file=$(find "$junit_xml_path" -name "*.xml" -type f 2>/dev/null | head -n 1)
2776
+ if [ -n "$junit_xml_file" ]; then
2777
+ total_tests=$(xmllint --xpath "count(//testcase)" "$junit_xml_file")
2778
+ failures=$(xmllint --xpath "count(//testcase[failure])" "$junit_xml_file")
2779
+ errors=$(xmllint --xpath "count(//testcase[error])" "$junit_xml_file")
2780
+ skipped=$(xmllint --xpath "count(//testcase[skipped])" "$junit_xml_file")
2781
+ passed=$((total_tests - failures - errors - skipped))
2782
+ echo "splunk ${{ matrix.splunk.version }}${{ secrets.OTHER_TA_REQUIRED_CONFIGS }} ${{ matrix.ta-version-from-upgrade }} ${{ matrix.vendor-version.image }} |$total_tests |$passed |$failures |$errors | $skipped |${{steps.test_report.outputs.url_html}}" > job_summary.txt
2783
+ else
2784
+ echo "no XML File found, exiting"
2785
+ exit 1
2786
+ fi
2787
+ - name : Upload-artifact-for-github-summary
2788
+ uses : actions/upload-artifact@v4
2789
+ if : ${{ !cancelled() }}
2790
+ with :
2791
+ name : summary-${{ env.TEST_TYPE }}-${{ matrix.splunk.version }}-${{ secrets.OTHER_TA_REQUIRED_CONFIGS }}-${{ matrix.vendor-version.image }}-${{ matrix.ta-version-from-upgrade }}-artifact
2792
+ path : job_summary.txt
2793
+ - name : pull diag from s3 bucket
2794
+ if : ${{ failure() && steps.test_report.outputs.conclusion == 'failure' }}
2795
+ run : |
2796
+ echo "pulling diag"
2797
+ 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 }}/
2798
+ - uses : actions/upload-artifact@v4
2799
+ if : ${{ failure() && steps.test_report.outputs.conclusion == 'failure' }}
2800
+ with :
2801
+ name : archive splunk ${{ matrix.splunk.version }}${{ secrets.OTHER_TA_REQUIRED_CONFIGS }} ${{ env.TEST_TYPE }} ${{ matrix.vendor-version.image }} tests diag
2802
+ path : |
2803
+ ${{ needs.setup.outputs.directory-path }}/diag*
2804
+
2805
+ upgrade-tests-report :
2806
+ needs : run-upgrade-tests
2807
+ runs-on : ubuntu-latest
2808
+ if : ${{ !cancelled() && needs.run-upgrade-tests.result != 'skipped' }}
2809
+ steps :
2810
+ - name : Download all summaries
2811
+ uses : actions/download-artifact@v4
2812
+ with :
2813
+ pattern : summary-upgrade*
2814
+ - name : Combine summaries into a table
2815
+ run : |
2816
+ echo "| Job | Total Tests | Passed Tests | Failed Tests | Errored Tests | Skipped Tests | Report Link" >> "$GITHUB_STEP_SUMMARY"
2817
+ echo "| ---------- | ----------- | ------ | ------ | ------ | ------- | ------ |" >> "$GITHUB_STEP_SUMMARY"
2818
+ for file in summary-upgrade*/job_summary.txt; do
2819
+ cat "$file" >> "$GITHUB_STEP_SUMMARY"
2820
+ done
2821
+ - uses : geekyeggo/delete-artifact@v5
2822
+ with :
2823
+ name : |
2824
+ summary-upgrade*
2541
2825
2542
2826
run-scripted-input-tests-full-matrix :
2543
2827
if : ${{ !cancelled() && needs.build.result == 'success' && needs.test-inventory.outputs.scripted_inputs == 'true' && needs.setup-workflow.outputs.execute-scripted_inputs-labeled == 'true' }}
0 commit comments