|
| 1 | +name: advanced-features-tests |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "15 6 * * 1" # Run at 6:15 AM on every Monday UTC to avoid peak times |
| 6 | + # Allow manual trigger on any branch |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + integration-tests-advanced-features: |
| 11 | + runs-on: ubuntu-latest-4-core |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + provider: [k3d, kind] |
| 16 | + timeout-minutes: 120 |
| 17 | + permissions: |
| 18 | + contents: read |
| 19 | + id-token: write |
| 20 | + env: |
| 21 | + GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + - name: Setup Go |
| 25 | + uses: actions/setup-go@v5 |
| 26 | + with: |
| 27 | + go-version: 1.23 |
| 28 | + - name: Authenticate to Google Cloud |
| 29 | + uses: 'google-github-actions/auth@v2' |
| 30 | + id: auth |
| 31 | + with: |
| 32 | + token_format: access_token |
| 33 | + project_id: 'cockroach-helm-testing' |
| 34 | + workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} |
| 35 | + service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} |
| 36 | + - name: Set up gcloud CLI |
| 37 | + uses: google-github-actions/setup-gcloud@v2 |
| 38 | + - name: Install gke-gcloud-auth-plugin |
| 39 | + run: | |
| 40 | + gcloud components install gke-gcloud-auth-plugin |
| 41 | + - name: Run tests (advanced features) |
| 42 | + env: |
| 43 | + PROVIDER: ${{ matrix.provider }} |
| 44 | + TEST_ADVANCED_FEATURES: true |
| 45 | + USE_GKE_GCLOUD_AUTH_PLUGIN: True |
| 46 | + run: | |
| 47 | + set -euo pipefail |
| 48 | + make test/nightly-e2e/advanced | tee test_output.log |
| 49 | + - name: Archive test results |
| 50 | + if: ${{ always() }} |
| 51 | + uses: actions/upload-artifact@v4 |
| 52 | + with: |
| 53 | + name: advanced-features-test-results-${{ matrix.provider }} |
| 54 | + path: | |
| 55 | + test_output.log |
| 56 | + test_output.json |
| 57 | + - name: Slack notification (advanced features) |
| 58 | + if: ${{ always() }} |
| 59 | + run: | |
| 60 | + echo "Preparing Slack message for advanced features tests..." |
| 61 | +
|
| 62 | + if [ ! -f test_output.json ]; then |
| 63 | + echo "Generating test_output.json from log..." |
| 64 | + grep -E "=== RUN|--- PASS:|--- FAIL:" test_output.log | awk ' |
| 65 | + /=== RUN/ { |
| 66 | + test_name = $3 |
| 67 | + tests[test_name] = "running" |
| 68 | + } |
| 69 | + /--- PASS:/ { |
| 70 | + test_name = $3 |
| 71 | + if (test_name in tests) { |
| 72 | + print "{\"Action\":\"pass\",\"Test\":\"" test_name "\"}" |
| 73 | + } |
| 74 | + } |
| 75 | + /--- FAIL:/ { |
| 76 | + test_name = $3 |
| 77 | + if (test_name in tests) { |
| 78 | + print "{\"Action\":\"fail\",\"Test\":\"" test_name "\"}" |
| 79 | + } |
| 80 | + }' > test_output.json |
| 81 | + fi |
| 82 | +
|
| 83 | + PASSED_TESTS=$(jq -r 'select(.Action=="pass") | .Test' test_output.json | sed 's|.*/||' | grep '^Test' | grep -v '^TestOperatorIn' | sort | uniq | head -n 20 | paste -sd ", " -) |
| 84 | + FAILED_TESTS=$(jq -r 'select(.Action=="fail") | .Test' test_output.json | sed 's|.*/||' | grep '^Test' | grep -v '^TestOperatorIn' | sort | uniq | head -n 20 | paste -sd ", " -) |
| 85 | + PASSED_COUNT=$(jq -r 'select(.Action=="pass") | .Test' test_output.json | sed 's|.*/||' | grep '^Test' | grep -v '^TestOperatorIn' | sort | uniq | wc -l) |
| 86 | + FAILED_COUNT=$(jq -r 'select(.Action=="fail") | .Test' test_output.json | sed 's|.*/||' | grep '^Test' | grep -v '^TestOperatorIn' | sort | uniq | wc -l) |
| 87 | +
|
| 88 | + if [ "$FAILED_COUNT" -gt 0 ]; then |
| 89 | + STATUS="❌ *Advanced features integration tests failed!*" |
| 90 | + COLOR="#ff0000" |
| 91 | + else |
| 92 | + STATUS="✅ *Advanced features integration tests passed!*" |
| 93 | + COLOR="#36a64f" |
| 94 | + fi |
| 95 | +
|
| 96 | + REPO_NAME="helm-charts" |
| 97 | +
|
| 98 | + PAYLOAD=$(jq -n \ |
| 99 | + --arg text "$STATUS" \ |
| 100 | + --arg color "$COLOR" \ |
| 101 | + --arg repo "$REPO_NAME" \ |
| 102 | + --arg branch "${{ github.ref_name }}" \ |
| 103 | + --arg workflow "${{ github.workflow }}" \ |
| 104 | + --arg provider "${{ matrix.provider }}" \ |
| 105 | + --arg url "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ |
| 106 | + --arg passed "$PASSED_COUNT" \ |
| 107 | + --arg failed "$FAILED_COUNT" \ |
| 108 | + --arg passed_tests "$PASSED_TESTS" \ |
| 109 | + --arg failed_tests "$FAILED_TESTS" \ |
| 110 | + '{ |
| 111 | + text: $text, |
| 112 | + attachments: [ |
| 113 | + { |
| 114 | + color: $color, |
| 115 | + fields: [ |
| 116 | + {"title": "Repository", "value": $repo, "short": true}, |
| 117 | + {"title": "Branch", "value": $branch, "short": true}, |
| 118 | + {"title": "Provider", "value": $provider, "short": true}, |
| 119 | + {"title": "✅ Passed", "value": $passed, "short": true}, |
| 120 | + {"title": "❌ Failed", "value": $failed, "short": true}, |
| 121 | + {"title": "❌ Failed Tests", "value": (if $failed_tests == "" then "None" else $failed_tests end), "short": false}, |
| 122 | + {"title": "✅ Passed Tests", "value": (if $passed_tests == "" then "None" else $passed_tests end), "short": false}, |
| 123 | + {"title": "Run URL", "value": $url, "short": false} |
| 124 | + ] |
| 125 | + } |
| 126 | + ] |
| 127 | + }') |
| 128 | +
|
| 129 | + curl -X POST -H 'Content-type: application/json' \ |
| 130 | + --data "$PAYLOAD" \ |
| 131 | + "${{ secrets.SLACK_WEBHOOK_URL }}" |
0 commit comments