Skip to content
Snippets Groups Projects
Commit 3e8ef2ff authored by OZGCloud's avatar OZGCloud
Browse files

add kc user yaml

parent f09da8e9
Branches
Tags
No related merge requests found
...@@ -148,54 +148,72 @@ pipeline { ...@@ -148,54 +148,72 @@ pipeline {
// } // }
// } // }
stage('E2E-Tests(EA)') { stage('E2E-EA-kc') {
when { when {
branch 'ozg-1784' branch 'ozg-1784'
} }
steps { steps {
script { script {
FAILED_STAGE=env.STAGE_NAME FAILED_STAGE=env.STAGE_NAME
}
container("k8s") {
script {
def branchName = env.BRANCH_NAME.replaceAll(/[^a-zA-Z0-9]+/, "").toLowerCase()
def namespace = "e2e-${branchName}-dev"
namespace = createNamespaceName(env.STAGE_NAME)
createKEycloakUser(env.STAGE_NAME)
container("k8s") {
println(namespace) println(namespace)
configFileProvider([configFile(fileId: 'jenkins-kuby-kubeconfig', variable: 'KUBE_CONFIG')]) { configFileProvider([configFile(fileId: 'jenkins-kuby-kubeconfig', variable: 'KUBE_CONFIG')]) {
sh 'mkdir ~/.kube' sh 'mkdir ~/.kube'
sh 'cp ${KUBE_CONFIG} ~/.kube/config' sh 'cp ${KUBE_CONFIG} ~/.kube/config'
sh 'cat ~/.kube/config'
} }
sh 'helm version'
sh 'kubectl get nodes' sh 'kubectl get nodes'
dir('goofy-client/apps/goofy-e2e/deployment-values/namespace') { def namespaceList = sh (script: 'kubectl get namespaces', returnStdout: true)
sh 'kubectl apply -f values.yaml' println(namespaceList)
}
sh 'kubectl get pods -n ${namespace}' if(namespaceList.contains(namespace)) {
error("Namespace: ${namespace} existiert bereits")
}
parallel(
startGoofy: {
dir('goofy-client/apps/goofy-e2e/deployment-values/goofy') { dir('goofy-client/apps/goofy-e2e/deployment-values/goofy') {
withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) { withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) {
sh "helm --install goofy goofy --version 0.3.0-SNAPSHOT -f values.yaml --namespace ${namespace}" + ' --repo https://nexus.ozg-sh.de/repository/ozg-base-apps-snapshot --username ${USER} --password ${PASSWORD}' sh "helm upgrade --install --create-namespace goofy goofy -f values.yaml --namespace ${namespace}" + ' --repo https://nexus.ozg-sh.de/repository/ozg-base-apps --username ${USER} --password ${PASSWORD} --wait --wait-for-jobs'
} }
} }
},
sh 'kubectl get pods -n ${namespace}' startPluto: {
dir('goofy-client/apps/goofy-e2e/deployment-values/pluto') {
withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) {
sh "helm upgrade --install --create-namespace pluto pluto -f values.yaml --namespace ${namespace}" + ' --repo https://nexus.ozg-sh.de/repository/ozg-base-apps --username ${USER} --password ${PASSWORD} --wait --wait-for-jobs'
}
} }
sh "kubectl rollout status statefulset/pluto-database -n ${namespace}"
}
)
println('running')
println('testing')
// sh "helm uninstall goofy --namespace ${namespace} --wait"
// sh "helm uninstall pluto --namespace ${namespace} --wait"
// sh "kubectl delete namespace ${namespace}"
} }
// container("cypress") { // container("cypress") {
// dir('goofy-client') { // dir('goofy-client') {
// sh 'npm run cypress:version' // sh 'npm run cypress:version'
// sh 'npm run cypress:ci-ea-run --BASE_URL=https://e2e.dev.ozg-sh.de'//TODO: durch eine dynamische url ersetzen // sh 'npm run cypress:ci-run --BASE_URL=https://e2e.dev.ozg-sh.de'//TODO: durch eine dynamische url ersetzen
// } // }
// } // }
}
// container("k8s"){
// sh 'helm uninstall '
// }
} }
} }
...@@ -314,3 +332,18 @@ pipeline { ...@@ -314,3 +332,18 @@ pipeline {
// } // }
// } // }
} }
String createNamespaceName(String stage) {
branchName = env.BRANCH_NAME.replaceAll(/[^a-zA-Z0-9]+/, "").toLowerCase()
stageName = stage.replaceAll(/[^a-zA-Z0-9]+/, "").toLowerCase()
return "e2e-${branchName}${stageName}-dev"
}
Void createKEycloakUser(String stage) {
namespace = createNamespaceName(stage)
dir('goofy-client/apps/goofy-e2e/deployment-values/goofy') {
userYaml = readYaml file: "user.yaml"
println(userYaml)
}
}
\ No newline at end of file
apiVersion: keycloak.org/v1alpha1
kind: KeycloakUser
metadata:
name: e2e-ozg1784e2eeakc-dev-emil
namespace: keycloak
labels:
realm: e2e-ozg1784e2eeakc-dev
spec:
realmSelector:
matchLabels:
realm: e2e-ozg1784e2eeakc-dev
user:
username: "emil"
firstName: "Emil"
lastName: "Ernst"
enabled: True
emailVerified: False
credentials:
- type: "password"
value: "Einfallsreich"
realmRoles:
- "offline_access"
- "uma_authorization"
clientRoles:
e2e-ozg1784e2eeakc-dev:
- "VERWALTUNG_USER"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment