Skip to content

Commit

Permalink
chore(e2e): fix e2e tests (#1869)
Browse files Browse the repository at this point in the history
* chore(e2e): remove reference to pull secret

* chore(deps): update rbac backend plugin

* fix(gitlab): update gitlab backend dynamic to use createBackendFeatureLoader

* chore(e2e): add dependencies to ibm env script

* fix(scaffolder-module-utils): fix failing dynamic plugin

* fix(scaffolder-module-http-request): fix failing dynamic plugin

* fix(roadiehq-argocd): fix failing dynamic plugin

* fix(analytics-segment): fix export to the correct plugin

* chore(e2e): clean up some values and config for tests

* chore(e2e): disable tech radar backend plugin

* chore(e2e): fix failing analytics test

* chore(e2e): add back env variable for init container

* fix(rbac): fix dynamic plugin configuration

* fix(bulk-import): fix dynamic plugin configuration

* chore(e2e): revert extraVolumes and extraVolumeMounts for showcase rbac setup

* chore(e2e): fix failing rbac analytics test

* chore(e2e): fix some failing rbac tests

* chore(e2e): some more fixes to some of the failing tests

* chore(e2e): disable flakey scaffolder tests

* add hook for clickOnGHloginPopup

* introduce checkAndClickOnGHloginPopup

* adding checkAndClickOnGHloginPopup on every github login test

* chore(e2e): fix some of the flakiness from github popup

---------

Co-authored-by: Nil Gallego <[email protected]>
  • Loading branch information
PatAKnight and nilgaar authored Nov 6, 2024
1 parent df3c6fa commit e3bcb85
Show file tree
Hide file tree
Showing 41 changed files with 254 additions and 1,301 deletions.
45 changes: 25 additions & 20 deletions .ibm/images/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,40 @@
FROM mcr.microsoft.com/playwright:v1.47.2-jammy

ENV CI=1 \
QT_X11_NO_MITSHM=1 \
_X11_NO_MITSHM=1 \
_MITSHM=0 \
NODE_PATH=/usr/local/lib/node_modules
QT_X11_NO_MITSHM=1 \
_X11_NO_MITSHM=1 \
_MITSHM=0 \
NODE_PATH=/usr/local/lib/node_modules

# Define Helm and OpenShift CLI (oc) versions
ENV HELM_VERSION="v3.12.3"
ENV OC_VERSION="4.14.3"

ARG CI_XBUILD

RUN apt-get update && \
apt-get install -y nodejs-dev nodejs \
openssl libssl-dev ca-certificates make cmake cpp gcc g++ zlib1g zlib1g-dev brotli libbrotli-dev python3 && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# should be root user
RUN echo "whoami: $(whoami)" \
# command "id" should print:
# uid=0(root) gid=0(root) groups=0(root)
# which means the current user is root
&& id \
&& npm install -g typescript \
# give every user read access to the "/root" folder where the binary is cached
# we really only need to worry about the top folder, fortunately
&& ls -la /root \
&& chmod 755 /root \
# always grab the latest Yarn
# otherwise the base image might have old versions
# NPM does not need to be installed as it is already included with Node.
&& npm i -g yarn@latest \
# Show where Node loads required modules from
&& node -p 'module.paths'
# plus Electron and bundled Node versions
# command "id" should print:
# uid=0(root) gid=0(root) groups=0(root)
# which means the current user is root
&& id \
&& npm install -g typescript \
# give every user read access to the "/root" folder where the binary is cached
# we really only need to worry about the top folder, fortunately
&& ls -la /root \
&& chmod 755 /root \
# always grab the latest Yarn
# otherwise the base image might have old versions
# NPM does not need to be installed as it is already included with Node.
&& npm i -g yarn@latest \
# Show where Node loads required modules from
&& node -p 'module.paths'
# plus Electron and bundled Node versions

RUN echo " node version: $(node -v) \n" \
"npm version: $(npm -v) \n" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ data:
p, role:xyz/team_a, catalog.location.create, create, allow
p, role:xyz/team_a, catalog.location.read, read, allow
p, role:default/rbac_admin, kubernetes.proxy, use, allow
p, role:default/rbac_admin, catalog-entity, read, allow
p, role:default/rbac_admin, catalog.entity.create, create, allow
p, role:default/rbac_admin, catalog.location.create, create, allow
p, role:default/rbac_admin, catalog.location.read, read, allow
p, role:default/rbac_admin, policy-entity, read, allow
p, role:default/rbac_admin, policy-entity, create, allow
g, user:default/rhdh-qe-user, role:default/qe_rbac_admin
p, role:default/qe_rbac_admin, kubernetes.proxy, use, allow
p, role:default/qe_rbac_admin, catalog.entity.create, create, allow
p, role:default/qe_rbac_admin, catalog.location.create, create, allow
p, role:default/qe_rbac_admin, catalog.location.read, read, allow
p, role:default/bulk_import, bulk.import, use, allow
p, role:default/bulk_import, catalog.location.create, create, allow
p, role:default/bulk_import, catalog.entity.create, create, allow
Expand Down
81 changes: 12 additions & 69 deletions .ibm/pipelines/value_files/values_showcase-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ global:
kubernetes:
clusterLocatorMethods:
- clusters:
- authProvider: serviceAccount
name: 'my-cluster'
serviceAccountToken: ${K8S_SERVICE_ACCOUNT_TOKEN}
url: ${K8S_CLUSTER_API_SERVER_URL}
- authProvider: serviceAccount
name: 'my-cluster'
serviceAccountToken: ${K8S_SERVICE_ACCOUNT_TOKEN}
url: ${K8S_CLUSTER_API_SERVER_URL}
type: config
customResources:
# Add for tekton
Expand Down Expand Up @@ -99,30 +99,13 @@ global:
# Enable tech-radar plugin.
- package: ./dynamic-plugins/dist/backstage-community-plugin-tech-radar
disabled: false
- package: ./dynamic-plugins/dist/backstage-community-plugin-tech-radar-backend-dynamic
disabled: false
- package: ./dynamic-plugins/dist/backstage-community-plugin-tech-radar-backend-dynamic
disabled: true
- package: ./dynamic-plugins/dist/janus-idp-backstage-plugin-rbac
disabled: false
- package: ./dynamic-plugins/dist/janus-idp-backstage-plugin-analytics-provider-segment
disabled: true

# this value will be overriden by 'helm install .... --set global.clusterRouterBase=value'
# -- Shorthand for users who do not want to specify a custom HOSTNAME. Used ONLY with the DEFAULT upstream.backstage.appConfig value and with OCP Route enabled.
clusterRouterBase: apps.example.com
# -- Custom hostname shorthand, overrides `global.clusterRouterBase`, `upstream.ingress.host`, `route.host`, and url values in `upstream.backstage.appConfig`
host: ''
# -- Enable service authentication within Backstage instance
auth:
# -- Backend service to service authentication
# <br /> Ref: https://backstage.io/docs/auth/service-to-service-auth/
backend:
# -- Enable backend service to service authentication, unless configured otherwise it generates a secret value
enabled: true
# -- Instead of generating a secret value, refer to existing secret
existingSecret: ''
# -- Instead of generating a secret value, use folowing value
value: ''

# -- Upstream Backstage [chart configuration](https://github.com/backstage/charts/blob/main/charts/backstage/values.yaml)
# @default -- Use Openshift compatible settings
upstream:
Expand All @@ -132,20 +115,10 @@ upstream:
backstage:
image:
pullPolicy: Always
pullSecrets:
- rhdh-pull-secret
# using test image from https://quay.io/repository/janus-idp/backstage-showcase
registry: quay.io
repository: janus-idp/backstage-showcase
tag: next
command: []
# FIXME (tumido): USE POSTGRES_PASSWORD and POSTGRES_USER instead of POSTGRES_ADMIN_PASSWORD
# This is a hack. In {fedora,rhel}/postgresql images, regular user is forbidden
# from creating DBs in runtime. A single DB can be created ahead of time via
# POSTGRESQL_DATABASE env variable (in this case via
# upstream.postgresql.primary.extraEnvVars value), but this doesn't allow us to
# create multiple DBs. Since Backstage requires by default 5 different DBs, we
# can't accommodate that properly.
appConfig:
app:
# Please update to match host in case you don't want to configure hostname via `global.clusterRouterBase` or `global.host`.
Expand All @@ -171,26 +144,6 @@ upstream:
auth:
keys:
- secret: ${BACKEND_SECRET}
readinessProbe:
failureThreshold: 3
httpGet:
path: /healthcheck
port: 7007
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 2
timeoutSeconds: 2
livenessProbe:
failureThreshold: 3
httpGet:
path: /healthcheck
port: 7007
scheme: HTTP
initialDelaySeconds: 60
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 2
extraEnvVars:
- name: BACKEND_SECRET
valueFrom:
Expand All @@ -200,10 +153,6 @@ upstream:
# disable telemetry in CI
- name: SEGMENT_TEST_MODE
value: 'true'
args:
# This additional `app-config` file is generated by the initContainer below, and contains the merged configuration of installed dynamic plugins.
- '--config'
- dynamic-plugins-root/app-config.dynamic-plugins.yaml
extraVolumeMounts:
# The initContainer below will install dynamic plugins in this volume mount.
- name: dynamic-plugins-root
Expand All @@ -227,12 +176,6 @@ upstream:
# could be changed to a [generic ephemeral volume](https://docs.openshift.com/container-platform/4.13/storage/generic-ephemeral-vols.html#generic-ephemeral-vols-procedure_generic-ephemeral-volumes).
- name: dynamic-plugins-root
emptyDir: {}
- name: rbac-policy
configMap:
defaultMode: 420
name: rbac-policy
- name: rbac-conditions
emptyDir: {}
# Volume that will expose the `dynamic-plugins.yaml` file from the `dynamic-plugins` config map.
# The `dynamic-plugins` config map is created by the helm chart from the content of the `global.dynamic` field.
- name: dynamic-plugins
Expand All @@ -250,6 +193,12 @@ upstream:
- name: postgress-external-db-cluster-cert
secret:
secretName: postgress-external-db-cluster-cert
- name: rbac-policy
configMap:
defaultMode: 420
name: rbac-policy
- name: rbac-conditions
emptyDir: {}
initContainers:
- name: install-dynamic-plugins
# -- Image used by the initContainer to install dynamic plugins into the `dynamic-plugins-root` volume mount.
Expand Down Expand Up @@ -313,10 +262,6 @@ upstream:
name: rbac-conditions
workingDir: /opt/app-root/src
installDir: /opt/app-root/src
podAnnotations:
checksum/dynamic-plugins: >-
{{- include "common.tplvalues.render" ( dict "value"
.Values.global.dynamic "context" $) | sha256sum }}
extraAppConfig:
- configMapRef: app-config-rhdh
filename: app-config-rhdh.yaml
Expand All @@ -327,5 +272,3 @@ upstream:
enabled: false
auth:
existingSecret: postgres-cred
ingress:
host: '{{ .Values.global.host }}'
Loading

0 comments on commit e3bcb85

Please sign in to comment.