chore: Backport changes from kubefleet repo 6/3 #384
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 baseline tag or commit to build Fleet agents from; if not specified, the latest tag will be used' | |
| required: false | |
| afterTagOrCommit: | |
| description: 'The new tag or commit to build Fleet agents from; if not specified, the last commit in the codebase (PR or branch) will be used' | |
| required: false | |
| pull_request: | |
| branches: | |
| - main | |
| - release-* | |
| paths-ignore: [docs/**, "**.md", "**.mdx", "**.png", "**.jpg"] | |
| env: | |
| GO_VERSION: '1.23.8' | |
| jobs: | |
| detect-noop: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| noop: ${{ steps.noop.outputs.should_skip }} | |
| steps: | |
| - name: Detect No-op Changes | |
| id: noop | |
| uses: fkirc/skip-duplicate-actions@v5.3.1 | |
| 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@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Check out code into the Go module directory | |
| uses: actions/checkout@v4 | |
| with: | |
| # Fetch the history of all branches and tags. | |
| # This is needed for the test suite to switch between releases. | |
| fetch-depth: 0 | |
| - name: Set up Ginkgo CLI | |
| run: | | |
| go install github.com/onsi/ginkgo/v2/ginkgo@v2.19.1 | |
| - name: Travel back in time to the before upgrade version | |
| run: | | |
| GIT_TAG="${{ github.event.inputs.beforeTagOrCommit }}" | |
| PREVIOUS_BRANCH=$(git branch --show-current) | |
| PREVIOUS_COMMIT=$(git rev-parse HEAD) | |
| echo "Current at branch $PREVIOUS_BRANCH, commit $PREVIOUS_COMMIT." | |
| echo "PREVIOUS_COMMIT=$PREVIOUS_COMMIT" >> "$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 | |
| run: cd test/upgrade && chmod +x setup.sh && ./setup.sh 3 && cd - | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| HUB_SERVER_URL: 'https://172.19.0.2:6443' | |
| - name: Travel to the current state | |
| # Note: Fleet always uses the version compatibility test suite from the | |
| # baseline commit, i.e., the commit that triggers the workflow. | |
| run: | | |
| echo "Returning to the current state..." | |
| git checkout $PREVIOUS_COMMIT | |
| echo "Checked out source code at $PREVIOUS_COMMIT." | |
| - name: Run the Before suite | |
| run: cd test/upgrade/before && ginkgo -v -p . && cd - | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| - name: Travel back in time to the after upgrade version | |
| run: | | |
| GIT_TAG="${{ github.event.inputs.afterTagOrCommit }}" | |
| PREVIOUS_BRANCH=$(git branch --show-current) | |
| PREVIOUS_COMMIT=$(git rev-parse HEAD) | |
| echo "Current at branch $PREVIOUS_BRANCH, commit $PREVIOUS_COMMIT." | |
| if [ -z "${GIT_TAG}" ] | |
| then | |
| echo "No tag is specified; go back to the current state." | |
| else | |
| echo "A tag is specified; go back to the state tracked by the specified tag." | |
| echo "Fetch all tags..." | |
| git fetch --all | |
| git checkout $GIT_TAG | |
| echo "Checked out source code at $GIT_TAG." | |
| fi | |
| - name: Upgrade the Fleet hub agent to the after upgrade version | |
| run: cd test/upgrade && chmod +x upgrade.sh && UPGRADE_HUB_SIDE=true ./upgrade.sh 3 && cd - | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| - name: Travel to the current state | |
| # Note: Fleet always uses the version compatibility test suite from the | |
| # baseline commit, i.e., the commit that triggers the workflow. | |
| run: | | |
| echo "Returning to the current state..." | |
| git checkout $PREVIOUS_COMMIT | |
| echo "Checked out source code at $PREVIOUS_COMMIT." | |
| - 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@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Check out code into the Go module directory | |
| uses: actions/checkout@v4 | |
| with: | |
| # Fetch the history of all branches and tags. | |
| # This is needed for the test suite to switch between releases. | |
| fetch-depth: 0 | |
| - name: Set up Ginkgo CLI | |
| run: | | |
| go install github.com/onsi/ginkgo/v2/ginkgo@v2.19.1 | |
| - name: Travel back in time to the before upgrade version | |
| run: | | |
| GIT_TAG="${{ github.event.inputs.beforeTagOrCommit }}" | |
| PREVIOUS_BRANCH=$(git branch --show-current) | |
| PREVIOUS_COMMIT=$(git rev-parse HEAD) | |
| echo "Current at branch $PREVIOUS_BRANCH, commit $PREVIOUS_COMMIT." | |
| echo "PREVIOUS_COMMIT=$PREVIOUS_COMMIT" >> "$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 | |
| run: cd test/upgrade && chmod +x setup.sh && ./setup.sh 3 && cd - | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| HUB_SERVER_URL: 'https://172.19.0.2:6443' | |
| - name: Travel to the current state | |
| # Note: Fleet always uses the version compatibility test suite from the | |
| # baseline commit, i.e., the commit that triggers the workflow. | |
| run: | | |
| echo "Returning to the current state..." | |
| git checkout $PREVIOUS_COMMIT | |
| echo "Checked out source code at $PREVIOUS_COMMIT." | |
| - name: Run the Before suite | |
| run: cd test/upgrade/before && ginkgo -v -p . && cd - | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| - name: Travel back in time to the after upgrade version | |
| run: | | |
| GIT_TAG="${{ github.event.inputs.afterTagOrCommit }}" | |
| PREVIOUS_BRANCH=$(git branch --show-current) | |
| PREVIOUS_COMMIT=$(git rev-parse HEAD) | |
| echo "Current at branch $PREVIOUS_BRANCH, commit $PREVIOUS_COMMIT." | |
| if [ -z "${GIT_TAG}" ] | |
| then | |
| echo "No tag is specified; go back to the current state." | |
| else | |
| echo "A tag is specified; go back to the state tracked by the specified tag." | |
| echo "Fetch all tags..." | |
| git fetch --all | |
| git checkout $GIT_TAG | |
| echo "Checked out source code at $GIT_TAG." | |
| fi | |
| - name: Upgrade the Fleet member agent | |
| run: cd test/upgrade && chmod +x upgrade.sh && UPGRADE_MEMBER_SIDE=true ./upgrade.sh 3 && cd - | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| - name: Travel to the current state | |
| # Note: Fleet always uses the version compatibility test suite from the | |
| # baseline commit, i.e., the commit that triggers the workflow. | |
| run: | | |
| echo "Returning to the current state..." | |
| git checkout $PREVIOUS_COMMIT | |
| echo "Checked out source code at $PREVIOUS_COMMIT." | |
| - 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@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Check out code into the Go module directory | |
| uses: actions/checkout@v4 | |
| with: | |
| # Fetch the history of all branches and tags. | |
| # This is needed for the test suite to switch between releases. | |
| fetch-depth: 0 | |
| - name: Set up Ginkgo CLI | |
| run: | | |
| go install github.com/onsi/ginkgo/v2/ginkgo@v2.19.1 | |
| - name: Travel back in time to the before upgrade version | |
| run: | | |
| GIT_TAG="${{ github.event.inputs.beforeTagOrCommit }}" | |
| PREVIOUS_BRANCH=$(git branch --show-current) | |
| PREVIOUS_COMMIT=$(git rev-parse HEAD) | |
| echo "Current at branch $PREVIOUS_BRANCH, commit $PREVIOUS_COMMIT." | |
| echo "PREVIOUS_COMMIT=$PREVIOUS_COMMIT" >> "$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 | |
| run: cd test/upgrade && chmod +x setup.sh && ./setup.sh 3 && cd - | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| HUB_SERVER_URL: 'https://172.19.0.2:6443' | |
| - name: Travel to the current state | |
| # Note: Fleet always uses the version compatibility test suite from the | |
| # baseline commit, i.e., the commit that triggers the workflow. | |
| run: | | |
| echo "Returning to the current state..." | |
| git checkout $PREVIOUS_COMMIT | |
| echo "Checked out source code at $PREVIOUS_COMMIT." | |
| - name: Run the Before suite | |
| run: cd test/upgrade/before && ginkgo -v -p . && cd - | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| - name: Travel back in time to the after upgrade version | |
| run: | | |
| GIT_TAG="${{ github.event.inputs.afterTagOrCommit }}" | |
| PREVIOUS_BRANCH=$(git branch --show-current) | |
| PREVIOUS_COMMIT=$(git rev-parse HEAD) | |
| echo "Current at branch $PREVIOUS_BRANCH, commit $PREVIOUS_COMMIT." | |
| if [ -z "${GIT_TAG}" ] | |
| then | |
| echo "No tag is specified; go back to the current state." | |
| else | |
| echo "A tag is specified; go back to the state tracked by the specified tag." | |
| echo "Fetch all tags..." | |
| git fetch --all | |
| git checkout $GIT_TAG | |
| echo "Checked out source code at $GIT_TAG." | |
| fi | |
| - name: Upgrade all Fleet agents | |
| run: cd test/upgrade && GIT_TAG="${{ github.event.inputs.afterTagOrCommit }}" chmod +x upgrade.sh && UPGRADE_HUB_SIDE=true UPGRADE_MEMBER_SIDE=true ./upgrade.sh 3 && cd - | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' | |
| - name: Travel to the current state | |
| # Note: Fleet always uses the version compatibility test suite from the | |
| # baseline commit, i.e., the commit that triggers the workflow. | |
| run: | | |
| echo "Returning to the current state..." | |
| git checkout $PREVIOUS_COMMIT | |
| echo "Checked out source code at $PREVIOUS_COMMIT." | |
| - name: Run the After suite | |
| run: cd test/upgrade/after && ginkgo -v -p . && cd - | |
| env: | |
| KUBECONFIG: '/home/runner/.kube/config' |