-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test-e2e-openshift and make it green…
… even if it's fake. Signed-off-by: Vincent Demeester <[email protected]>
- Loading branch information
1 parent
c93994d
commit 574ee9c
Showing
6 changed files
with
133 additions
and
0 deletions.
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
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,12 @@ | ||
#!/bin/sh -e | ||
|
||
# This is documented here: | ||
# https://docs.openshift.com/container-platform/3.11/creating_images/guidelines.html#openshift-specific-guidelines | ||
|
||
if ! whoami &>/dev/null; then | ||
if [ -w /etc/passwd ]; then | ||
echo "${USER_NAME}:x:$(id -u):$(id -g):${USER_NAME} user:${HOME}:/sbin/nologin" >> /etc/passwd | ||
fi | ||
fi | ||
|
||
exec ${ENTRY_CMD} $@ |
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,14 @@ | ||
#!/bin/sh | ||
set -x | ||
|
||
# ensure $HOME exists and is accessible by group 0 (we don't know what the runtime UID will be) | ||
mkdir -p ${HOME} | ||
chown -R ${USER_UID}:0 ${HOME} | ||
chmod ug+rwx ${HOME} | ||
chmod -R uga+rw ${HOME} | ||
|
||
# runtime user will need to be able to self-insert in /etc/passwd | ||
chmod uga+rw /etc/passwd | ||
|
||
# no need for this script to remain in the image after running | ||
rm $0 |
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,22 @@ | ||
# This Docerfile is the environment where the test will be run in. | ||
FROM registry.ci.openshift.org/openshift/release:golang-1.20 | ||
|
||
# Add kubernetes repository | ||
ADD ci/kubernetes.repo /etc/yum.repos.d/ | ||
|
||
RUN yum install -y kubectl httpd-tools jq make git which | ||
RUN rpm -Uvh https://github.com/tektoncd/cli/releases/download/v0.33.0/tektoncd-cli-0.33.0_Linux-64bit.rpm | ||
|
||
# Serverless-Operator `make generated-files` needs helm | ||
RUN curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash | ||
|
||
RUN GOFLAGS='' go install github.com/mikefarah/yq/v3@latest | ||
|
||
# go install creates $GOPATH/.cache with root permissions, we delete it here | ||
# to avoid permission issues with the runtime users | ||
RUN rm -rf $GOPATH/.cache | ||
|
||
# Allow runtime users to add entries to /etc/passwd | ||
RUN chmod g+rw /etc/passwd | ||
|
||
ADD . . |
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,7 @@ | ||
[kubernetes] | ||
name=Kubernetes | ||
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 | ||
enabled=1 | ||
gpgcheck=1 | ||
repo_gpgcheck=0 | ||
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg |
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,69 @@ | ||
#!/usr/bin/env bash | ||
# Install OpenShift Pipelines on the current cluster | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
readonly export DEPLOYMENT_TIMEOUT="${DEPLOYMENT_TIMEOUT:-5m}" | ||
|
||
function fail() { | ||
echo "ERROR: ${*}" >&2 | ||
exit 1 | ||
} | ||
|
||
function rollout_status() { | ||
local namespace="${1}" | ||
local deployment="${2}" | ||
|
||
if ! kubectl --namespace="${namespace}" --timeout=${DEPLOYMENT_TIMEOUT} \ | ||
rollout status deployment "${deployment}"; then | ||
fail "'${namespace}/${deployment}' is not deployed as expected!" | ||
fi | ||
} | ||
|
||
OSP_VERSION=${1:-latest} | ||
shift | ||
|
||
CHANNEL="" | ||
|
||
case "$OSP_VERSION" in | ||
nightly) | ||
echo "Not supporting nightly just yet" | ||
# FIXME add support for it | ||
exit 0 | ||
;; | ||
latest) | ||
CHANNEL="latest" | ||
;; | ||
*) | ||
CHANNEL="pipelines-$OSP_VERSION" | ||
;; | ||
esac | ||
|
||
echo "Installing OpenShift Pipelines from channel ${CHANNEL}" | ||
cat <<EOF | oc apply -f- | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: openshift-pipelines-operator-rh | ||
namespace: openshift-operators | ||
spec: | ||
channel: ${CHANNEL} | ||
name: openshift-pipelines-operator-rh | ||
source: redhat-operators | ||
sourceNamespace: openshift-marketplace | ||
EOF | ||
|
||
# FIXME(vdemeester) do better than waiting 2m for the namespace to appear | ||
echo "Waiting for OpenShift Pipelines Operator to be available" | ||
sleep 120 | ||
|
||
rollout_status "openshift-pipelines" "tekton-pipelines-controller" | ||
rollout_status "openshift-pipelines" "tekton-pipelines-webhook" | ||
|
||
oc get -n openshift-pipelines pods | ||
tkn version | ||
|
||
# Make sure we are on the default project | ||
oc project default |