Skip to content

Commit 1b8d3ca

Browse files
authored
test: refactor pairing with UI code (#1227)
* refactor ui pairing * improvements * clean * clean * improve * improve docs * requested changes * publish-sandbox-ui-for-ui-e2e-tests * improve * clean * revert renaming * improve * revert * fix * rename * revert * requested changes * improve * improvements * requested changes * requested changes * improvements * improvement * requested changes
1 parent 1706019 commit 1b8d3ca

14 files changed

Lines changed: 324 additions & 250 deletions

File tree

.github/workflows/publish-operators-for-e2e-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ jobs:
7373
uses: codeready-toolchain/toolchain-cicd/prepare-tools-action@master
7474

7575
# Execute composite action using values from PR event
76+
# Developer Sandbox Dashboard will be published too in this action
7677
- name: Publish current operator bundles for host & member based on PR event
7778
uses: codeready-toolchain/toolchain-cicd/publish-operators-for-e2e-tests@master
7879
if: ${{ github.event_name == 'pull_request_target' }}
@@ -85,6 +86,7 @@ jobs:
8586
gh-head-ref: ${{ github.event.pull_request.head.ref }}
8687

8788
# Execute composite action using values from PR event
89+
# Developer Sandbox Dashboard will be published too in this action
8890
- name: Publish current operator bundles for host & member based on comment event
8991
uses: codeready-toolchain/toolchain-cicd/publish-operators-for-e2e-tests@master
9092
if: ${{ github.event_name == 'issue_comment' }}

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,10 @@ $RECYCLE.BIN/
339339
# Windows shortcuts
340340
*.lnk
341341

342-
# custom .env file for Developer Sandbox UI E2E tests
342+
# custom .env file for Developer Sandbox Dashboard E2E tests
343343
testsupport/sandbox-ui/.env
344344

345-
# trace folder for Developer Sandbox UI E2E tests
345+
# trace folder for Developer Sandbox Dashboard E2E tests
346346
trace/
347347

348348
# End of https://www.gitignore.io/api/go,vim,git,macos,linux,emacs,windows,eclipse,intellij+all,visualstudiocode

build/sandbox-ui/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ RUN yum install -y \
7676
libX11-xcb && \
7777
yum clean all
7878

79-
CMD ["make", "test-ui-e2e"]
79+
CMD ["/bin/bash"]

deploy/sandbox-ui/base/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ kind: Deployment
22
apiVersion: apps/v1
33
metadata:
44
name: rhdh
5-
namespace: ${SANDBOX_UI_NS}
5+
namespace: ${DEVSANDBOX_DASHBOARD_NS}
66
labels:
77
app.kubernetes.io/instance: rhdh
88
spec:

deploy/sandbox-ui/base/route.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ kind: Route
22
apiVersion: route.openshift.io/v1
33
metadata:
44
name: rhdh
5-
namespace: ${SANDBOX_UI_NS}
5+
namespace: ${DEVSANDBOX_DASHBOARD_NS}
66
labels:
77
app.kubernetes.io/instance: rhdh
88
spec:

deploy/sandbox-ui/base/service-accounts.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ apiVersion: v1
22
kind: ServiceAccount
33
metadata:
44
name: rhdh
5-
namespace: ${SANDBOX_UI_NS}
5+
namespace: ${DEVSANDBOX_DASHBOARD_NS}

deploy/sandbox-ui/base/service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ kind: Service
22
apiVersion: v1
33
metadata:
44
name: rhdh
5-
namespace: ${SANDBOX_UI_NS}
5+
namespace: ${DEVSANDBOX_DASHBOARD_NS}
66
labels:
77
app.kubernetes.io/instance: rhdh
88
spec:

make/sandbox-ui.mk

Lines changed: 63 additions & 201 deletions
Original file line numberDiff line numberDiff line change
@@ -1,235 +1,97 @@
1-
SANDBOX_UI_NS := sandbox-ui
2-
SANDBOX_PLUGIN_IMAGE_NAME := sandbox-rhdh-plugin
3-
TAG := latest
4-
PLATFORM ?= linux/amd64
5-
RHDH_PLUGINS_TMP ?= $(TMPDIR)rhdh-plugins
6-
AUTH_FILE := /tmp/auth.json
7-
OPENID_SECRET_NAME=openid-sandbox-public-client-secret
8-
PUSH_SANDBOX_IMAGE ?= false
1+
DEVSANDBOX_DASHBOARD_NS := devsandbox-dashboard
2+
IMAGE_PLATFORM ?= linux/amd64
3+
KUBECONFIG ?= $(HOME)/.kube/config
4+
OPENID_SECRET_NAME := openid-sandbox-public-client-secret
95
UI_ENVIRONMENT := ui-e2e-tests
106
SSO_USERNAME_READ := $(shell if [ -n "$(CI)" ]; then cat /usr/local/sandbox-secrets/SSO_USERNAME 2>/dev/null || echo ""; else echo "${SSO_USERNAME}"; fi)
117
SSO_PASSWORD_READ := $(shell if [ -n "$(CI)" ]; then cat /usr/local/sandbox-secrets/SSO_PASSWORD 2>/dev/null || echo ""; else echo "${SSO_PASSWORD}"; fi)
128

13-
QUAY_NAMESPACE ?= codeready-toolchain-test
14-
IMAGE_NAME_TO_PUSH_IN_QUAY ?= quay.io/$(QUAY_NAMESPACE)/sandbox-rhdh-plugin
159

16-
IMAGE_TO_PUSH_IN_QUAY := $(shell \
17-
if [ -n "$(CI)$(CLONEREFS_OPTIONS)" ]; then \
18-
if [ -n "$(GITHUB_ACTIONS)" ]; then \
19-
REPOSITORY_NAME=$$(basename "$(GITHUB_REPOSITORY)"); \
20-
COMMIT_ID_SUFFIX=$$(echo "$(PULL_PULL_SHA)" | cut -c1-7); \
21-
echo "$(IMAGE_NAME_TO_PUSH_IN_QUAY):from.$${REPOSITORY_NAME}.PR$(PULL_NUMBER).$${COMMIT_ID_SUFFIX}"; \
22-
else \
23-
: "if REPO_NAME is not set, it means that the E2E tests were triggered by periodic CI job"; \
24-
if [ -z "$(REPO_NAME)" ]; then \
25-
echo "quay.io/codeready-toolchain/sandbox-rhdh-plugin:latest"; \
26-
else \
27-
AUTHOR=$$(jq -r '.refs[0].pulls[0].author' <<< $${CLONEREFS_OPTIONS} | tr -d '[:space:]'); \
28-
PULL_PULL_SHA=$${PULL_PULL_SHA:-$$(jq -r '.refs[0].pulls[0].sha' <<< $${CLONEREFS_OPTIONS} | tr -d '[:space:]')}; \
29-
COMMIT_ID_SUFFIX=$$(echo "$${PULL_PULL_SHA}" | cut -c1-7); \
30-
echo "$(IMAGE_NAME_TO_PUSH_IN_QUAY):from.$$(echo $(REPO_NAME) | sed 's/\"//g').PR$(PULL_NUMBER).$${COMMIT_ID_SUFFIX}"; \
31-
fi; \
32-
fi; \
33-
else \
34-
echo "$(IMAGE_NAME_TO_PUSH_IN_QUAY):latest"; \
35-
fi)
10+
PUBLISH_UI ?= false
11+
DEPLOY_UI ?= true
3612

37-
38-
.PHONY: deploy-sandbox-ui
39-
deploy-sandbox-ui: HOST_NS=$(shell oc get projects -l app=host-operator --output=name -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | sort | tail -n 1)
40-
deploy-sandbox-ui: REGISTRATION_SERVICE_API=https://$(shell oc get route registration-service -n ${HOST_NS} -o custom-columns=":spec.host" | tr -d '\n')/api/v1
41-
deploy-sandbox-ui: HOST_OPERATOR_API=https://$(shell oc get route api -n ${HOST_NS} -o custom-columns=":spec.host" | tr -d '\n')
42-
deploy-sandbox-ui: RHDH=https://rhdh-${SANDBOX_UI_NS}.$(shell oc get ingress.config.openshift.io/cluster -o jsonpath='{.spec.domain}')
43-
deploy-sandbox-ui:
44-
$(MAKE) check-sso-credentials
45-
@echo "sandbox ui will be deployed in '${SANDBOX_UI_NS}' namespace"
46-
$(MAKE) create-namespace SANDBOX_UI_NS=${SANDBOX_UI_NS}
47-
ifeq ($(PUSH_SANDBOX_IMAGE),true)
48-
$(MAKE) push-sandbox-plugin
49-
endif
50-
oc kustomize deploy/sandbox-ui/ui-e2e-tests | REGISTRATION_SERVICE_API=${REGISTRATION_SERVICE_API} \
51-
HOST_OPERATOR_API=${HOST_OPERATOR_API} \
52-
SANDBOX_UI_NS=${SANDBOX_UI_NS} \
53-
SANDBOX_PLUGIN_IMAGE=${IMAGE_TO_PUSH_IN_QUAY} \
54-
RHDH=${RHDH} envsubst | oc apply -f -
55-
$(MAKE) configure-oauth-idp
56-
ifeq ($(ENVIRONMENT),ui-e2e-tests)
57-
@echo "applying toolchainconfig changes"
58-
@echo "HOST_NS: ${HOST_NS}"
59-
@oc apply -f deploy/host-operator/ui-e2e-tests/toolchainconfig.yaml -n ${HOST_NS}
60-
@echo "restarting registration-service to apply toolchainconfig changes"
61-
@oc -n ${HOST_NS} rollout restart deploy/registration-service
62-
else
63-
@echo "skipping toolchainconfig changes - environment is not ui-e2e-tests"
13+
.PHONY: get-and-publish-devsandbox-dashboard
14+
get-and-publish-devsandbox-dashboard:
15+
ifneq (${UI_REPO_PATH},)
16+
$(eval UI_REPO_PATH_PARAM = -ur ${UI_REPO_PATH})
6417
endif
65-
@oc -n ${SANDBOX_UI_NS} rollout status deploy/rhdh
66-
@echo "Developer Sandbox UI running at ${RHDH}"
67-
68-
69-
check-sso-credentials:
70-
@echo "checking SSO credentials..."
71-
@if [ -z "$(SSO_USERNAME_READ)" ] || [ -z "$(SSO_PASSWORD_READ)" ]; then \
72-
if [ -n "$(CI)" ]; then \
73-
echo "SSO credential files not found or empty in CI environment"; \
74-
else \
75-
echo "SSO_USERNAME or SSO_PASSWORD environment variables not set"; \
76-
fi; \
77-
exit 1; \
78-
fi
79-
@echo "Validating SSO credentials..."
80-
@status=$$(curl -s -o /dev/null -w "%{http_code}" \
81-
-X POST "https://sso.devsandbox.dev/auth/realms/sandbox-dev/protocol/openid-connect/token" \
82-
-d "grant_type=password" \
83-
-d "client_id=sandbox-public" \
84-
-d "username=$(SSO_USERNAME_READ)" \
85-
-d "password=$(SSO_PASSWORD_READ)"); \
86-
if [ "$$status" != "200" ]; then \
87-
echo "failed trying to login to 'https://sso.devsandbox.dev/auth/realms/sandbox-dev' ($$status) — check your SSO credentials."; \
88-
exit 1; \
89-
fi
90-
@echo "SSO credentials validated successfully"
91-
92-
configure-oauth-idp:
93-
@echo "configuring DevSandbox identity provider"
94-
@oc create secret generic ${OPENID_SECRET_NAME} \
95-
--from-literal=clientSecret=dummy \
96-
--namespace=openshift-config
97-
OPENID_SECRET_NAME=${OPENID_SECRET_NAME} envsubst < deploy/sandbox-ui/ui-e2e-tests/oauth-idp-patch.yaml | \
98-
oc patch oauths.config.openshift.io/cluster --type=merge --patch-file=/dev/stdin
99-
100-
create-namespace:
101-
@if ! oc get project ${SANDBOX_UI_NS} >/dev/null 2>&1; then \
102-
echo "Creating namespace ${SANDBOX_UI_NS}"; \
103-
oc new-project ${SANDBOX_UI_NS} >/dev/null 2>&1 || true; \
104-
else \
105-
echo "Namespace ${SANDBOX_UI_NS} already exists"; \
106-
fi
107-
@oc project ${SANDBOX_UI_NS} >/dev/null 2>&1
108-
109-
110-
.PHONY: get-rhdh-plugins
111-
get-rhdh-plugins:
112-
ifeq ($(strip $(RHDH_PLUGINS_TMP)), $(TMPDIR)rhdh-plugins)
113-
ifeq ($(GITHUB_ACTIONS),true)
114-
@echo "using author ${AUTHOR}"
115-
$(eval AUTHOR_LINK = https://github.com/${AUTHOR})
116-
@echo "detected branch ${BRANCH_NAME}"
117-
# check if a branch with the same ref exists in the user's fork of rhdh-plugins repo
118-
@echo "branches of ${AUTHOR_LINK}/rhdh-plugins - checking if there is a branch ${BRANCH_NAME} we could pair with."
119-
curl ${AUTHOR_LINK}/rhdh-plugins.git/info/refs?service=git-upload-pack --output -
120-
$(eval REMOTE_RHDH_PLUGINS_BRANCH := $(shell curl ${AUTHOR_LINK}/rhdh-plugins.git/info/refs?service=git-upload-pack --output - 2>/dev/null | grep -a "refs/heads/${BRANCH_NAME}$$" | awk '{print $$2}'))
121-
122-
# check if the branch with the same name exists, if so then merge it with master and use the merge branch, if not then use master
123-
@echo "REMOTE_RHDH_PLUGINS_BRANCH: ${REMOTE_RHDH_PLUGINS_BRANCH}"
124-
@$(MAKE) pair-if-needed REMOTE_RHDH_PLUGINS_BRANCH=${REMOTE_RHDH_PLUGINS_BRANCH} AUTHOR_LINK=${AUTHOR_LINK}
125-
else
126-
@echo "using rhdh-plugins repo from master"
127-
@$(MAKE) clone-rhdh-plugins
128-
endif
129-
else
130-
@echo "using local rhdh-plugins repo, no pairing needed: ${RHDH_PLUGINS_TMP}"
18+
ifneq (${FORCED_TAG},)
19+
$(eval FORCED_TAG_PARAM = -ft ${FORCED_TAG})
13120
endif
132-
133-
pair-if-needed:
134-
ifneq ($(strip $(REMOTE_RHDH_PLUGINS_BRANCH)),)
135-
@echo "Branch ref of the user's fork to be used for pairing: \"${REMOTE_RHDH_PLUGINS_BRANCH}\""
136-
git config --global user.email "devsandbox@redhat.com"
137-
git config --global user.name "KubeSaw"
138-
# clone
139-
rm -rf ${RHDH_PLUGINS_TMP}
140-
git clone --depth=1 https://github.com/redhat-developer/rhdh-plugins.git ${RHDH_PLUGINS_TMP}
141-
# add the user's fork as remote repo
142-
git --git-dir=${RHDH_PLUGINS_TMP}/.git --work-tree=${RHDH_PLUGINS_TMP} remote add external ${AUTHOR_LINK}/rhdh-plugins.git
143-
# fetch the branch
144-
git --git-dir=${RHDH_PLUGINS_TMP}/.git --work-tree=${RHDH_PLUGINS_TMP} fetch external ${REMOTE_RHDH_PLUGINS_BRANCH}
145-
# merge the branch with master
146-
git --git-dir=${RHDH_PLUGINS_TMP}/.git --work-tree=${RHDH_PLUGINS_TMP} merge --ff-only FETCH_HEAD
147-
else
148-
@echo "no pairing needed, using rhdh-plugins repo from master"
149-
@$(MAKE) clone-rhdh-plugins
21+
ifneq (${DEPLOY_LATEST},)
22+
$(eval DEPLOY_LATEST_PARAM = -dl ${DEPLOY_LATEST})
15023
endif
24+
@echo "Publishing and installing the Developer Sandbox Dashboard"
25+
scripts/ci/manage-devsandbox-dashboard.sh -pp ${PUBLISH_UI} ${UI_REPO_PATH_PARAM} -ds ${DATE_SUFFIX} -qn ${QUAY_NAMESPACE} ${FORCED_TAG_PARAM} -du ${DEPLOY_UI} -ns ${DEVSANDBOX_DASHBOARD_NS} -os ${OPENID_SECRET_NAME} -en ${UI_ENVIRONMENT} ${DEPLOY_LATEST_PARAM}
15126

152-
.PHONY: clone-rhdh-plugins
153-
clone-rhdh-plugins:
154-
rm -rf ${RHDH_PLUGINS_TMP}; \
155-
git clone --depth=1 https://github.com/redhat-developer/rhdh-plugins $(RHDH_PLUGINS_TMP) && \
156-
echo "cloned to $(RHDH_PLUGINS_TMP)"
157-
158-
.PHONY: push-sandbox-plugin
159-
push-sandbox-plugin:
160-
$(MAKE) get-rhdh-plugins
161-
cd $(RHDH_PLUGINS_TMP)/workspaces/sandbox && \
162-
rm -rf plugins/sandbox/dist-dynamic && \
163-
rm -rf red-hat-developer-hub-backstage-plugin-sandbox && \
164-
yarn install && \
165-
npx @janus-idp/cli@3.3.1 package package-dynamic-plugins \
166-
--tag $(IMAGE_TO_PUSH_IN_QUAY) \
167-
--platform $(PLATFORM) && \
168-
podman push $(IMAGE_TO_PUSH_IN_QUAY)
169-
170-
.PHONY: clean-sandbox-ui
171-
clean-sandbox-ui: HOST_NS=$(shell oc get projects -l app=host-operator --output=name -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | sort | tail -n 1)
172-
clean-sandbox-ui:
173-
@oc delete ns ${SANDBOX_UI_NS}
174-
@oc delete secret ${OPENID_SECRET_NAME} -n openshift-config
175-
@oc delete usersignup ${SSO_USERNAME} -n ${HOST_NS}
176-
177-
.PHONY: e2e-run-sandbox-ui
178-
e2e-run-sandbox-ui: HOST_NS=$(shell oc get projects -l app=host-operator --output=name -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | sort | tail -n 1)
179-
e2e-run-sandbox-ui: RHDH=https://rhdh-${SANDBOX_UI_NS}.$(shell oc get ingress.config.openshift.io/cluster -o jsonpath='{.spec.domain}')
180-
e2e-run-sandbox-ui:
181-
@echo "Installing Playwright..."
27+
.PHONY: e2e-run-devsandbox-dashboard
28+
e2e-run-devsandbox-dashboard: HOST_NS=$(shell oc get projects -l app=host-operator --output=name -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | sort | tail -n 1)
29+
e2e-run-devsandbox-dashboard: RHDH=https://rhdh-${DEVSANDBOX_DASHBOARD_NS}.$(shell oc get ingress.config.openshift.io/cluster -o jsonpath='{.spec.domain}')
30+
e2e-run-devsandbox-dashboard:
18231
$(eval PWGO_VER := $(shell grep -oE "playwright-go v\S+" go.mod | sed 's/playwright-go //g'))
18332
@echo "Installing Playwright CLI version: $(PWGO_VER)"
18433
go install github.com/playwright-community/playwright-go/cmd/playwright@$(PWGO_VER)
18534
@echo "Installing Firefox browser for Playwright..."
18635
$(GOPATH)/bin/playwright install firefox
18736

188-
@echo "Running Developer Sandbox UI setup e2e tests..."
189-
SANDBOX_UI_NS=${SANDBOX_UI_NS} go test "./test/e2e/sandbox-ui/setup" -v -timeout=10m -failfast
37+
@echo "Running Developer Sandbox Dashboard setup e2e tests..."
38+
DEVSANDBOX_DASHBOARD_NS=${DEVSANDBOX_DASHBOARD_NS} go test "./test/e2e/sandbox-ui/setup" -v -timeout=10m -failfast
19039

191-
@echo "Running Developer Sandbox UI e2e tests in firefox..."
40+
@echo "Running Developer Sandbox Dashboard e2e tests in firefox..."
19241
@SSO_USERNAME=$(SSO_USERNAME_READ) SSO_PASSWORD=$(SSO_PASSWORD_READ) BASE_URL=${RHDH} BROWSER=firefox envsubst < deploy/sandbox-ui/ui-e2e-tests/.env > testsupport/sandbox-ui/.env
19342
go test "./test/e2e/sandbox-ui" -v -timeout=10m -failfast
19443
@oc delete usersignup $(SSO_USERNAME_READ) -n $(HOST_NS)
19544

196-
@echo "The Developer Sandbox UI e2e tests successfully finished"
45+
@echo "The Developer Sandbox Dashboard e2e tests successfully finished"
19746

47+
.PHONY: test-devsandbox-dashboard-e2e
48+
test-devsandbox-dashboard-e2e: get-and-publish-devsandbox-dashboard e2e-run-devsandbox-dashboard
19849

199-
.PHONY: test-ui-e2e
200-
test-ui-e2e:
201-
$(MAKE) deploy-sandbox-ui e2e-run-sandbox-ui ENVIRONMENT=${UI_ENVIRONMENT}
50+
.PHONY: test-devsandbox-dashboard-e2e-local
51+
test-devsandbox-dashboard-e2e-local:
52+
$(MAKE) get-and-publish-devsandbox-dashboard e2e-run-devsandbox-dashboard UI_REPO_PATH=${PWD}/../devsandbox-dashboard PUBLISH_UI=true DEPLOY_UI=true
20253

203-
.PHONY: test-ui-e2e-local
204-
test-ui-e2e-local:
205-
$(MAKE) deploy-sandbox-ui e2e-run-sandbox-ui RHDH_PLUGINS_TMP=${PWD}/../rhdh-plugins ENVIRONMENT=${UI_ENVIRONMENT} PUSH_SANDBOX_IMAGE=true
206-
207-
208-
UNIT_TEST_IMAGE_NAME=sandbox-ui-e2e-tests
209-
UNIT_TEST_DOCKERFILE=build/sandbox-ui/Dockerfile
54+
.PHONY: clean-devsandbox-dashboard
55+
clean-devsandbox-dashboard: HOST_NS=$(shell oc get projects -l app=host-operator --output=name -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | sort | tail -n 1)
56+
clean-devsandbox-dashboard:
57+
@oc delete ns ${DEVSANDBOX_DASHBOARD_NS}
58+
@oc delete secret ${OPENID_SECRET_NAME} -n openshift-config
59+
@oc delete usersignup ${SSO_USERNAME} -n ${HOST_NS}
21060

211-
# Build Developer Sandbox UI e2e tests image using podman
212-
.PHONY: build-sandbox-ui-e2e-tests
213-
build-sandbox-ui-e2e-tests:
214-
@echo "building the $(UNIT_TEST_IMAGE_NAME) image with podman..."
215-
podman build --platform $(PLATFORM) -t $(UNIT_TEST_IMAGE_NAME) -f $(UNIT_TEST_DOCKERFILE) .
21661

217-
# Run Developer Sandbox UI e2e tests image using podman
218-
.PHONY: test-sandbox-ui-in-container
219-
test-sandbox-ui-in-container: build-sandbox-ui-e2e-tests
220-
@echo "pushing Developer Sandbox UI image..."
221-
$(MAKE) push-sandbox-plugin
62+
E2E_TEST_IMAGE_NAME=devsandbox-dashboard-e2e-tests
63+
E2E_TEST_DOCKERFILE=build/sandbox-ui/Dockerfile
64+
65+
# Build Developer Sandbox Dashboard e2e tests image using podman
66+
.PHONY: build-devsandbox-dashboard-e2e-tests
67+
build-devsandbox-dashboard-e2e-tests:
68+
@echo "building the $(E2E_TEST_IMAGE_NAME) image with podman..."
69+
podman build --platform $(IMAGE_PLATFORM) -t $(E2E_TEST_IMAGE_NAME) -f $(E2E_TEST_DOCKERFILE) .
70+
71+
# Run Developer Sandbox Dashboard e2e tests image using podman
72+
.PHONY: test-devsandbox-dashboard-in-container
73+
test-devsandbox-dashboard-in-container: build-devsandbox-dashboard-e2e-tests
74+
ifneq ($(UI_REPO_PATH),)
75+
$(eval FORCED_TAG := $(DATE_SUFFIX))
76+
$(eval ABS_UI_REPO_PATH := $(abspath $(UI_REPO_PATH)))
77+
@echo "Generated FORCED_TAG: $(FORCED_TAG)"
78+
@echo "Using UI_REPO_PATH: $(ABS_UI_REPO_PATH)"
79+
@echo "pushing Developer Dashboard image..."
80+
$(MAKE) get-and-publish-devsandbox-dashboard PUBLISH_UI=true DEPLOY_UI=false FORCED_TAG=$(FORCED_TAG) UI_REPO_PATH=$(UI_REPO_PATH)
81+
else
82+
@echo "Skipping Developer Sandbox Dashboard publish - UI_REPO_PATH not set"
83+
endif
22284
@echo "running the e2e tests in podman container..."
223-
podman run --platform $(PLATFORM) --rm \
85+
podman run --platform $(IMAGE_PLATFORM) --rm \
22486
-v $(KUBECONFIG):/root/.kube/config \
22587
-e KUBECONFIG=/root/.kube/config \
22688
-v ${PWD}:/root/toolchain-e2e \
22789
-e E2E_REPO_PATH=/root/toolchain-e2e \
228-
-v $(RHDH_PLUGINS_TMP):/root/rhdh-plugins \
229-
-e RHDH_PLUGINS_TMP=/root/rhdh-plugins \
90+
$(if $(ABS_UI_REPO_PATH),-v $(ABS_UI_REPO_PATH):/root/devsandbox-dashboard -e UI_REPO_PATH=/root/devsandbox-dashboard) \
91+
$(if $(ABS_UI_REPO_PATH),-e FORCED_TAG=$(FORCED_TAG)) \
23092
-e SSO_USERNAME=$(SSO_USERNAME) \
23193
-e SSO_PASSWORD=$(SSO_PASSWORD) \
23294
-e QUAY_NAMESPACE=$(QUAY_NAMESPACE) \
233-
-e TMP=/tmp/ \
234-
-e RUNNING_IN_CONTAINER=true \
235-
$(UNIT_TEST_IMAGE_NAME)
95+
-e DEPLOY_UI=true \
96+
-e PUBLISH_UI=false \
97+
$(E2E_TEST_IMAGE_NAME) make test-devsandbox-dashboard-e2e

make/test.mk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ ifeq ($(CI),true)
4949
# if we are running on CI, we want to run the ui e2e tests in the toolchain-e2e presubmit and periodic CI jobs
5050
# if REPO_NAME is not set, it means that the e2e tests were triggered by the periodic CI job
5151
ifeq ($(filter-out toolchain-e2e,$(REPO_NAME)),)
52-
$(MAKE) test-ui-e2e
52+
$(MAKE) test-devsandbox-dashboard-e2e
5353
@echo "UI E2E tests successfully finished"
54-
@echo "To clean the Developer Sandbox UI run 'make clean-sandbox-ui'"
54+
@echo "To clean the Developer Sandbox Dashboard run 'make clean-devsandbox-dashboard'"
5555
endif
5656
endif
5757

@@ -294,7 +294,9 @@ deploy-single-member-e2e-latest:
294294

295295
.PHONY: publish-current-bundles-for-e2e
296296
## Target that is supposed to be called from CI - it builds & publishes the current operator bundles
297-
publish-current-bundles-for-e2e: get-and-publish-operators
297+
publish-current-bundles-for-e2e: PUBLISH_UI=true
298+
publish-current-bundles-for-e2e: DEPLOY_UI=false
299+
publish-current-bundles-for-e2e: get-and-publish-operators get-and-publish-devsandbox-dashboard
298300

299301
.PHONY: get-and-publish-operators
300302
get-and-publish-operators: PUBLISH_OPERATOR=true

0 commit comments

Comments
 (0)