Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/publish-operators-for-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
uses: codeready-toolchain/toolchain-cicd/prepare-tools-action@master

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

# Execute composite action using values from PR event
# Developer Sandbox Dashboard will be published too in this action
- name: Publish current operator bundles for host & member based on comment event
uses: codeready-toolchain/toolchain-cicd/publish-operators-for-e2e-tests@master
if: ${{ github.event_name == 'issue_comment' }}
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk

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

# trace folder for Developer Sandbox UI E2E tests
# trace folder for Developer Sandbox Dashboard E2E tests
trace/

# End of https://www.gitignore.io/api/go,vim,git,macos,linux,emacs,windows,eclipse,intellij+all,visualstudiocode
2 changes: 1 addition & 1 deletion build/sandbox-ui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ RUN yum install -y \
libX11-xcb && \
yum clean all
Comment on lines 76 to 77
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also suggestion for later - can you move this yum install section more up before copying the folder so it uses the cached snapshots? With the current order it always installs the dependency for every run


CMD ["make", "test-ui-e2e"]
Comment thread
rsoaresd marked this conversation as resolved.
CMD ["/bin/bash"]
2 changes: 1 addition & 1 deletion deploy/sandbox-ui/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kind: Deployment
apiVersion: apps/v1
metadata:
name: rhdh
namespace: ${SANDBOX_UI_NS}
namespace: ${DEVSANDBOX_DASHBOARD_NS}
labels:
app.kubernetes.io/instance: rhdh
spec:
Expand Down
2 changes: 1 addition & 1 deletion deploy/sandbox-ui/base/route.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kind: Route
apiVersion: route.openshift.io/v1
metadata:
name: rhdh
namespace: ${SANDBOX_UI_NS}
namespace: ${DEVSANDBOX_DASHBOARD_NS}
labels:
app.kubernetes.io/instance: rhdh
spec:
Expand Down
2 changes: 1 addition & 1 deletion deploy/sandbox-ui/base/service-accounts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: rhdh
namespace: ${SANDBOX_UI_NS}
namespace: ${DEVSANDBOX_DASHBOARD_NS}
2 changes: 1 addition & 1 deletion deploy/sandbox-ui/base/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kind: Service
apiVersion: v1
metadata:
name: rhdh
namespace: ${SANDBOX_UI_NS}
namespace: ${DEVSANDBOX_DASHBOARD_NS}
labels:
app.kubernetes.io/instance: rhdh
spec:
Expand Down
262 changes: 61 additions & 201 deletions make/sandbox-ui.mk
Original file line number Diff line number Diff line change
@@ -1,235 +1,95 @@
SANDBOX_UI_NS := sandbox-ui
SANDBOX_PLUGIN_IMAGE_NAME := sandbox-rhdh-plugin
TAG := latest
PLATFORM ?= linux/amd64
RHDH_PLUGINS_TMP ?= $(TMPDIR)rhdh-plugins
AUTH_FILE := /tmp/auth.json
OPENID_SECRET_NAME=openid-sandbox-public-client-secret
PUSH_SANDBOX_IMAGE ?= false
DEVSANDBOX_DASHBOARD_NS := devsandbox-dashboard
IMAGE_PLATFORM ?= linux/amd64
KUBECONFIG ?= $(HOME)/.kube/config
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious - why do we need to set the KUBECONFIG env variable ? This is already the default path already if you haven't specified anything as KUBECONFIG env variable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nvm, now I saw it's because you were using it here and about to remove it I guess ..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be used on test-devsandbox-dashboard-in-container

OPENID_SECRET_NAME := openid-sandbox-public-client-secret
UI_ENVIRONMENT := ui-e2e-tests
SSO_USERNAME_READ := $(shell if [ -n "$(CI)" ]; then cat /usr/local/sandbox-secrets/SSO_USERNAME 2>/dev/null || echo ""; else echo "${SSO_USERNAME}"; fi)
SSO_PASSWORD_READ := $(shell if [ -n "$(CI)" ]; then cat /usr/local/sandbox-secrets/SSO_PASSWORD 2>/dev/null || echo ""; else echo "${SSO_PASSWORD}"; fi)

QUAY_NAMESPACE ?= codeready-toolchain-test
Comment thread
rsoaresd marked this conversation as resolved.
Outdated
IMAGE_NAME_TO_PUSH_IN_QUAY ?= quay.io/$(QUAY_NAMESPACE)/sandbox-rhdh-plugin

IMAGE_TO_PUSH_IN_QUAY := $(shell \
if [ -n "$(CI)$(CLONEREFS_OPTIONS)" ]; then \
if [ -n "$(GITHUB_ACTIONS)" ]; then \
REPOSITORY_NAME=$$(basename "$(GITHUB_REPOSITORY)"); \
COMMIT_ID_SUFFIX=$$(echo "$(PULL_PULL_SHA)" | cut -c1-7); \
echo "$(IMAGE_NAME_TO_PUSH_IN_QUAY):from.$${REPOSITORY_NAME}.PR$(PULL_NUMBER).$${COMMIT_ID_SUFFIX}"; \
else \
: "if REPO_NAME is not set, it means that the E2E tests were triggered by periodic CI job"; \
if [ -z "$(REPO_NAME)" ]; then \
echo "quay.io/codeready-toolchain/sandbox-rhdh-plugin:latest"; \
else \
AUTHOR=$$(jq -r '.refs[0].pulls[0].author' <<< $${CLONEREFS_OPTIONS} | tr -d '[:space:]'); \
PULL_PULL_SHA=$${PULL_PULL_SHA:-$$(jq -r '.refs[0].pulls[0].sha' <<< $${CLONEREFS_OPTIONS} | tr -d '[:space:]')}; \
COMMIT_ID_SUFFIX=$$(echo "$${PULL_PULL_SHA}" | cut -c1-7); \
echo "$(IMAGE_NAME_TO_PUSH_IN_QUAY):from.$$(echo $(REPO_NAME) | sed 's/\"//g').PR$(PULL_NUMBER).$${COMMIT_ID_SUFFIX}"; \
fi; \
fi; \
else \
echo "$(IMAGE_NAME_TO_PUSH_IN_QUAY):latest"; \
fi)
PUBLISH_UI ?= false
DEPLOY_UI ?= true


.PHONY: deploy-sandbox-ui
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)
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
deploy-sandbox-ui: HOST_OPERATOR_API=https://$(shell oc get route api -n ${HOST_NS} -o custom-columns=":spec.host" | tr -d '\n')
deploy-sandbox-ui: RHDH=https://rhdh-${SANDBOX_UI_NS}.$(shell oc get ingress.config.openshift.io/cluster -o jsonpath='{.spec.domain}')
deploy-sandbox-ui:
$(MAKE) check-sso-credentials
@echo "sandbox ui will be deployed in '${SANDBOX_UI_NS}' namespace"
$(MAKE) create-namespace SANDBOX_UI_NS=${SANDBOX_UI_NS}
ifeq ($(PUSH_SANDBOX_IMAGE),true)
$(MAKE) push-sandbox-plugin
endif
oc kustomize deploy/sandbox-ui/ui-e2e-tests | REGISTRATION_SERVICE_API=${REGISTRATION_SERVICE_API} \
HOST_OPERATOR_API=${HOST_OPERATOR_API} \
SANDBOX_UI_NS=${SANDBOX_UI_NS} \
SANDBOX_PLUGIN_IMAGE=${IMAGE_TO_PUSH_IN_QUAY} \
RHDH=${RHDH} envsubst | oc apply -f -
$(MAKE) configure-oauth-idp
ifeq ($(ENVIRONMENT),ui-e2e-tests)
@echo "applying toolchainconfig changes"
@echo "HOST_NS: ${HOST_NS}"
@oc apply -f deploy/host-operator/ui-e2e-tests/toolchainconfig.yaml -n ${HOST_NS}
@echo "restarting registration-service to apply toolchainconfig changes"
@oc -n ${HOST_NS} rollout restart deploy/registration-service
else
@echo "skipping toolchainconfig changes - environment is not ui-e2e-tests"
endif
@oc -n ${SANDBOX_UI_NS} rollout status deploy/rhdh
@echo "Developer Sandbox UI running at ${RHDH}"


check-sso-credentials:
@echo "checking SSO credentials..."
@if [ -z "$(SSO_USERNAME_READ)" ] || [ -z "$(SSO_PASSWORD_READ)" ]; then \
if [ -n "$(CI)" ]; then \
echo "SSO credential files not found or empty in CI environment"; \
else \
echo "SSO_USERNAME or SSO_PASSWORD environment variables not set"; \
fi; \
exit 1; \
fi
@echo "Validating SSO credentials..."
@status=$$(curl -s -o /dev/null -w "%{http_code}" \
-X POST "https://sso.devsandbox.dev/auth/realms/sandbox-dev/protocol/openid-connect/token" \
-d "grant_type=password" \
-d "client_id=sandbox-public" \
-d "username=$(SSO_USERNAME_READ)" \
-d "password=$(SSO_PASSWORD_READ)"); \
if [ "$$status" != "200" ]; then \
echo "failed trying to login to 'https://sso.devsandbox.dev/auth/realms/sandbox-dev' ($$status) — check your SSO credentials."; \
exit 1; \
fi
@echo "SSO credentials validated successfully"

configure-oauth-idp:
@echo "configuring DevSandbox identity provider"
@oc create secret generic ${OPENID_SECRET_NAME} \
--from-literal=clientSecret=dummy \
--namespace=openshift-config
OPENID_SECRET_NAME=${OPENID_SECRET_NAME} envsubst < deploy/sandbox-ui/ui-e2e-tests/oauth-idp-patch.yaml | \
oc patch oauths.config.openshift.io/cluster --type=merge --patch-file=/dev/stdin

create-namespace:
@if ! oc get project ${SANDBOX_UI_NS} >/dev/null 2>&1; then \
echo "Creating namespace ${SANDBOX_UI_NS}"; \
oc new-project ${SANDBOX_UI_NS} >/dev/null 2>&1 || true; \
else \
echo "Namespace ${SANDBOX_UI_NS} already exists"; \
fi
@oc project ${SANDBOX_UI_NS} >/dev/null 2>&1


.PHONY: get-rhdh-plugins
get-rhdh-plugins:
ifeq ($(strip $(RHDH_PLUGINS_TMP)), $(TMPDIR)rhdh-plugins)
ifeq ($(GITHUB_ACTIONS),true)
@echo "using author ${AUTHOR}"
$(eval AUTHOR_LINK = https://github.com/${AUTHOR})
@echo "detected branch ${BRANCH_NAME}"
# check if a branch with the same ref exists in the user's fork of rhdh-plugins repo
@echo "branches of ${AUTHOR_LINK}/rhdh-plugins - checking if there is a branch ${BRANCH_NAME} we could pair with."
curl ${AUTHOR_LINK}/rhdh-plugins.git/info/refs?service=git-upload-pack --output -
$(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}'))

# 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
@echo "REMOTE_RHDH_PLUGINS_BRANCH: ${REMOTE_RHDH_PLUGINS_BRANCH}"
@$(MAKE) pair-if-needed REMOTE_RHDH_PLUGINS_BRANCH=${REMOTE_RHDH_PLUGINS_BRANCH} AUTHOR_LINK=${AUTHOR_LINK}
else
@echo "using rhdh-plugins repo from master"
@$(MAKE) clone-rhdh-plugins
.PHONY: get-and-publish-devsandbox-dashboard
get-and-publish-devsandbox-dashboard:
ifneq (${UI_REPO_PATH},)
$(eval UI_REPO_PATH_PARAM = -ur ${UI_REPO_PATH})
endif
else
@echo "using local rhdh-plugins repo, no pairing needed: ${RHDH_PLUGINS_TMP}"
ifneq (${FORCED_TAG},)
$(eval FORCED_TAG_PARAM = -ft ${FORCED_TAG})
endif
@echo "Publishing and installing the Developer Sandbox Dashboard"
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}

pair-if-needed:
ifneq ($(strip $(REMOTE_RHDH_PLUGINS_BRANCH)),)
@echo "Branch ref of the user's fork to be used for pairing: \"${REMOTE_RHDH_PLUGINS_BRANCH}\""
git config --global user.email "devsandbox@redhat.com"
git config --global user.name "KubeSaw"
# clone
rm -rf ${RHDH_PLUGINS_TMP}
git clone --depth=1 https://github.com/redhat-developer/rhdh-plugins.git ${RHDH_PLUGINS_TMP}
# add the user's fork as remote repo
git --git-dir=${RHDH_PLUGINS_TMP}/.git --work-tree=${RHDH_PLUGINS_TMP} remote add external ${AUTHOR_LINK}/rhdh-plugins.git
# fetch the branch
git --git-dir=${RHDH_PLUGINS_TMP}/.git --work-tree=${RHDH_PLUGINS_TMP} fetch external ${REMOTE_RHDH_PLUGINS_BRANCH}
# merge the branch with master
git --git-dir=${RHDH_PLUGINS_TMP}/.git --work-tree=${RHDH_PLUGINS_TMP} merge --ff-only FETCH_HEAD
else
@echo "no pairing needed, using rhdh-plugins repo from master"
@$(MAKE) clone-rhdh-plugins
endif

.PHONY: clone-rhdh-plugins
clone-rhdh-plugins:
rm -rf ${RHDH_PLUGINS_TMP}; \
git clone --depth=1 https://github.com/redhat-developer/rhdh-plugins $(RHDH_PLUGINS_TMP) && \
echo "cloned to $(RHDH_PLUGINS_TMP)"

.PHONY: push-sandbox-plugin
push-sandbox-plugin:
$(MAKE) get-rhdh-plugins
cd $(RHDH_PLUGINS_TMP)/workspaces/sandbox && \
rm -rf plugins/sandbox/dist-dynamic && \
rm -rf red-hat-developer-hub-backstage-plugin-sandbox && \
yarn install && \
npx @janus-idp/cli@3.3.1 package package-dynamic-plugins \
--tag $(IMAGE_TO_PUSH_IN_QUAY) \
--platform $(PLATFORM) && \
podman push $(IMAGE_TO_PUSH_IN_QUAY)

.PHONY: clean-sandbox-ui
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)
clean-sandbox-ui:
@oc delete ns ${SANDBOX_UI_NS}
@oc delete secret ${OPENID_SECRET_NAME} -n openshift-config
@oc delete usersignup ${SSO_USERNAME} -n ${HOST_NS}

.PHONY: e2e-run-sandbox-ui
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)
e2e-run-sandbox-ui: RHDH=https://rhdh-${SANDBOX_UI_NS}.$(shell oc get ingress.config.openshift.io/cluster -o jsonpath='{.spec.domain}')
e2e-run-sandbox-ui:
@echo "Installing Playwright..."
.PHONY: e2e-run-devsandbox-dashboard
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)
e2e-run-devsandbox-dashboard: RHDH=https://rhdh-${DEVSANDBOX_DASHBOARD_NS}.$(shell oc get ingress.config.openshift.io/cluster -o jsonpath='{.spec.domain}')
e2e-run-devsandbox-dashboard:
$(eval PWGO_VER := $(shell grep -oE "playwright-go v\S+" go.mod | sed 's/playwright-go //g'))
@echo "Installing Playwright CLI version: $(PWGO_VER)"
go install github.com/playwright-community/playwright-go/cmd/playwright@$(PWGO_VER)
@echo "Installing Firefox browser for Playwright..."
$(GOPATH)/bin/playwright install firefox
Comment on lines 33 to 35
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that it wasn't changed in this PR so take it as an suggestion for later improvement.
There are two things:

  • I think that it would be better/reliable to use GOBIN variable instead of GOPATH
  • it could install playwright to a temp folder in the same way as we do it with ksctl:
    BIN_DIR := $(shell pwd)/build/_output/bin

    GOBIN=${BIN_DIR} CGO_ENABLED=0 go install github.com/kubesaw/ksctl/cmd/ksctl@master

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once we upgrade to Go 1.24 I think we will be able to use go tool
Something like:

# go.mod

go 1.24.0

tool github.com/playwright-community/playwright-go/cmd/playwright

and run it with:

go tool playwright install firefox


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

@echo "Running Developer Sandbox UI e2e tests in firefox..."
@echo "Running Developer Sandbox Dashboard e2e tests in firefox..."
@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
go test "./test/e2e/sandbox-ui" -v -timeout=10m -failfast
@oc delete usersignup $(SSO_USERNAME_READ) -n $(HOST_NS)

@echo "The Developer Sandbox UI e2e tests successfully finished"
@echo "The Developer Sandbox Dashboard e2e tests successfully finished"

.PHONY: test-devsandbox-dashboard-e2e
test-devsandbox-dashboard-e2e: get-and-publish-devsandbox-dashboard e2e-run-devsandbox-dashboard

.PHONY: test-ui-e2e
test-ui-e2e:
$(MAKE) deploy-sandbox-ui e2e-run-sandbox-ui ENVIRONMENT=${UI_ENVIRONMENT}
.PHONY: test-devsandbox-dashboard-e2e-local
test-devsandbox-dashboard-e2e-local:
$(MAKE) get-and-publish-devsandbox-dashboard e2e-run-devsandbox-dashboard UI_REPO_PATH=${PWD}/../devsandbox-dashboard PUBLISH_UI=true DEPLOY_UI=true

.PHONY: test-ui-e2e-local
test-ui-e2e-local:
$(MAKE) deploy-sandbox-ui e2e-run-sandbox-ui RHDH_PLUGINS_TMP=${PWD}/../rhdh-plugins ENVIRONMENT=${UI_ENVIRONMENT} PUSH_SANDBOX_IMAGE=true


UNIT_TEST_IMAGE_NAME=sandbox-ui-e2e-tests
UNIT_TEST_DOCKERFILE=build/sandbox-ui/Dockerfile
.PHONY: clean-devsandbox-dashboard
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)
clean-devsandbox-dashboard:
@oc delete ns ${DEVSANDBOX_DASHBOARD_NS}
@oc delete secret ${OPENID_SECRET_NAME} -n openshift-config
@oc delete usersignup ${SSO_USERNAME} -n ${HOST_NS}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

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

# Run Developer Sandbox UI e2e tests image using podman
.PHONY: test-sandbox-ui-in-container
test-sandbox-ui-in-container: build-sandbox-ui-e2e-tests
@echo "pushing Developer Sandbox UI image..."
$(MAKE) push-sandbox-plugin
E2E_TEST_IMAGE_NAME=devsandbox-dashboard-e2e-tests
E2E_TEST_DOCKERFILE=build/sandbox-ui/Dockerfile

# Build Developer Sandbox Dashboard e2e tests image using podman
.PHONY: build-devsandbox-dashboard-e2e-tests
build-devsandbox-dashboard-e2e-tests:
@echo "building the $(E2E_TEST_IMAGE_NAME) image with podman..."
podman build --platform $(IMAGE_PLATFORM) -t $(E2E_TEST_IMAGE_NAME) -f $(E2E_TEST_DOCKERFILE) .

# Run Developer Sandbox Dashboard e2e tests image using podman
.PHONY: test-devsandbox-dashboard-in-container
test-devsandbox-dashboard-in-container: build-devsandbox-dashboard-e2e-tests
ifneq ($(UI_REPO_PATH),)
$(eval FORCED_TAG := $(DATE_SUFFIX))
$(eval ABS_UI_REPO_PATH := $(abspath $(UI_REPO_PATH)))
@echo "Generated FORCED_TAG: $(FORCED_TAG)"
@echo "Using UI_REPO_PATH: $(ABS_UI_REPO_PATH)"
@echo "pushing Developer Dashboard image..."
$(MAKE) get-and-publish-devsandbox-dashboard PUBLISH_UI=true DEPLOY_UI=false FORCED_TAG=$(FORCED_TAG) UI_REPO_PATH=$(UI_REPO_PATH)
else
@echo "Skipping Developer Sandbox Dashboard publish - UI_REPO_PATH not set"
endif
@echo "running the e2e tests in podman container..."
podman run --platform $(PLATFORM) --rm \
podman run --platform $(IMAGE_PLATFORM) --rm \
-v $(KUBECONFIG):/root/.kube/config \
Comment thread
rsoaresd marked this conversation as resolved.
-e KUBECONFIG=/root/.kube/config \
-v ${PWD}:/root/toolchain-e2e \
-e E2E_REPO_PATH=/root/toolchain-e2e \
-v $(RHDH_PLUGINS_TMP):/root/rhdh-plugins \
-e RHDH_PLUGINS_TMP=/root/rhdh-plugins \
$(if $(ABS_UI_REPO_PATH),-v $(ABS_UI_REPO_PATH):/root/devsandbox-dashboard -e UI_REPO_PATH=/root/devsandbox-dashboard) \
$(if $(ABS_UI_REPO_PATH),-e FORCED_TAG=$(FORCED_TAG)) \
-e SSO_USERNAME=$(SSO_USERNAME) \
-e SSO_PASSWORD=$(SSO_PASSWORD) \
-e QUAY_NAMESPACE=$(QUAY_NAMESPACE) \
-e TMP=/tmp/ \
-e RUNNING_IN_CONTAINER=true \
$(UNIT_TEST_IMAGE_NAME)
-e DEPLOY_UI=true \
-e PUBLISH_UI=false \
$(E2E_TEST_IMAGE_NAME) make test-devsandbox-dashboard-e2e
8 changes: 5 additions & 3 deletions make/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ ifeq ($(CI),true)
# if we are running on CI, we want to run the ui e2e tests in the toolchain-e2e presubmit and periodic CI jobs
# if REPO_NAME is not set, it means that the e2e tests were triggered by the periodic CI job
ifeq ($(filter-out toolchain-e2e,$(REPO_NAME)),)
$(MAKE) test-ui-e2e
$(MAKE) test-devsandbox-dashboard-e2e
@echo "UI E2E tests successfully finished"
@echo "To clean the Developer Sandbox UI run 'make clean-sandbox-ui'"
@echo "To clean the Developer Sandbox Dashboard run 'make clean-devsandbox-dashboard'"
endif
endif

Expand Down Expand Up @@ -294,7 +294,9 @@ deploy-single-member-e2e-latest:

.PHONY: publish-current-bundles-for-e2e
## Target that is supposed to be called from CI - it builds & publishes the current operator bundles
publish-current-bundles-for-e2e: get-and-publish-operators
publish-current-bundles-for-e2e: PUBLISH_UI=true
publish-current-bundles-for-e2e: DEPLOY_UI=false
Comment on lines +297 to +298
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering, couldn't we use the same default values as we use for operators? - to keep it consistent

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

.PHONY: get-and-publish-operators
get-and-publish-operators: PUBLISH_OPERATOR=true
get-and-publish-operators: INSTALL_OPERATOR=false
get-and-publish-operators: clean-e2e-files get-and-publish-host-operator get-and-publish-member-operator

I set them in publish-current-bundles-for-e2e because the default values are the opposite: https://github.com/rsoaresd/toolchain-e2e/blob/refactor_pairing_with_ui/make/sandbox-ui.mk#L11-L12

publish-current-bundles-for-e2e: get-and-publish-operators get-and-publish-devsandbox-dashboard

.PHONY: get-and-publish-operators
get-and-publish-operators: PUBLISH_OPERATOR=true
Expand Down
Loading
Loading