Skip to content

Commit 512bf6c

Browse files
committed
Fix & unify helm test setup as make rules
1 parent 84ec394 commit 512bf6c

File tree

5 files changed

+28
-45
lines changed

5 files changed

+28
-45
lines changed

.github/workflows/test-e2e.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ jobs:
157157
run: devbox run -- make install-crds
158158

159159
- name: Run CI E2E tests
160-
run: devbox run -- ./scripts/launch-ci-e2e.sh
160+
run: devbox run -- make e2e
161161
env:
162-
TEST_NAME: ${{ matrix.test }}
162+
label: ${{ matrix.test }}
163163
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
164164
AWS_ACCOUNT_ARN_LIST: ${{ secrets.AWS_ACCOUNT_ARN_LIST }}
165165
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

.github/workflows/tests-selectable.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,16 +251,15 @@ jobs:
251251
devbox run -- 'make install'
252252
- name: Run E2E test
253253
env:
254+
label: "${{ matrix.test }}"
254255
MCLI_OPS_MANAGER_URL: "https://cloud-qa.mongodb.com/"
255256
MCLI_ORG_ID: ${{ secrets.ATLAS_ORG_ID}}
256257
MCLI_PUBLIC_API_KEY: ${{ secrets.ATLAS_PUBLIC_KEY }}
257258
MCLI_PRIVATE_API_KEY: ${{ secrets.ATLAS_PRIVATE_KEY }}
258-
IMAGE_URL: "ghcr.io/mongodb/mongodb-atlas-kubernetes-operator-prerelease:${{ needs.detect-tests.outputs.image_tag }}"
259259
BUNDLE_IMAGE: "ghcr.io/mongodb/mongodb-atlas-kubernetes-bundles-prerelease:${{ needs.detect-tests.outputs.image_tag }}"
260260
IMAGE_PULL_SECRET_REGISTRY: ghcr.io
261261
IMAGE_PULL_SECRET_USERNAME: $
262262
IMAGE_PULL_SECRET_PASSWORD: "${{ secrets.GITHUB_TOKEN }}"
263-
TEST_NAME: "${{ matrix.test }}"
264263
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
265264
AWS_ACCOUNT_ARN_LIST: ${{ secrets.AWS_ACCOUNT_ARN_LIST }}
266265
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -273,7 +272,7 @@ jobs:
273272
PAGER_DUTY_SERVICE_KEY: ${{ secrets.PAGER_DUTY_SERVICE_KEY }}
274273
run: |
275274
echo "Using ENV: ${{ steps.select-env.outputs.ENV }}"
276-
devbox run -- ./scripts/launch-ci-e2e.sh
275+
devbox run -- make e2e
277276
- name: Upload operator logs
278277
if: ${{ failure() }}
279278
uses: actions/upload-artifact@v5

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,6 @@ config/manifests/kustomization.yaml
6161
config/manager/kustomization.yaml
6262
config/generated/crd/bases/*.yaml
6363
config/generated/rbac/role.yaml
64+
65+
# ignore helm test artifacts
66+
helm-charts/atlas-operator/charts/

Makefile

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ DOCKER_SBOM_PLUGIN_VERSION=0.6.1
1818
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
1919
VERSION_FILE=version.json
2020
CURRENT_VERSION := $(shell $(JQ) -r .current $(VERSION_FILE))
21+
NEXT_VERSION := $(shell $(JQ) -r .next $(VERSION_FILE))
2122
VERSION ?= $(shell git describe --always --tags --dirty --broken | cut -c 2-)
2223
BUILDTIME ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
2324
GITCOMMIT ?= $(shell git rev-parse --short HEAD 2> /dev/null || true)
@@ -32,13 +33,6 @@ ifdef EXPERIMENTAL
3233
LD_FLAGS += -X $(VERSION_PACKAGE).Experimental=$(EXPERIMENTAL)
3334
endif
3435

35-
# NEXT_VERSION represents a version that is higher than anything released
36-
# VERSION default value does not play well with the run target which might end up failing
37-
# with errors such as:
38-
# "version of the resource $Resource is higher than the operator version $VERSION"
39-
# This happens if you use exported YAMLs from CLI and the dirty version is deemed a pre-release
40-
NEXT_VERSION = 99.99.99-next
41-
4236
# CHANNELS define the bundle channels used in the bundle.
4337
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "preview,fast,stable")
4438
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
@@ -188,6 +182,17 @@ SBOMS_DIR ?= template
188182

189183
SHELLCHECK_OPTIONS ?= -e SC2086
190184

185+
DEFAULT_IMAGE_URL := localhost:5000/mongodb-atlas-kubernetes-operator:$(NEXT_VERSION)-test
186+
export IMAGE_URL
187+
188+
ifndef IMAGE_URL
189+
IMAGE_URL := $(DEFAULT_IMAGE_URL)
190+
BUILD_DEPENDENCY := test-docker-image
191+
else
192+
$(info --- IMAGE_URL is set externally: $(IMAGE_URL))
193+
BUILD_DEPENDENCY :=
194+
endif
195+
191196
.DEFAULT_GOAL := help
192197
.PHONY: help
193198
help: ## Show this help screen
@@ -246,7 +251,7 @@ envtest-assets:
246251
mkdir -p $(ENVTEST_ASSETS_DIR)
247252

248253
.PHONY: e2e
249-
e2e: bundle manifests run-kind ## Run e2e test. Command `make e2e label=cluster-ns` run cluster-ns test
254+
e2e: bundle manifests run-kind $(BUILD_DEPENDENCY) ## Run e2e test. Command `make e2e label=cluster-ns` run cluster-ns test
250255
AKO_E2E_TEST=1 $(GINKGO) $(shell pwd)/test/$@
251256

252257
.PHONY: e2e2
@@ -488,6 +493,14 @@ all-platforms-docker: all-platforms
488493
docker build --build-arg BINARY_PATH=bin/linux/amd64 -f fast.Dockerfile -t manager-amd64 .
489494
docker build --build-arg BINARY_PATH=bin/linux/arm64 -f fast.Dockerfile -t manager-arm64 .
490495

496+
.PHONY: docker-image
497+
docker-image:
498+
docker build --build-arg BINARY_PATH=bin/$(TARGET_OS)/$(TARGET_ARCH) -f fast.Dockerfile -t $(DEFAULT_IMAGE_URL) .
499+
500+
.PHONY: test-docker-image
501+
test-docker-image: docker-image run-kind
502+
docker push $(DEFAULT_IMAGE_URL)
503+
491504
.PHONY: check-major-version
492505
check-major-version: ## Check that VERSION starts with MAJOR_VERSION
493506
@VERSION_MAJOR=$$(echo "$(VERSION)" | cut -d. -f1 | sed 's/v//'); \

scripts/launch-ci-e2e.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)