Skip to content

Commit

Permalink
Merge pull request #18 from Intersmash/openshift-ci.exp
Browse files Browse the repository at this point in the history
Onboarding Intersmash on OpenShift CI
  • Loading branch information
simkam authored Apr 5, 2023
2 parents 05bf9a6 + bb4c149 commit 381cdef
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 1 deletion.
37 changes: 37 additions & 0 deletions .ci/openshift-ci/build-root/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Use the centos image as the base image
FROM quay.io/centos/centos:stream8

# Install additional tooling, see https://github.com/openshift/release/blob/master/clusters/app.ci/supplemental-ci-images/ci-tools-build-root.yaml#L338
RUN INSTALL_PKGS="git java-17-openjdk.x86_64 httpd-tools" && \
dnf install -y $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
dnf clean all && \
touch /os-build-image

# Downloading and installing Maven
ARG MAVEN_VERSION=3.8.8
ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries

RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
&& echo "Downlaoding maven" \
&& curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
\
&& echo "Unziping maven" \
&& tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
\
&& echo "Cleaning and setting links" \
&& rm -f /tmp/apache-maven.tar.gz \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn

ENV MAVEN_HOME /usr/share/maven
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"

# Downloading and installing the OpenShift CLI
ENV OC_PKG=https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest-4.12/openshift-client-linux.tar.gz \
OC_HOME=/usr/oc/oc-4.1.2

RUN set -eux; \
curl -L --output /tmp/oc.tgz "$OC_PKG"; \
mkdir -p "$OC_HOME"; \
tar --extract --file /tmp/oc.tgz --directory "$OC_HOME"; \
ln -s "$OC_HOME"/oc /usr/bin/oc
52 changes: 52 additions & 0 deletions .ci/openshift-ci/build-root/e2e-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

#!/usr/bin/env bash
# exit immediately when a command fails
set -e
# only exit with zero if all commands of the pipeline exit successfully
set -o pipefail
# error on unset variables
set -u
# print each command before executing it
set -x

printenv KUBECONFIG
printenv KUBEADMIN_PASSWORD_FILE
oc get node
oc config view
oc whoami

export TEST_ADMIN_USERNAME=tadmin
export TEST_ADMIN_PASSWORD=adminpwd

export TEST_USER_USERNAME=tadmin
export TEST_USER_PASSWORD=userpwd

export HTPASSWD_FILE=users.htpasswd
htpasswd -c -B -b $HTPASSWD_FILE $TEST_ADMIN_USERNAME $TEST_ADMIN_PASSWORD
htpasswd -b $HTPASSWD_FILE $TEST_USER_USERNAME $TEST_USER_PASSWORD
cat $HTPASSWD_FILE
oc create secret generic htpass-secret-2 --from-file=htpasswd=$HTPASSWD_FILE -n openshift-config
oc patch OAuth cluster -p '{"spec": {"identityProviders": [{"htpasswd": {"fileData": {"name": "htpass-secret-2"}},"mappingMethod": "claim","name": "my_htpasswd_provider","type": "HTPasswd"}]}}' --type=merge
oc adm policy add-cluster-role-to-user cluster-admin $TEST_ADMIN_USERNAME

export TEST_CLUSTER_URL=$(oc whoami --show-server)
export TEST_NAMESPACE=intersmash-test

oc new-project $TEST_NAMESPACE

cat >> test.properties <<EOL
xtf.openshift.url=${TEST_CLUSTER_URL}
xtf.openshift.namespace=${TEST_NAMESPACE}
xtf.bm.namespace=${TEST_NAMESPACE}
xtf.openshift.admin.username=${TEST_ADMIN_USERNAME}
xtf.openshift.admin.password=${TEST_ADMIN_PASSWORD}
xtf.openshift.master.username=${TEST_USER_USERNAME}
xtf.openshift.master.password=${TEST_USER_PASSWORD}
EOL

cat test.properties

mkdir local-repo
mvn clean install -Dmaven.repo.local=./local-repo -DskipTests
mvn clean test -Dmaven.repo.local=./local-repo -pl testsuite/ -am
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@
<argLine>${client.jvm.jpms.args}</argLine>
<!-- Also, let's set some additional configuration that is common to all dependent modules -->
<trimStackTrace>false</trimStackTrace>
<testFailureIgnore>true</testFailureIgnore>
<failIfNoTests>false</failIfNoTests>
<systemPropertyVariables>
<wildfly.ee-feature-pack.location>${wildfly.ee-feature-pack.location}</wildfly.ee-feature-pack.location>
Expand Down

0 comments on commit 381cdef

Please sign in to comment.