Skip to content

Commit

Permalink
Update and Deploy Custom Playwright Image for OpenShift CI Integration (
Browse files Browse the repository at this point in the history
  • Loading branch information
subhashkhileri committed Apr 5, 2024
1 parent de24b7d commit ba276cf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
46 changes: 21 additions & 25 deletions .ibm/images/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
FROM cypress/browsers:node16.16.0-chrome107-ff107-edge
FROM mcr.microsoft.com/playwright:v1.40.0-jammy

ENV CI=1 \
QT_X11_NO_MITSHM=1 \
_X11_NO_MITSHM=1 \
_MITSHM=0 \
CYPRESS_CACHE_FOLDER=/root/.cache/Cypress \
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

# should be root user
RUN echo "whoami: $(whoami)" \
&& npm config -g set user $(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 \
&& npm install -g "cypress@12.3.0" \
&& (node -p "process.env.CI_XBUILD && process.arch === 'arm64' ? 'Skipping cypress verify on arm64 due to SIGSEGV.' : process.exit(1)" \
|| (cypress verify \
# Cypress cache and installed version
# should be in the root user's home folder
&& cypress cache path \
&& cypress cache list \
&& cypress info \
&& cypress version)) \
# 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 \
Expand All @@ -35,28 +28,20 @@ RUN echo "whoami: $(whoami)" \
# 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' \
# should print Cypress version
&& node -p 'module.paths'
# plus Electron and bundled Node versions
&& cypress version \
&& echo " node version: $(node -v) \n" \

RUN echo " node version: $(node -v) \n" \
"npm version: $(npm -v) \n" \
"yarn version: $(yarn -v) \n" \
"typescript version: $(tsc -v) \n" \
"debian version: $(cat /etc/debian_version) \n" \
"user: $(whoami) \n" \
"chrome: $(google-chrome --version || true) \n" \
"firefox: $(firefox --version || true) \n"
"user: $(whoami) \n"

RUN curl -fsSL https://clis.cloud.ibm.com/install/linux | sh && \
curl -sLO https://github.com/cli/cli/releases/download/v2.1.0/gh_2.1.0_linux_amd64.deb && \
apt install ./gh_2.1.0_linux_amd64.deb && \
curl -sLO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \
chmod +x kubectl && \
mv kubectl /usr/local/bin/ && \
curl -sLO https://raw.githubusercontent.com/cptmorgan-rh/install-oc-tools/master/install-oc-tools.sh > /dev/null && \
chmod +x install-oc-tools.sh && \
./install-oc-tools.sh --latest 4.11 && \
apt-get update -y && \
apt-get install -y sshpass jq colorized-logs && \
rm -rf /var/lib/apt/lists/*
Expand All @@ -75,6 +60,17 @@ RUN apt-get update && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install Helm
RUN curl -fsSL -o /tmp/helm.tar.gz "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz" \
&& tar -xzvf /tmp/helm.tar.gz -C /tmp \
&& mv /tmp/linux-amd64/helm /usr/local/bin/helm \
&& rm -rf /tmp/*

# Install OpenShift CLI (oc)
RUN curl -fsSL -o /tmp/openshift-client-linux.tar.gz "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/${OC_VERSION}/openshift-client-linux-${OC_VERSION}.tar.gz" \
&& tar -xzvf /tmp/openshift-client-linux.tar.gz -C /usr/local/bin oc kubectl \
&& rm -rf /tmp/*

# Set environment variables to make Go work correctly
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
Expand All @@ -83,4 +79,4 @@ RUN go install github.com/kadel/pr-commenter@latest && \
ibmcloud plugin install -f cloud-object-storage && \
ibmcloud plugin install -f kubernetes-service

ENTRYPOINT ["cypress", "run"]
WORKDIR /tmp/
6 changes: 6 additions & 0 deletions .ibm/pipelines/openshift-ci-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
# fail if some commands fails
set -e
# show commands
set -x
echo "Place holder to run openshift-ci-tests"

0 comments on commit ba276cf

Please sign in to comment.