chore: backport 20251208 #832
Workflow file for this run
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: Fleet Agent Compatibility Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release-* | |
| workflow_dispatch: | |
| inputs: | |
| beforeTagOrCommit: | |
| description: 'The tag or commit to build the before upgrade version of the Fleet agents from; if not specified, the latest tag will be used' | |
| required: false | |
| 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 | |
| hub-agent-backward-compatibility: | |
| 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] | |
| with: | |
| # Fetch the history of all branches and tags. | |
| # This is needed for the test suite to switch between releases. | |
| fetch-depth: 0 | |
| - 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: Set up Ginkgo CLI | |
| run: | | |
| go install github.com/onsi/ginkgo/v2/[email protected] | |
| - name: Travel back in time to the before upgrade version | |
| run: | | |
| GIT_TAG="${{ github.event.inputs.beforeTagOrCommit }}" | |
| CURRENT_BRANCH=$(git branch --show-current) | |
| CURRENT_BRANCH=$(git rev-parse HEAD) | |
| echo "Current at branch $CURRENT_BRANCH, commit $CURRENT_BRANCH." | |
| echo "CURRENT_BRANCH=$CURRENT_BRANCH" >> "$GITHUB_ENV" | |
| if [ -z "${GIT_TAG}" ] | |
| then | |
| echo "No tag is specified; go back to the state tracked by the last known tag." | |
| echo "Fetch all tags..." | |
| git fetch --all | |
| GIT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) | |
| else | |
| echo "A tag is specified; go back to the state tracked by the specified tag." | |
| echo "Fetch all tags..." | |
| git fetch --all | |
| fi | |
| git checkout $GIT_TAG | |
| echo "Checked out source code at $GIT_TAG." | |
| - name: Prepare the fleet using the before upgrade version | |
| # Set up the Fleet using images built the older source code but with the current setup script. | |
| # | |
| # Note that the `git checkout` command below only checks out the `test/upgrade` directory (at | |
| # the current commit); the rest of the source code is still at the before-upgrade version. | |
| run: | | |
| git checkout $CURRENT_BRANCH -- test/upgrade | |
| cd test/upgrade && chmod +x setup.sh && cd - | |
| ./test/upgrade/setup.sh 3 | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| HUB_SERVER_URL: 'https://172.19.0.2:6443' | |
| - name: Travel to the current state | |
| # Run the test suite from the current version, i.e., the commit that triggered the workflow. | |
| run: | | |
| git checkout $CURRENT_BRANCH | |
| echo "Checked out source code at $CURRENT_BRANCH." | |
| - name: Run the Before suite | |
| run: cd test/upgrade/before && ginkgo -v -p . && cd - | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| - name: Upgrade the Fleet hub agent to the after upgrade version | |
| run: | | |
| cd test/upgrade && chmod +x upgrade.sh && cd - | |
| UPGRADE_HUB_SIDE=true ./test/upgrade/upgrade.sh 3 | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| - name: Run the After suite | |
| run: cd test/upgrade/after && ginkgo -v -p . && cd - | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| member-agent-backward-compatibility: | |
| 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] | |
| with: | |
| # Fetch the history of all branches and tags. | |
| # This is needed for the test suite to switch between releases. | |
| fetch-depth: 0 | |
| - 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: Set up Ginkgo CLI | |
| run: | | |
| go install github.com/onsi/ginkgo/v2/[email protected] | |
| - name: Travel back in time to the before upgrade version | |
| run: | | |
| GIT_TAG="${{ github.event.inputs.beforeTagOrCommit }}" | |
| CURRENT_BRANCH=$(git branch --show-current) | |
| CURRENT_BRANCH=$(git rev-parse HEAD) | |
| echo "Current at branch $CURRENT_BRANCH, commit $CURRENT_BRANCH." | |
| echo "CURRENT_BRANCH=$CURRENT_BRANCH" >> "$GITHUB_ENV" | |
| if [ -z "${GIT_TAG}" ] | |
| then | |
| echo "No tag is specified; go back to the state tracked by the last known tag." | |
| echo "Fetch all tags..." | |
| git fetch --all | |
| GIT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) | |
| else | |
| echo "A tag is specified; go back to the state tracked by the specified tag." | |
| echo "Fetch all tags..." | |
| git fetch --all | |
| fi | |
| git checkout $GIT_TAG | |
| echo "Checked out source code at $GIT_TAG." | |
| - name: Prepare the fleet using the before upgrade version | |
| # Set up the Fleet using images built the older source code but with the current setup script. | |
| # | |
| # Note that the `git checkout` command below only checks out the `test/upgrade` directory (at | |
| # the current commit); the rest of the source code is still at the before-upgrade version. | |
| run: | | |
| git checkout $CURRENT_BRANCH -- test/upgrade | |
| cd test/upgrade && chmod +x setup.sh && cd - | |
| ./test/upgrade/setup.sh 3 | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| HUB_SERVER_URL: 'https://172.19.0.2:6443' | |
| - name: Travel to the current state | |
| # Run the test suite from the current version, i.e., the commit that triggered the workflow. | |
| run: | | |
| git checkout $CURRENT_BRANCH | |
| echo "Checked out source code at $CURRENT_BRANCH." | |
| - name: Run the Before suite | |
| run: cd test/upgrade/before && ginkgo -v -p . && cd - | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| - name: Upgrade the Fleet member agent | |
| run: | | |
| cd test/upgrade && chmod +x upgrade.sh && cd - | |
| UPGRADE_MEMBER_SIDE=true ./test/upgrade/upgrade.sh 3 | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| - name: Run the After suite | |
| run: cd test/upgrade/after && ginkgo -v -p . && cd - | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| full-backward-compatibility: | |
| 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] | |
| with: | |
| # Fetch the history of all branches and tags. | |
| # This is needed for the test suite to switch between releases. | |
| fetch-depth: 0 | |
| - 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: Set up Ginkgo CLI | |
| run: | | |
| go install github.com/onsi/ginkgo/v2/[email protected] | |
| - name: Travel back in time to the before upgrade version | |
| run: | | |
| GIT_TAG="${{ github.event.inputs.beforeTagOrCommit }}" | |
| CURRENT_BRANCH=$(git branch --show-current) | |
| CURRENT_BRANCH=$(git rev-parse HEAD) | |
| echo "Current at branch $CURRENT_BRANCH, commit $CURRENT_BRANCH." | |
| echo "CURRENT_BRANCH=$CURRENT_BRANCH" >> "$GITHUB_ENV" | |
| if [ -z "${GIT_TAG}" ] | |
| then | |
| echo "No tag is specified; go back to the state tracked by the last known tag." | |
| echo "Fetch all tags..." | |
| git fetch --all | |
| GIT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) | |
| else | |
| echo "A tag is specified; go back to the state tracked by the specified tag." | |
| echo "Fetch all tags..." | |
| git fetch --all | |
| fi | |
| git checkout $GIT_TAG | |
| echo "Checked out source code at $GIT_TAG." | |
| - name: Prepare the fleet using the before upgrade version | |
| # Set up the Fleet using images built the older source code but with the current setup script. | |
| # | |
| # Note that the `git checkout` command below only checks out the `test/upgrade` directory (at | |
| # the current commit); the rest of the source code is still at the before-upgrade version. | |
| run: | | |
| git checkout $CURRENT_BRANCH -- test/upgrade | |
| cd test/upgrade && chmod +x setup.sh && cd - | |
| ./test/upgrade/setup.sh 3 | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| HUB_SERVER_URL: 'https://172.19.0.2:6443' | |
| - name: Travel to the current state | |
| # Run the test suite from the current version, i.e., the commit that triggered the workflow. | |
| run: | | |
| git checkout $CURRENT_BRANCH | |
| echo "Checked out source code at $CURRENT_BRANCH." | |
| - name: Run the Before suite | |
| run: cd test/upgrade/before && ginkgo -v -p . && cd - | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| - name: Upgrade all Fleet agents | |
| run: | | |
| cd test/upgrade && chmod +x upgrade.sh && cd - | |
| UPGRADE_HUB_SIDE=true UPGRADE_MEMBER_SIDE=true ./test/upgrade/upgrade.sh 3 | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| - name: Run the After suite | |
| run: cd test/upgrade/after && ginkgo -v -p . && cd - | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' |