Skip to content

Commit

Permalink
Add workflow optionals
Browse files Browse the repository at this point in the history
  • Loading branch information
jvoravong committed Dec 18, 2024
1 parent 06f4045 commit 1c612b0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/functional_test_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ on:
branches: [ main ]
workflow_dispatch:
inputs:
UPDATE_EXPECTED_RESULTS:
description: 'Set this to true to update expected results and collect updated test output as a Github workflow artifact.'
UPLOAD_UPDATED_EXPECTED_RESULTS:
description: 'Set this to true to upload updated golden file expected results and upload these results as a Github workflow artifact.'
required: false
default: false
UPLOAD_K8S_DEBUG_INFO:
description: 'Set this to true to collect the debug info of the k8s cluster and upload this info as a Github workflow artifact.'
required: false

env:
# Make sure to exit early if cache segment download times out after 2 minutes.
Expand All @@ -20,7 +23,8 @@ jobs:
env:
KUBECONFIG: /tmp/kube-config-splunk-otel-collector-chart-functional-testing
KUBE_TEST_ENV: kind
UPDATE_EXPECTED_RESULTS: ${{ github.event.inputs.UPDATE_EXPECTED_RESULTS || 'false' }}
UPLOAD_UPDATED_EXPECTED_RESULTS: ${{ github.event.inputs.UPLOAD_UPDATED_EXPECTED_RESULTS || 'false' }}
UPLOAD_K8S_DEBUG_INFO: ${{ github.event.inputs.UPLOAD_K8S_DEBUG_INFO || 'false' }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -76,15 +80,15 @@ jobs:
K8S_VERSION: ${{ matrix.k8s-version }}
run: |
cd functional_tests
TEARDOWN_BEFORE_SETUP=true UPDATE_EXPECTED_RESULTS=${{ env.UPDATE_EXPECTED_RESULTS }} go test -v -tags ${{ matrix.test-job }}
TEARDOWN_BEFORE_SETUP=true UPDATE_EXPECTED_RESULTS=${{ env.UPLOAD_UPDATED_EXPECTED_RESULTS }} go test -v -tags ${{ matrix.test-job }}
- name: Collect Kubernetes Cluster debug info on failure
if: always() && steps.run-functional-tests.outcome == 'failure'
if: always() && (steps.run-functional-tests.outcome == 'failure' || env.UPLOAD_K8S_DEBUG_INFO == 'true')
id: collect-debug-info
run: |
echo "Functional tests failed. Collecting debug info for current state of the Kubernetes cluster..."
./tools/splunk_kubernetes_debug_info.sh
- name: 'Upload Kubernetes Cluster debug info'
if: always() && steps.collect-debug-info.outcome == 'success'
if: always() && (steps.run-functional-tests.outcome == 'failure' || env.UPLOAD_K8S_DEBUG_INFO == 'true')
uses: actions/upload-artifact@v4
with:
name: k8s-debug-info-${{ matrix.test-job }}-${{ matrix.k8s-version }}
Expand Down

0 comments on commit 1c612b0

Please sign in to comment.