Skip to content

Commit efd929e

Browse files
rsoaresdmfranciscKubeSaw
authored
SANDBOX-1162: deploy and test Developer Sandbox UI in e2e mode (codeready-toolchain#1148)
* deploy sandbox ui in e2e mode * requested changes * delete * fix * add e2e tests recaptcha * disabled verification * switch to quay * clean * add oauth-idp * # This is a combination of 2 commits. # This is the 1st commit message: improvements # This is the commit message codeready-toolchain#2: improvements * clean * improvements * improvements * improve * improve * add e2e tests (translated from ts to go) + improvements * update comment * improve docs * update docs * requested changes - improvements * requested changes * improvements * improvements * update app-config and address cookies consent on the tests * add comment * improvements * delete log file * requested changes * requested changes * prepare Dockerfile.tools * Running E2E Tests against prod * clean * requested changes --------- Co-authored-by: Francisc Munteanu <fmuntean@redhat.com> Co-authored-by: KubeSaw <devsandbox@redhat.com>
1 parent 1f53150 commit efd929e

File tree

30 files changed

+1585
-30
lines changed

30 files changed

+1585
-30
lines changed

.gitignore

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

342+
# custom .env file for Developer Sandbox UI E2E tests
343+
testsupport/sandbox-ui/.env
344+
345+
# trace folder for Developer Sandbox UI E2E tests
346+
trace/
347+
342348
# End of https://www.gitignore.io/api/go,vim,git,macos,linux,emacs,windows,eclipse,intellij+all,visualstudiocode

build/sandbox-ui/Dockerfile

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
FROM registry.access.redhat.com/ubi9/ubi:latest as build-tools
2+
3+
LABEL maintainer="Developer Sandbox <devsandbox@redhat.com>"
4+
LABEL author="Developer Sandbox <devsandbox@redhat.com>"
5+
6+
ENV GOPATH=/tmp/go \
7+
GOCACHE=/tmp/.cache \
8+
PATH=$PATH:$GOPATH/bin \
9+
GIT_COMMITTER_NAME="Developer Sandbox" \
10+
GIT_COMMITTER_EMAIL=devsandbox@redhat.com \
11+
GOLANG_VERSION=go1.22.12 \
12+
GOLANG_SHA256=4fa4f869b0f7fc6bb1eb2660e74657fbf04cdd290b5aef905585c86051b34d43
13+
14+
# Install additional tools
15+
# gettext for envsubst
16+
RUN yum install -y \
17+
findutils \
18+
git \
19+
make \
20+
gettext \
21+
procps-ng \
22+
tar \
23+
wget \
24+
which \
25+
jq \
26+
gcc \
27+
gcc-c++ \
28+
python3 \
29+
python3-devel \
30+
sqlite-devel && \
31+
yum clean all
32+
33+
# Install kustomize
34+
RUN curl -s https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh | bash \
35+
&& mv kustomize /usr/local/bin
36+
37+
# Install Node.js 22 and yarn
38+
RUN curl -fsSL https://rpm.nodesource.com/setup_22.x | bash - && \
39+
yum install -y nodejs && \
40+
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo && \
41+
yum install -y yarn && \
42+
yum clean all
43+
44+
# Install oc CLI
45+
RUN curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux.tar.gz && \
46+
tar -xzvf openshift-client-linux.tar.gz -C /usr/local/bin oc && \
47+
chmod +x /usr/local/bin/oc && \
48+
rm -f openshift-client-linux.tar.gz
49+
50+
# Download, verify, and install Go
51+
ENV PATH=$PATH:/usr/local/go/bin
52+
WORKDIR /tmp
53+
RUN curl -Lo ${GOLANG_VERSION}.linux-amd64.tar.gz https://dl.google.com/go/${GOLANG_VERSION}.linux-amd64.tar.gz \
54+
&& echo "${GOLANG_SHA256} ${GOLANG_VERSION}.linux-amd64.tar.gz" > ${GOLANG_VERSION}.linux-amd64.sha256 \
55+
&& sha256sum -c ${GOLANG_VERSION}.linux-amd64.sha256 \
56+
&& tar -C /usr/local -xzf ${GOLANG_VERSION}.linux-amd64.tar.gz \
57+
&& rm -f ${GOLANG_VERSION}.linux-amd64.tar.gz \
58+
&& go version
59+
60+
WORKDIR /app
61+
62+
# Increase shared memory for browsers (recommended for Playwright)
63+
RUN mkdir -p /dev/shm && chmod 1777 /dev/shm
64+
65+
COPY . .
66+
67+
# Install Firefox required dependencies
68+
RUN yum install -y \
69+
libxcb \
70+
libX11 \
71+
libXext \
72+
libXrandr \
73+
libXcomposite \
74+
libXcursor \
75+
libXdamage \
76+
libXfixes \
77+
libXi \
78+
gtk3 \
79+
pango \
80+
atk \
81+
cairo \
82+
gdk-pixbuf2 \
83+
libXrender \
84+
alsa-lib \
85+
freetype \
86+
fontconfig && \
87+
yum clean all
88+
89+
CMD ["make", "test-ui-e2e"]
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
apiVersion: toolchain.dev.openshift.com/v1alpha1
2+
kind: ToolchainConfig
3+
metadata:
4+
name: config
5+
spec:
6+
host:
7+
automaticApproval:
8+
enabled: true
9+
deactivation:
10+
deactivationDomainsExcluded: "@excluded.com"
11+
environment: "ui-e2e-tests"
12+
notifications:
13+
durationBeforeNotificationDeletion: "5s"
14+
registrationService:
15+
analytics:
16+
devSpaces:
17+
segmentWriteKey: "test devspaces segment write key"
18+
segmentWriteKey: "test sandbox segment write key"
19+
auth:
20+
authClientConfigRaw: '{ "realm": "sandbox-dev", "auth-server-url": "https://sso.devsandbox.dev/auth", "ssl-required": "none", "resource": "sandbox-public", "clientId": "sandbox-public", "public-client": true }'
21+
authClientLibraryURL: "https://sso.devsandbox.dev/auth/js/keycloak.js"
22+
authClientPublicKeysURL: "https://sso.devsandbox.dev/auth/realms/sandbox-dev/protocol/openid-connect/certs"
23+
ssoBaseURL: "https://sso.devsandbox.dev"
24+
ssoRealm: sandbox-dev
25+
environment: dev
26+
# same number that is set in https://github.com/codeready-toolchain/host-operator/blob/master/deploy/registration-service/registration-service.yaml#L272-L273
27+
replicas: 3
28+
verification:
29+
enabled: false
30+
excludedEmailDomains: "redhat.com,acme.com"
31+
secret:
32+
ref: "host-operator-secret"
33+
twilioAccountSID: "twilio.account.sid"
34+
twilioAuthToken: "twilio.auth.token"
35+
twilioFromNumber: "twilio.from_number"
36+
spaceConfig:
37+
spaceRequestEnabled: true
38+
spaceBindingRequestEnabled: true
39+
tiers:
40+
durationBeforeChangeTierRequestDeletion: "5s"
41+
defaultSpaceTier: "base1ns"
42+
featureToggles:
43+
- name: "test-feature"
44+
weight: 100
45+
toolchainStatus:
46+
toolchainStatusRefreshTime: "1s"
47+
members:
48+
default:
49+
autoscaler:
50+
bufferMemory: "50Mi"
51+
bufferCPU: "15m"
52+
bufferReplicas: 2
53+
deploy: true
54+
memberStatus:
55+
refreshPeriod: "1s"
56+
webhook:
57+
secret:
58+
ref: "member-operator-secret"
59+
virtualMachineAccessKey: "vm.access"
60+
environment: "ui-e2e-tests"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: member-operator-secret
5+
type: Opaque
6+
stringData:
7+
vm.access: ssh-rsa PcHUNFXhysGvTnvORVbR70EVZA test@host-operator
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
kind: Deployment
2+
apiVersion: apps/v1
3+
metadata:
4+
name: rhdh
5+
namespace: ${SANDBOX_UI_NS}
6+
labels:
7+
app.kubernetes.io/instance: rhdh
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app.kubernetes.io/instance: rhdh
13+
template:
14+
metadata:
15+
labels:
16+
app.kubernetes.io/instance: rhdh
17+
spec:
18+
restartPolicy: Always
19+
initContainers:
20+
- name: install-dynamic-plugins
21+
command:
22+
- ./install-dynamic-plugins.sh
23+
- /dynamic-plugins-root
24+
env:
25+
- name: NPM_CONFIG_USERCONFIG
26+
value: /opt/app-root/src/.npmrc.dynamic-plugins
27+
resources:
28+
limits:
29+
cpu: "1"
30+
ephemeral-storage: 5Gi
31+
memory: 2560Mi
32+
requests:
33+
cpu: 250m
34+
memory: 256Mi
35+
terminationMessagePath: /dev/termination-log
36+
securityContext:
37+
capabilities:
38+
drop:
39+
- ALL
40+
runAsNonRoot: true
41+
allowPrivilegeEscalation: false
42+
seccompProfile:
43+
type: RuntimeDefault
44+
imagePullPolicy: Always
45+
volumeMounts:
46+
- name: dynamic-plugins-root
47+
mountPath: /dynamic-plugins-root
48+
- name: dynamic-plugins
49+
readOnly: true
50+
mountPath: /opt/app-root/src/dynamic-plugins.yaml
51+
subPath: dynamic-plugins.yaml
52+
- name: dynamic-plugins-npmrc
53+
readOnly: true
54+
mountPath: /opt/app-root/src/.npmrc.dynamic-plugins
55+
subPath: .npmrc
56+
- name: dynamic-plugins-registry-auth
57+
readOnly: true
58+
mountPath: /opt/app-root/src/.config/containers
59+
- name: npmcacache
60+
mountPath: /opt/app-root/src/.npm/_cacache
61+
terminationMessagePolicy: File
62+
image: "registry.redhat.io/rhdh/rhdh-hub-rhel9@sha256:79618b38d6f02457954b227d538e238fdebbb72a220af5bd6be3cfab3ad0f262"
63+
workingDir: /opt/app-root/src
64+
serviceAccountName: rhdh
65+
schedulerName: default-scheduler
66+
terminationGracePeriodSeconds: 30
67+
securityContext: {}
68+
containers:
69+
- name: backstage-backend
70+
args:
71+
- "--config"
72+
- dynamic-plugins-root/app-config.dynamic-plugins.yaml
73+
- "--config"
74+
- /opt/app-root/src/app-config-from-configmap.yaml
75+
env:
76+
- name: APP_CONFIG_backend_listen_port
77+
value: "7007"
78+
ports:
79+
- name: backend
80+
containerPort: 7007
81+
protocol: TCP
82+
imagePullPolicy: Always
83+
image: "registry.redhat.io/rhdh/rhdh-hub-rhel9:1.5"
84+
resources:
85+
limits:
86+
cpu: "1"
87+
ephemeral-storage: 5Gi
88+
memory: 2560Mi
89+
requests:
90+
cpu: 250m
91+
memory: 1Gi
92+
readinessProbe:
93+
httpGet:
94+
path: /.backstage/health/v1/readiness
95+
port: backend
96+
scheme: HTTP
97+
timeoutSeconds: 4
98+
periodSeconds: 10
99+
successThreshold: 2
100+
failureThreshold: 3
101+
terminationMessagePath: /dev/termination-log
102+
livenessProbe:
103+
httpGet:
104+
path: /.backstage/health/v1/liveness
105+
port: backend
106+
scheme: HTTP
107+
timeoutSeconds: 4
108+
periodSeconds: 10
109+
successThreshold: 1
110+
failureThreshold: 3
111+
securityContext:
112+
capabilities:
113+
drop:
114+
- ALL
115+
runAsNonRoot: true
116+
allowPrivilegeEscalation: false
117+
seccompProfile:
118+
type: RuntimeDefault
119+
startupProbe:
120+
httpGet:
121+
path: /.backstage/health/v1/liveness
122+
port: backend
123+
scheme: HTTP
124+
initialDelaySeconds: 30
125+
timeoutSeconds: 4
126+
periodSeconds: 20
127+
successThreshold: 1
128+
failureThreshold: 3
129+
volumeMounts:
130+
- name: backstage-app-config
131+
mountPath: /opt/app-root/src/app-config-from-configmap.yaml
132+
subPath: app-config.yaml
133+
- name: dynamic-plugins-root
134+
mountPath: /opt/app-root/src/dynamic-plugins-root
135+
terminationMessagePolicy: File
136+
serviceAccount: rhdh
137+
volumes:
138+
- name: dynamic-plugins-root
139+
emptyDir: {}
140+
- name: dynamic-plugins
141+
configMap:
142+
name: rhdh-dynamic-plugins
143+
defaultMode: 420
144+
optional: true
145+
- name: dynamic-plugins-npmrc
146+
secret:
147+
secretName: rhdh-dynamic-plugins-npmrc
148+
defaultMode: 420
149+
optional: true
150+
- name: dynamic-plugins-registry-auth
151+
secret:
152+
secretName: rhdh-dynamic-plugins-registry-auth
153+
defaultMode: 416
154+
optional: true
155+
- name: npmcacache
156+
emptyDir: {}
157+
- name: backstage-app-config
158+
configMap:
159+
name: rhdh-app-config
160+
defaultMode: 420
161+
dnsPolicy: ClusterFirst
162+
strategy:
163+
type: RollingUpdate
164+
rollingUpdate:
165+
maxUnavailable: 25%
166+
maxSurge: 25%
167+
revisionHistoryLimit: 10
168+
progressDeadlineSeconds: 600
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
resources:
5+
- service-accounts.yaml
6+
- deployment.yaml
7+
- service.yaml
8+
- route.yaml
9+
10+
generatorOptions:
11+
disableNameSuffixHash: true

deploy/sandbox-ui/base/route.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
kind: Route
2+
apiVersion: route.openshift.io/v1
3+
metadata:
4+
name: rhdh
5+
namespace: ${SANDBOX_UI_NS}
6+
labels:
7+
app.kubernetes.io/instance: rhdh
8+
spec:
9+
path: /
10+
to:
11+
kind: Service
12+
name: rhdh
13+
weight: 100
14+
port:
15+
targetPort: http-backend
16+
tls:
17+
termination: edge
18+
insecureEdgeTerminationPolicy: Redirect
19+
wildcardPolicy: None
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: rhdh
5+
namespace: ${SANDBOX_UI_NS}

0 commit comments

Comments
 (0)