Skip to content
Snippets Groups Projects
Commit 04a3d817 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-1784 jenkinsfile

parent 731a67fa
Branches
Tags
No related merge requests found
def FAILED_STAGE def FAILED_STAGE
def IMAGE_TAG def IMAGE_TAG
def VERSION def VERSION
def E2E_FAILED
pipeline { pipeline {
agent { agent {
...@@ -13,7 +14,6 @@ pipeline { ...@@ -13,7 +14,6 @@ pipeline {
BLUE_OCEAN_URL = "https://jenkins.ozg-sh.de/blue/organizations/jenkins/goofy/detail/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/pipeline" BLUE_OCEAN_URL = "https://jenkins.ozg-sh.de/blue/organizations/jenkins/goofy/detail/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/pipeline"
RELEASE_REGEX = /\d+.\d+.\d+/ RELEASE_REGEX = /\d+.\d+.\d+/
SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/ SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/
E2E_FAILED = ""
} }
options { options {
...@@ -98,7 +98,6 @@ pipeline { ...@@ -98,7 +98,6 @@ pipeline {
script { script {
FAILED_STAGE=env.STAGE_NAME FAILED_STAGE=env.STAGE_NAME
IMAGE_TAG = "${env.BRANCH_NAME}-${VERSION}" IMAGE_TAG = "${env.BRANCH_NAME}-${VERSION}"
println("IMAGE_TAG: ${IMAGE_TAG}")
container("maven-17"){ container("maven-17"){
configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) { configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) {
...@@ -130,6 +129,7 @@ pipeline { ...@@ -130,6 +129,7 @@ pipeline {
steps { steps {
script { script {
FAILED_STAGE = env.STAGE_NAME FAILED_STAGE = env.STAGE_NAME
E2E_FAILED = ""
} }
container("k8s") { container("k8s") {
configFileProvider([configFile(fileId: 'jenkins-kuby-kubeconfig', variable: 'KUBE_CONFIG')]) { configFileProvider([configFile(fileId: 'jenkins-kuby-kubeconfig', variable: 'KUBE_CONFIG')]) {
...@@ -162,13 +162,14 @@ pipeline { ...@@ -162,13 +162,14 @@ pipeline {
} }
) )
if(runTests(stageName, 'einheitlicher-ansprechpartner') != '0') { def testResult = runTests(stageName, 'einheitlicher-ansprechpartner')
env.E2E_FAILED += "${stageName}, "
}
print(env.E2E_FAILED)
shutdownEnvironment(namespace) shutdownEnvironment(namespace)
if(testResult != "0") {
E2E_FAILED += "${stageName}, "
error("Fehler in Stage ${stageName}")
}
} }
} }
post { post {
...@@ -181,14 +182,6 @@ pipeline { ...@@ -181,14 +182,6 @@ pipeline {
reportFiles: 'report.html', reportFiles: 'report.html',
reportName: "Goofy E2E-Tests EA" reportName: "Goofy E2E-Tests EA"
]) ])
script {
if (env.E2E_FAILED) {
if (env.E2E_FAILED.contains(env.STAGE_NAME)) {
currentBuild.result = 'FAILURE'
}
}
}
} }
} }
} }
...@@ -209,13 +202,14 @@ pipeline { ...@@ -209,13 +202,14 @@ pipeline {
} }
) )
if(runTests(stageName, 'main-tests') != '0') { def testResult = runTests(stageName, 'main-tests')
env.E2E_FAILED += "${stageName}, "
}
print(env.E2E_FAILED)
shutdownEnvironment(namespace) shutdownEnvironment(namespace)
if(testResult != "0") {
E2E_FAILED += "${stageName}, "
error("Fehler in Stage ${stageName}")
}
} }
} }
post { post {
...@@ -228,14 +222,6 @@ pipeline { ...@@ -228,14 +222,6 @@ pipeline {
reportFiles: 'report.html', reportFiles: 'report.html',
reportName: "Goofy E2E-Tests main" reportName: "Goofy E2E-Tests main"
]) ])
script {
if (env.E2E_FAILED) {
if (env.E2E_FAILED.contains(env.STAGE_NAME)) {
currentBuild.result = 'FAILURE'
}
}
}
} }
} }
} }
...@@ -243,8 +229,9 @@ pipeline { ...@@ -243,8 +229,9 @@ pipeline {
post { post {
always { always {
script { script {
if (env.E2E_FAILED) { if (E2E_FAILED) {
FAILED_STAGE = "E2E (${env.E2E_FAILED.substring(0, env.E2E_FAILED.length() - 2)})" FAILED_STAGE = "E2E (${E2E_FAILED.substring(0, E2E_FAILED.length() - 2)})"
error("Fehler in E2E-Tests")
} }
} }
} }
...@@ -381,7 +368,7 @@ Void startGoofy(String namespace, String values, String imageTag) { ...@@ -381,7 +368,7 @@ Void startGoofy(String namespace, String values, String imageTag) {
} }
} }
Void runTests(String stageName, String reportFolder) { String runTests(String stageName, String reportFolder) {
container("cypress") { container("cypress") {
def configFile = generateCypressConfig(stageName, reportFolder) def configFile = generateCypressConfig(stageName, reportFolder)
dir("goofy-client") { dir("goofy-client") {
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
"database": "test", "database": "test",
"keycloakRealm": "sh-e2e-dev", "keycloakRealm": "sh-e2e-dev",
"keycloakUrl": "https://sso.dev.ozg-sh.de/", "keycloakUrl": "https://sso.dev.ozg-sh.de/",
"keycloakClient": "sh-e2e-dev-goofy" "keycloakClient": "sh-e2e-dev-goofy",
"sabineUuid": "df385159-6055-4169-bb78-f5c6f60fe0cf"
}, },
"fileServerFolder": ".", "fileServerFolder": ".",
"fixturesFolder": "./src/fixtures", "fixturesFolder": "./src/fixtures",
......
...@@ -41,7 +41,7 @@ describe('Vorgang abschliessen', () => { ...@@ -41,7 +41,7 @@ describe('Vorgang abschliessen', () => {
describe('by button', () => { describe('by button', () => {
it('should have status Beschieden', () => { it('should have status Beschieden', () => {
haveText(vorgangPage.getVorgangDetailHeader().getStatus(), "Fail Test"); haveText(vorgangPage.getVorgangDetailHeader().getStatus(), vorgangStatusLabelE2E[vorgangAbschliessen.status]);
}) })
it('should show snackBar message', () => { it('should show snackBar message', () => {
......
...@@ -41,7 +41,7 @@ describe('Vorgang abschliessen(EA)', () => { ...@@ -41,7 +41,7 @@ describe('Vorgang abschliessen(EA)', () => {
describe('by button', () => { describe('by button', () => {
it('should have status Beschieden', () => { it('should have status Beschieden', () => {
haveText(vorgangPage.getVorgangDetailHeader().getStatus(), "Fail Test"); haveText(vorgangPage.getVorgangDetailHeader().getStatus(), vorgangStatusLabelE2E[vorgangAbschliessen.status]);
}) })
it('should show snackBar message', () => { it('should show snackBar message', () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment