-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from Intersmash/openshift-ci.exp
Onboarding Intersmash on OpenShift CI
- Loading branch information
Showing
3 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters