mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-08-16 04:06:06 +00:00
* Fix ResourceDeletionStatusTracker key Kind mismatch in terminating-namespace wait (#9987) EnsureNamespaceExistsAndIsReady wrote the tracker key with namespace.Kind (getNamespace() sets Kind=Namespace) but read it with clusterNS.Kind (client.Get strips TypeMeta -> Kind=empty). The keys never matched, so the skip-path never fired and every item in a terminating namespace paid the full --terminating-resource-timeout wait (per-resource instead of per-namespace). Use the passed-in namespace object for Contains so Add/Contains keys match. Add a regression test that reproduces the production Kind divergence. Signed-off-by: Shashank1306s <shashasingh@microsoft.com> Co-authored-by: Shashank1306s <shashasingh@microsoft.com> Co-authored-by: Priyansh Choudhary <im1706@gmail.com> (cherry picked from commitde32d93b8e) * Rename changelog to match backport PR number 10163 hack/changelog-check.sh requires changelogs/unreleased/<current PR number>-*, so the backport needs the backport PR's number rather than the original PR's (#9987). Signed-off-by: Shashank1306s <shashasingh@microsoft.com> * Pin e2e third-party clones to reviewed commits Pin bitnami/containers and distributed-data-generator to fixed SHAs instead of building default-branch HEAD, and add a minimal permissions block. Signed-off-by: chlins <chlins.zhang@gmail.com> (cherry picked from commit02fe822860) * bump the setup kind action update kind setup action to helm/kind-action@v1 and use FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true to suppress warning. Also set cluster_name: "kind" (helm/kind-action defaults to "chart-testing"), matching the follow-up made on main. Signed-off-by: Adam Zhang <adam.zhang@broadcom.com> (cherry picked from commit7627223d0f) --------- Signed-off-by: Shashank1306s <shashasingh@microsoft.com> Signed-off-by: chlins <chlins.zhang@gmail.com> Signed-off-by: Adam Zhang <adam.zhang@broadcom.com> Co-authored-by: Shashank1306s <shashasingh@microsoft.com> Co-authored-by: Priyansh Choudhary <im1706@gmail.com> Co-authored-by: chlins <chlins.zhang@gmail.com> Co-authored-by: Adam Zhang <adam.zhang@broadcom.com>
191 lines
8.0 KiB
YAML
191 lines
8.0 KiB
YAML
name: "Run the E2E test on kind"
|
|
permissions:
|
|
contents: read
|
|
env:
|
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
# Reviewed commit pins for third-party sources this workflow clones and executes.
|
|
# Bump them deliberately after reviewing the upstream changes.
|
|
# bitnami/containers: [bitnami/minio] Release 2026.7.17-debian-12-r0
|
|
BITNAMI_CONTAINERS_COMMIT: 19fb570e551f15ab0c8264aafa93774266761b8d
|
|
# vmware-tanzu-experiments/distributed-data-generator: main as of 2025-07-15
|
|
KIBISHII_COMMIT: bce0469e5f9dd33f31432fab22ff90ad6f2b45ca
|
|
on:
|
|
push:
|
|
pull_request:
|
|
# Do not run when the change only includes these directories.
|
|
paths-ignore:
|
|
- "site/**"
|
|
- "design/**"
|
|
- "**/*.md"
|
|
jobs:
|
|
# Build the Velero CLI and image once for all Kubernetes versions, and cache it so the fan-out workers can get it.
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out the code
|
|
uses: actions/checkout@v5
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: 'go.mod'
|
|
# Look for a CLI that's made for this PR
|
|
- name: Fetch built CLI
|
|
id: cli-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ./_output/bin/linux/amd64/velero
|
|
# The cache key a combination of the current PR number and the commit SHA
|
|
key: velero-cli-${{ github.event.pull_request.number }}-${{ github.sha }}
|
|
- name: Fetch built image
|
|
id: image-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ./velero.tar
|
|
# The cache key a combination of the current PR number and the commit SHA
|
|
key: velero-image-${{ github.event.pull_request.number }}-${{ github.sha }}
|
|
# If no binaries were built for this PR, build it now.
|
|
- name: Build Velero CLI
|
|
if: steps.cli-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
make local
|
|
# If no image were built for this PR, build it now.
|
|
- name: Build Velero Image
|
|
if: steps.image-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
IMAGE=velero VERSION=pr-test BUILD_OUTPUT_TYPE=docker make container
|
|
docker save velero:pr-test-linux-amd64 -o ./velero.tar
|
|
# Build the MinIO image once for all e2e tests, from the reviewed bitnami/containers commit.
|
|
- name: Cache MinIO Image
|
|
uses: actions/cache@v4
|
|
id: minio-cache
|
|
with:
|
|
path: ./minio-image.tar
|
|
key: minio-bitnami-${{ env.BITNAMI_CONTAINERS_COMMIT }}
|
|
- name: Build MinIO Image from Bitnami Dockerfile
|
|
if: steps.minio-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
set -euo pipefail
|
|
echo "Building MinIO image from Bitnami Dockerfile at ${BITNAMI_CONTAINERS_COMMIT}..."
|
|
git init -q /tmp/bitnami-containers
|
|
git -C /tmp/bitnami-containers remote add origin https://github.com/bitnami/containers.git
|
|
git -C /tmp/bitnami-containers fetch --depth 1 origin "${BITNAMI_CONTAINERS_COMMIT}"
|
|
git -C /tmp/bitnami-containers checkout -q "${BITNAMI_CONTAINERS_COMMIT}"
|
|
cd /tmp/bitnami-containers/bitnami/minio/2026/debian-12
|
|
docker build -t bitnami/minio:local .
|
|
docker save bitnami/minio:local > ${{ github.workspace }}/minio-image.tar
|
|
# Create json of k8s versions to test
|
|
# from guide: https://stackoverflow.com/a/65094398/4590470
|
|
setup-test-matrix:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
outputs:
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
steps:
|
|
- name: Set k8s versions
|
|
id: set-matrix
|
|
# everything excluding older tags. limits needs to be high enough to cover all latest versions
|
|
# and test labels
|
|
# grep -E "v[1-9]\.(2[5-9]|[3-9][0-9])" filters for v1.25 to v9.99
|
|
# and removes older patches of the same minor version
|
|
# awk -F. '{if(!a[$1"."$2]++)print $1"."$2"."$NF}'
|
|
run: |
|
|
echo "matrix={\
|
|
\"k8s\":$(wget -q -O - "https://hub.docker.com/v2/namespaces/kindest/repositories/node/tags?page_size=50" | grep -o '"name": *"[^"]*' | grep -o '[^"]*$' | grep -v -E "alpha|beta" | grep -E "v[1-9]\.(2[5-9]|[3-9][0-9])" | awk -F. '{if(!a[$1"."$2]++)print $1"."$2"."$NF}' | sort -r | sed s/v//g | jq -R -c -s 'split("\n")[:-1]'),\
|
|
\"labels\":[\
|
|
\"Basic && (ClusterResource || NodePort || StorageClass)\", \
|
|
\"ResourceFiltering && !Restic\", \
|
|
\"ResourceModifier || (Backups && BackupsSync) || PrivilegesMgmt || OrderedResources\", \
|
|
\"(NamespaceMapping && Single && Restic) || (NamespaceMapping && Multiple && Restic)\"\
|
|
]}" >> $GITHUB_OUTPUT
|
|
|
|
# Run E2E test against all Kubernetes versions on kind
|
|
run-e2e-test:
|
|
needs:
|
|
- build
|
|
- setup-test-matrix
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix: ${{fromJson(needs.setup-test-matrix.outputs.matrix)}}
|
|
fail-fast: false
|
|
steps:
|
|
- name: Check out the code
|
|
uses: actions/checkout@v5
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: 'go.mod'
|
|
# Fetch the pre-built MinIO image from the build job
|
|
- name: Fetch built MinIO Image
|
|
uses: actions/cache@v4
|
|
id: minio-cache
|
|
with:
|
|
path: ./minio-image.tar
|
|
key: minio-bitnami-${{ env.BITNAMI_CONTAINERS_COMMIT }}
|
|
- name: Load MinIO Image
|
|
run: |
|
|
echo "Loading MinIO image..."
|
|
docker load < ./minio-image.tar
|
|
- name: Install MinIO
|
|
run: |
|
|
docker run -d --rm -p 9000:9000 -e "MINIO_ROOT_USER=minio" -e "MINIO_ROOT_PASSWORD=minio123" -e "MINIO_DEFAULT_BUCKETS=bucket,additional-bucket" bitnami/minio:local
|
|
- uses: helm/kind-action@v1
|
|
with:
|
|
cluster_name: "kind"
|
|
version: "v0.32.0"
|
|
node_image: "kindest/node:v${{ matrix.k8s }}"
|
|
- name: Fetch built CLI
|
|
id: cli-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ./_output/bin/linux/amd64/velero
|
|
key: velero-cli-${{ github.event.pull_request.number }}-${{ github.sha }}
|
|
- name: Fetch built Image
|
|
id: image-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ./velero.tar
|
|
key: velero-image-${{ github.event.pull_request.number }}-${{ github.sha }}
|
|
- name: Load Velero Image
|
|
run:
|
|
kind load image-archive velero.tar
|
|
- name: Run E2E test
|
|
run: |
|
|
cat << EOF > /tmp/credential
|
|
[default]
|
|
aws_access_key_id=minio
|
|
aws_secret_access_key=minio123
|
|
EOF
|
|
|
|
# Match kubectl version to k8s server version
|
|
curl -LO https://dl.k8s.io/release/v${{ matrix.k8s }}/bin/linux/amd64/kubectl
|
|
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
|
|
|
|
git init -q /tmp/kibishii
|
|
git -C /tmp/kibishii remote add origin https://github.com/vmware-tanzu-experiments/distributed-data-generator.git
|
|
git -C /tmp/kibishii fetch --depth 1 origin "${KIBISHII_COMMIT}"
|
|
git -C /tmp/kibishii checkout -q "${KIBISHII_COMMIT}"
|
|
|
|
GOPATH=~/go \
|
|
CLOUD_PROVIDER=kind \
|
|
OBJECT_STORE_PROVIDER=aws \
|
|
BSL_CONFIG=region=minio,s3ForcePathStyle="true",s3Url=http://$(hostname -i):9000 \
|
|
CREDS_FILE=/tmp/credential \
|
|
BSL_BUCKET=bucket \
|
|
ADDITIONAL_OBJECT_STORE_PROVIDER=aws \
|
|
ADDITIONAL_BSL_CONFIG=region=minio,s3ForcePathStyle="true",s3Url=http://$(hostname -i):9000 \
|
|
ADDITIONAL_CREDS_FILE=/tmp/credential \
|
|
ADDITIONAL_BSL_BUCKET=additional-bucket \
|
|
VELERO_IMAGE=velero:pr-test-linux-amd64 \
|
|
PLUGINS=velero/velero-plugin-for-aws:latest \
|
|
GINKGO_LABELS="${{ matrix.labels }}" \
|
|
KIBISHII_DIRECTORY=/tmp/kibishii/kubernetes/yaml/ \
|
|
make -C test/ run-e2e
|
|
timeout-minutes: 30
|
|
- name: Upload debug bundle
|
|
if: ${{ failure() }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: DebugBundle
|
|
path: /home/runner/work/velero/velero/test/e2e/debug-bundle*
|