chore: backport 20251208 (#1242) #5229
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release-* | |
| workflow_dispatch: {} | |
| pull_request: | |
| branches: | |
| - main | |
| - release-* | |
| paths-ignore: [docs/**, "**.md", "**.mdx", "**.png", "**.jpg"] | |
| env: | |
| GO_VERSION: '1.24.9' | |
| jobs: | |
| detect-noop: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| noop: ${{ steps.noop.outputs.should_skip }} | |
| steps: | |
| - name: Detect No-op Changes | |
| id: noop | |
| uses: fkirc/[email protected] | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| do_not_skip: '["workflow_dispatch", "schedule", "push"]' | |
| concurrent_skipping: false | |
| unit-tests: | |
| runs-on: ubuntu-latest | |
| needs: detect-noop | |
| if: needs.detect-noop.outputs.noop != 'true' | |
| steps: | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Check out code into the Go module directory | |
| uses: actions/[email protected] | |
| - name: Set up Ginkgo CLI | |
| run: | | |
| go install github.com/onsi/ginkgo/v2/[email protected] | |
| - name: Run unit tests & Generate coverage | |
| run: make test | |
| - name: Upload Codecov report | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| ## Repository upload token - get it from codecov.io. Required only for private repositories | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| ## Comma-separated list of files to upload | |
| files: ./ut-coverage.xml | |
| e2e-tests: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| customized-settings: [default, resourceplacement, joinleave, custom] | |
| include: | |
| - customized-settings: default | |
| # to shorten the test duration, set the resource snapshot creation interval to 0 | |
| resource-snapshot-creation-minimum-interval: 0m | |
| resource-changes-collection-duration: 0m | |
| - customized-settings: resourceplacement | |
| # to shorten the test duration, set the resource snapshot creation interval to 0 | |
| resource-snapshot-creation-minimum-interval: 0m | |
| resource-changes-collection-duration: 0m | |
| - customized-settings: joinleave | |
| # to shorten the test duration, set the resource snapshot creation interval to 0 | |
| resource-snapshot-creation-minimum-interval: 0m | |
| resource-changes-collection-duration: 0m | |
| - customized-settings: custom | |
| resource-snapshot-creation-minimum-interval: 30s | |
| resource-changes-collection-duration: 15s | |
| runs-on: ubuntu-latest | |
| needs: [ | |
| detect-noop, | |
| ] | |
| if: needs.detect-noop.outputs.noop != 'true' | |
| steps: | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Check out code into the Go module directory | |
| uses: actions/[email protected] | |
| - name: Move Docker data directory to /mnt | |
| # The default storage device on GitHub-hosted runners is running low during e2e tests. | |
| # Moving Docker data directory to /mnt which has more space and is backed by a larger | |
| # storage device. | |
| # Upstream kubefleet repo has a much bigger default storage device and no secondary | |
| # storage device to use. | |
| run: | | |
| echo "=== Moving Docker to /mnt for more disk space ===" | |
| df -h | |
| sudo systemctl stop docker | |
| echo '{"data-root": "/mnt/docker"}' | sudo tee /etc/docker/daemon.json | |
| sudo mkdir -p /mnt/docker | |
| if [ -d "/var/lib/docker" ]; then | |
| sudo mv /var/lib/docker/* /mnt/docker/ || true | |
| fi | |
| sudo systemctl start docker | |
| echo "=== Docker moved to /mnt, verifying ===" | |
| docker info | grep "Docker Root Dir" || true | |
| - name: Install Ginkgo CLI | |
| run: | | |
| go install github.com/onsi/ginkgo/v2/[email protected] | |
| - name: Install Kind | |
| # Before updating the kind version to use, verify that the current kind image | |
| # is still supported by the version. | |
| run: | | |
| go install sigs.k8s.io/[email protected] | |
| - name: Run e2e tests | |
| run: | | |
| if [ "${{ matrix.customized-settings }}" = "default" ]; then | |
| make e2e-tests LABEL_FILTER="!custom && !joinleave && !resourceplacement" | |
| elif [ "${{ matrix.customized-settings }}" = "resourceplacement" ]; then | |
| make e2e-tests LABEL_FILTER="!custom && resourceplacement" | |
| elif [ "${{ matrix.customized-settings }}" = "joinleave" ]; then | |
| make e2e-tests LABEL_FILTER="!custom && joinleave" | |
| else | |
| make e2e-tests-custom | |
| fi | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| HUB_SERVER_URL: 'https://172.19.0.2:6443' | |
| # Temporarily enable the AKS property provider for the E2E tests, in order | |
| # to verify the property-based scheduling experience. | |
| # | |
| # TO-DO (chenyu1): to ensure a vendor-neutral experience, switch to a dummy | |
| # property provider once the AKS one is split out. | |
| PROPERTY_PROVIDER: 'azure' | |
| RESOURCE_SNAPSHOT_CREATION_MINIMUM_INTERVAL: ${{ matrix.resource-snapshot-creation-minimum-interval }} | |
| RESOURCE_CHANGES_COLLECTION_DURATION: ${{ matrix.resource-changes-collection-duration }} | |
| - name: Collect logs | |
| if: always() | |
| # Wait for a bit before log collection; this gives the agent pods some time to shut down | |
| # gracefully and flush their logs. | |
| run: | | |
| sleep 30 | |
| make collect-e2e-logs | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| LOG_DIR: 'logs-${{ matrix.customized-settings }}' | |
| - name: Upload logs | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: e2e-logs-${{ matrix.customized-settings }} | |
| path: test/e2e/logs-${{ matrix.customized-settings }}/ | |
| retention-days: 3 |