Login using OCP token for e2e tests (#675)
* Login using OCP token for e2e tests Signed-off-by: Anatolii Bazko <abazko@redhat.com> * Use different operator image name Signed-off-by: Anatolii Bazko <abazko@redhat.com> * Fix operator image name Signed-off-by: Anatolii Bazko <abazko@redhat.com>pull/597/head
parent
c2f4c75fde
commit
54307805b1
|
|
@ -28,7 +28,8 @@ runTests() {
|
|||
waitWorkspaceStart
|
||||
}
|
||||
|
||||
init
|
||||
initDefaults
|
||||
initOpenShiftDefaults
|
||||
provisionOpenShiftOAuthUser
|
||||
initStableTemplates "openshift" "stable"
|
||||
runTests
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ runTests() {
|
|||
waitWorkspaceStart
|
||||
}
|
||||
|
||||
init
|
||||
initDefaults
|
||||
initOpenShiftDefaults
|
||||
overrideDefaults
|
||||
provisionOpenShiftOAuthUser
|
||||
patchEclipseCheOperatorSubscription
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ runTests() {
|
|||
waitWorkspaceStart
|
||||
}
|
||||
|
||||
init
|
||||
initDefaults
|
||||
initOpenShiftDefaults
|
||||
overrideDefaults
|
||||
provisionOpenShiftOAuthUser
|
||||
patchEclipseCheOperatorSubscription
|
||||
|
|
|
|||
|
|
@ -25,31 +25,35 @@ catchFinish() {
|
|||
exit $result
|
||||
}
|
||||
|
||||
init() {
|
||||
initDefaults() {
|
||||
export RAM_MEMORY=8192
|
||||
export NAMESPACE="eclipse-che"
|
||||
export ARTIFACTS_DIR="/tmp/artifacts-che"
|
||||
export TEMPLATES=${OPERATOR_REPO}/tmp
|
||||
export OPERATOR_IMAGE="quay.io/eclipse/che-operator:test"
|
||||
export OPERATOR_IMAGE="test/che-operator:test"
|
||||
export DEFAULT_DEVFILE="https://raw.githubusercontent.com/eclipse/che-devfile-registry/master/devfiles/quarkus/devfile.yaml"
|
||||
export CHE_EXPOSURE_STRATEGY="multi-host"
|
||||
export OAUTH="true"
|
||||
|
||||
export XDG_DATA_HOME=/tmp/xdg_data
|
||||
export XDG_CACHE_HOME=/tmp/xdg_cache
|
||||
export XDG_CONFIG_HOME=/tmp/xdg_config
|
||||
|
||||
export OAUTH="false"
|
||||
|
||||
# turn off telemetry
|
||||
mkdir -p ${XDG_CONFIG_HOME}/chectl
|
||||
echo "{\"segment.telemetry\":\"off\"}" > ${XDG_CONFIG_HOME}/chectl/config.json
|
||||
|
||||
export OPENSHIFT_NIGHTLY_CSV_FILE="${OPERATOR_REPO}/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml"
|
||||
|
||||
# prepare templates directory
|
||||
rm -rf ${TEMPLATES}
|
||||
mkdir -p "${TEMPLATES}/che-operator" && chmod 777 "${TEMPLATES}"
|
||||
}
|
||||
|
||||
initOpenShiftDefaults() {
|
||||
export OAUTH="true"
|
||||
export OPENSHIFT_NIGHTLY_CSV_FILE="${OPERATOR_REPO}/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml"
|
||||
}
|
||||
|
||||
initLatestTemplates() {
|
||||
cp -rf ${OPERATOR_REPO}/deploy/* "${TEMPLATES}/che-operator"
|
||||
}
|
||||
|
|
@ -90,11 +94,12 @@ initStableTemplates() {
|
|||
|
||||
# Utility to wait for a workspace to be started after workspace:create.
|
||||
waitWorkspaceStart() {
|
||||
login
|
||||
|
||||
set +e
|
||||
export x=0
|
||||
while [ $x -le 180 ]
|
||||
do
|
||||
chectl auth:login -u admin -p admin --chenamespace=${NAMESPACE}
|
||||
chectl workspace:list --chenamespace=${NAMESPACE}
|
||||
workspaceList=$(chectl workspace:list --chenamespace=${NAMESPACE})
|
||||
workspaceStatus=$(echo "$workspaceList" | grep RUNNING | awk '{ print $4} ')
|
||||
|
|
@ -201,19 +206,19 @@ updateEclipseChe() {
|
|||
startNewWorkspace() {
|
||||
# Create and start a workspace
|
||||
sleep 5s
|
||||
chectl auth:login -u admin -p admin --chenamespace=${NAMESPACE}
|
||||
login
|
||||
chectl workspace:create --start --chenamespace=${NAMESPACE} --devfile="${DEFAULT_DEVFILE}"
|
||||
}
|
||||
|
||||
createWorkspace() {
|
||||
sleep 5s
|
||||
chectl auth:login -u admin -p admin --chenamespace=${NAMESPACE}
|
||||
login
|
||||
chectl workspace:create --chenamespace=${NAMESPACE} --devfile="${DEFAULT_DEVFILE}"
|
||||
}
|
||||
|
||||
startExistedWorkspace() {
|
||||
sleep 5s
|
||||
chectl auth:login -u admin -p admin --chenamespace=${NAMESPACE}
|
||||
login
|
||||
chectl workspace:list --chenamespace=${NAMESPACE}
|
||||
workspaceList=$(chectl workspace:list --chenamespace=${NAMESPACE})
|
||||
|
||||
|
|
@ -310,7 +315,7 @@ applyOlmCR() {
|
|||
|
||||
# Create admin user inside of openshift cluster and login
|
||||
function provisionOpenShiftOAuthUser() {
|
||||
oc create secret generic htpass-secret --from-file=htpasswd="${OPERATOR_REPO}"/.github/bin/resources/users.htpasswd -n openshift-config
|
||||
oc create secret generic htpass-secret --from-file=htpasswd="${OPERATOR_REPO}"/.github/bin/resources/users.htpasswd -n openshift-config
|
||||
oc apply -f "${OPERATOR_REPO}"/.github/bin/resources/htpasswdProvider.yaml
|
||||
oc adm policy add-cluster-role-to-user cluster-admin user
|
||||
|
||||
|
|
@ -324,3 +329,12 @@ function provisionOpenShiftOAuthUser() {
|
|||
sleep 10
|
||||
done
|
||||
}
|
||||
|
||||
login() {
|
||||
if [[ ${OAUTH} == "false" ]]; then
|
||||
chectl auth:login -u admin -p admin --chenamespace=${NAMESPACE}
|
||||
else
|
||||
# log in using OpenShift token
|
||||
chectl auth:login --chenamespace=${NAMESPACE}
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,6 @@ runTest() {
|
|||
waitWorkspaceStart
|
||||
}
|
||||
|
||||
init
|
||||
initDefaults
|
||||
insecurePrivateDockerRegistry
|
||||
runTest
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ runTest() {
|
|||
waitWorkspaceStart
|
||||
}
|
||||
|
||||
init
|
||||
initDefaults
|
||||
initLatestTemplates
|
||||
prepareTemplates
|
||||
buildCheOperatorImage
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ runTest() {
|
|||
waitWorkspaceStart
|
||||
}
|
||||
|
||||
init
|
||||
initDefaults
|
||||
initLatestTemplates
|
||||
prepareTemplates
|
||||
buildCheOperatorImage
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ runTest() {
|
|||
waitWorkspaceStart
|
||||
}
|
||||
|
||||
init
|
||||
initDefaults
|
||||
initLatestTemplates
|
||||
initStableTemplates "kubernetes" "stable"
|
||||
prepareTemplates
|
||||
|
|
|
|||
|
|
@ -27,6 +27,6 @@ runTest() {
|
|||
waitWorkspaceStart
|
||||
}
|
||||
|
||||
init
|
||||
initDefaults
|
||||
initStableTemplates "kubernetes" "stable"
|
||||
runTest
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ runTest() {
|
|||
waitWorkspaceStart
|
||||
}
|
||||
|
||||
init
|
||||
initDefaults
|
||||
installYq
|
||||
initLatestTemplates
|
||||
initStableTemplates "openshift" "stable"
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ runTest() {
|
|||
waitWorkspaceStart
|
||||
}
|
||||
|
||||
init
|
||||
initDefaults
|
||||
installYq
|
||||
initLatestTemplates
|
||||
prepareTemplates
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ runTest() {
|
|||
waitWorkspaceStart
|
||||
}
|
||||
|
||||
init
|
||||
initDefaults
|
||||
installYq
|
||||
initStableTemplates "openshift" "stable"
|
||||
prepareTemplates
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ jobs:
|
|||
- uses: actions/checkout@v1
|
||||
- name: Build Che operator image
|
||||
run: |
|
||||
export OPERATOR_IMAGE=quay.io/eclipse/che-operator:test
|
||||
export OPERATOR_IMAGE=test/che-operator:test
|
||||
# coreutils provides a readlink that supports `-f`
|
||||
|
||||
brew install coreutils docker docker-machine
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ jobs:
|
|||
# All docker operations should be done in this step
|
||||
- name: Build Che operator image
|
||||
run: |
|
||||
export OPERATOR_IMAGE=quay.io/eclipse/che-operator:test
|
||||
export OPERATOR_IMAGE=test/che-operator:test
|
||||
# coreutils provides a readlink that supports `-f`
|
||||
|
||||
brew install coreutils docker docker-machine
|
||||
|
|
|
|||
Loading…
Reference in New Issue