Skip to content

Commit

Permalink
Use deterministic tag for e2e-images and cleanup after use (#954)
Browse files Browse the repository at this point in the history
* Use deterministic tag for e2e-images and cleanup after use

Signed-off-by: Andrea Mazzotti <[email protected]>

* Use deterministic image tag for short e2e jobs

Signed-off-by: Andrea Mazzotti <[email protected]>

---------

Signed-off-by: Andrea Mazzotti <[email protected]>
  • Loading branch information
anmazzotti authored Dec 30, 2024
1 parent 451c249 commit ae2131b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/e2e-short.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ concurrency:
env:
MANAGEMENT_CLUSTER_ENVIRONMENT: "isolated-kind"
GINKGO_LABEL_FILTER: "short"
TAG: v0.0.1

jobs:
e2e:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/run-e2e-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ env:
GINKGO_LABEL_FILTER: full
GINKGO_TESTS: ${{ github.workspace }}/${{ inputs.test_suite }}
GINKGO_NODES: 5
TAG: v${{ github.run_number }}.${{ github.run_attempt }}

jobs:
run_e2e_tests:
Expand Down Expand Up @@ -122,6 +123,11 @@ jobs:
age-in-hours: 6
resource-label-key: ${{ secrets.GCP_LABEL_KEY }}
resource-label-value: ${{ secrets.GCP_LABEL_VALUE }}
- name: Cleanup e2e test image
if: always()
run: |
IMAGE_URL="$(gh api /orgs/rancher/packages/container/turtles-e2e/versions | jq ".[] | select( .metadata.container.tags | contains([\"$TAG\"])) | .url" | sed 's/\"//g')"
gh api -X DELETE "$IMAGE_URL"
- name: Send failed status to slack
if: failure()
uses: slackapi/[email protected]
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,8 @@ test-e2e-push-image: $(GINKGO) $(HELM) $(CLUSTERCTL) kubectl e2e-image-push
.PHONY: e2e-image
e2e-image: ## Build and push the image for e2e tests
CONTROLLER_IMG=$(REGISTRY)/$(ORG)/turtles-e2e $(MAKE) e2e-image-build
RELEASE_TAG=v0.0.1 CONTROLLER_IMG=$(REGISTRY)/$(ORG)/turtles-e2e \
CONTROLLER_IMAGE_VERSION=v0.0.1 \
RELEASE_TAG=$(TAG) CONTROLLER_IMG=$(REGISTRY)/$(ORG)/turtles-e2e \
CONTROLLER_IMAGE_VERSION=$(TAG) \
$(MAKE) build-chart

.PHONY: e2e-image-build-and-push
Expand All @@ -608,11 +608,11 @@ e2e-image-build: ## Build the image for e2e tests
--build-arg builder_image=$(GO_CONTAINER_IMAGE) \
--build-arg goproxy=$(GOPROXY) \
--build-arg package=. \
--build-arg ldflags="$(LDFLAGS)" . -t $(CONTROLLER_IMG):v0.0.1
--build-arg ldflags="$(LDFLAGS)" . -t $(CONTROLLER_IMG):$(TAG)

.PHONY: e2e-image-push
e2e-image-push: ## Push the image for e2e tests
docker push $(CONTROLLER_IMG):v0.0.1
docker push $(CONTROLLER_IMG):$(TAG)

.PHONY: compile-e2e
e2e-compile: ## Test e2e compilation
Expand Down

0 comments on commit ae2131b

Please sign in to comment.