Skip to content

Commit

Permalink
Happy Path: Use chectl auth:login flow in PR checks
Browse files Browse the repository at this point in the history
This is needed because of che-incubator/chectl#910

Signed-off-by: Radim Hopp <rhopp@redhat.com>
  • Loading branch information
rhopp committed Oct 22, 2020
1 parent d26f3d9 commit da0a2fb
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions tests/.infra/crw-ci/pr-check/k8s/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
"""
}
Expand Down

0 comments on commit da0a2fb

Please sign in to comment.