Merge pull request #9167 from csrwng/cewong/make-global-pull-secret-e… #366
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Envtest Vanilla Kube API Validation (Reusable) | |
| on: | |
| workflow_call: | |
| push: | |
| branches: | |
| - main | |
| - release-4.22 | |
| permissions: | |
| contents: read | |
| jobs: | |
| changes: | |
| name: Detect Changes | |
| runs-on: arc-runner-set | |
| outputs: | |
| should_run: ${{ steps.check.outputs.should_run }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Check for relevant file changes | |
| id: check | |
| env: | |
| PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| PUSH_BEFORE_SHA: ${{ github.event.before }} | |
| run: | | |
| set -euo pipefail | |
| if [ -n "${PR_BASE_SHA:-}" ] && [ -n "${PR_HEAD_SHA:-}" ]; then | |
| ref="${PR_BASE_SHA}...${PR_HEAD_SHA}" | |
| elif [ -n "${PUSH_BEFORE_SHA:-}" ] && [ "$PUSH_BEFORE_SHA" != "0000000000000000000000000000000000000000" ]; then | |
| ref="${PUSH_BEFORE_SHA}..HEAD" | |
| else | |
| echo "should_run=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| if git diff --name-only "$ref" | grep -qE '^(api/|test/envtest/|cmd/install/assets/crds/hypershift-operator/tests/|karpenter-operator/controllers/karpenter/assets/tests/|\.github/workflows/envtest-kube(-reusable)?\.yaml$)'; then | |
| echo "should_run=true" | |
| else | |
| echo "should_run=false" | |
| fi >> "$GITHUB_OUTPUT" | |
| envtest-kube: | |
| name: Envtest Vanilla Kube ${{ matrix.version }} | |
| needs: changes | |
| if: needs.changes.outputs.should_run == 'true' | |
| runs-on: arc-runner-set | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ["1.31.0", "1.32.0", "1.33.0", "1.34.0", "1.35.0"] | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - run: make test-envtest-kube ENVTEST_KUBE_VERSIONS="${{ matrix.version }}" | |
| conclusion: | |
| name: Conclusion | |
| needs: | |
| - changes | |
| - envtest-kube | |
| if: always() | |
| runs-on: arc-runner-set | |
| steps: | |
| - name: Aggregate results | |
| run: | | |
| changes_result="${{ needs.changes.result }}" | |
| envtest_result="${{ needs.envtest-kube.result }}" | |
| if [ "$changes_result" != "success" ]; then | |
| echo "Change detection failed: $changes_result" | |
| exit 1 | |
| fi | |
| if [ "$envtest_result" = "success" ] || [ "$envtest_result" = "skipped" ]; then | |
| echo "All envtest jobs passed or were skipped" | |
| exit 0 | |
| else | |
| echo "Envtest jobs failed: $envtest_result" | |
| exit 1 | |
| fi |