From da0a2fbf1f60a1aa31b45016abe3f2c4793b03d8 Mon Sep 17 00:00:00 2001 From: Radim Hopp Date: Thu, 22 Oct 2020 16:47:37 +0200 Subject: [PATCH] Happy Path: Use `chectl auth:login` flow in PR checks This is needed because of https://github.com/che-incubator/chectl/pull/910 Signed-off-by: Radim Hopp --- tests/.infra/crw-ci/pr-check/k8s/Jenkinsfile | 24 ++------------------ 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/tests/.infra/crw-ci/pr-check/k8s/Jenkinsfile b/tests/.infra/crw-ci/pr-check/k8s/Jenkinsfile index 20541a53b4f..1c58237d823 100644 --- a/tests/.infra/crw-ci/pr-check/k8s/Jenkinsfile +++ b/tests/.infra/crw-ci/pr-check/k8s/Jenkinsfile @@ -17,7 +17,6 @@ pipeline { DEVFILE_PATH = "${WORKSPACE}/test-workspace-devfile.yaml" CUSTOM_RESOURCE_PATCH_FILE = "${WORKSPACE}/custom-resource-patch.yaml" - KEYCLOAK_BASE_URL = "" SUCCESS_THRESHOLD = 5 @@ -311,30 +310,11 @@ EOL""" sh "cp ${WORKSPACE}/tests/e2e/files/happy-path/happy-path-workspace.yaml $DEVFILE_PATH" } - if (cheSingleHost.toBoolean() == true) { - KEYCLOAK_BASE_URL = sh( - script: "kubectl get ingress/che --namespace=eclipse-che -o jsonpath='{.spec.rules[0].host}'", - returnStdout: true - ).trim() - - } else { - KEYCLOAK_BASE_URL = sh( - script: "kubectl get ingress/keycloak --namespace=eclipse-che -o jsonpath='{.spec.rules[0].host}'", - returnStdout: true - ).trim() - } + sh """ + ${pathToChectl} auth:login -u admin -p admin --chenamespace=eclipse-che - sh """ - USER_ACCESS_TOKEN=\$(curl -k -X POST https://${KEYCLOAK_BASE_URL}/auth/realms/che/protocol/openid-connect/token \\ - -H "Content-Type: application/x-www-form-urlencoded" \\ - -d "username=admin" \\ - -d "password=admin" \\ - -d "grant_type=password" \\ - -d "client_id=che-public" | jq -r .access_token) - ${pathToChectl} workspace:create --start \\ --devfile=${DEVFILE_PATH} \\ - --access-token "\$USER_ACCESS_TOKEN" \\ --chenamespace=eclipse-che """ }