Newer
Older
environment {
BLUE_OCEAN_URL = "https://jenkins-dev-tools.apps.lab.okd.local/blue/organizations/jenkins/OZG%2Fgoofy/detail/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/pipeline"
}
options {
timeout(time: 1, unit: 'HOURS')
disableConcurrentBuilds()
container("nodejs"){
sh 'npm --version'
dir('goofy-client') {
sh 'npm install'
post {
always{
junit testResults: 'goofy-client/junit.xml', skipPublishingChecks: true
publishHTML (target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'goofy-client/coverage/lcov-report',
reportFiles: 'index.html',
reportName: "Goofy-Client code coverage"
])
}
}
post {
always{
junit testResults: '**/target/surefire-reports/*.xml', skipPublishingChecks: true
}
}
def pom = readMavenPom file: 'pom.xml'
def version = pom.version
openshift.withCluster() {
openshift.withProject() {
dir('goofy-server') {
openshift.startBuild("goofy-builder", "--from-dir=.", "--follow", "--wait")
}
openshift.tag("goofy-builder:latest", "goofy-builder:${env.BRANCH_NAME}-${version}")
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
if (env.BRANCH_NAME == 'master') {
def dc = openshift.selector('dc', 'goofy-e2e')
openshift.tag("goofy-builder:latest", "goofy-builder:e2e-latest")
dc.rollout().status()
}
}
}
}
}
}
stage('E2E-Test') {
when {
branch 'master'
}
steps {
script {
FAILED_STAGE=env.STAGE_NAME
}
container("cypress"){
sh 'npm --version'
dir('goofy-client') {
sh 'npm install'
sh 'npm run cypress:version'
sh 'npm run cypress:ci-run'
}
}
}
post {
always {
publishHTML (target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'goofy-client/apps/goofy-e2e/reports',
reportFiles: 'report.html',
reportName: "Goofy E2E-Tests"
])
}
}
}
stage('Openshift deploy') {
when {
anyOf {
branch 'master';
branch 'release'
}
}
steps {
script {
FAILED_STAGE=env.STAGE_NAME
def pom = readMavenPom file: 'pom.xml'
def version = pom.version
openshift.withCluster() {
openshift.withProject() {
openshift.tag("goofy-builder:${env.BRANCH_NAME}-${version}", "sh-kiel-dev/goofy:${env.BRANCH_NAME}-${version}")
}
if (env.BRANCH_NAME == 'master') {
openshift.withProject('sh-kiel-dev') {
def dc = openshift.selector('deployments', 'goofy')
dc.rollout().status()
}
}
}
}
post {
success {
script {
if (env.BRANCH_NAME == 'master') {
slackSend(color: "good", message: "Goofy: Build Succeeded. Build-ID: <${BLUE_OCEAN_URL}|${env.BUILD_NUMBER}>")
}
}
}
failure {
script {
if (env.BRANCH_NAME == 'master') {
slackSend(color: "danger", message: "Goofy: Build Failed. Stage: ${FAILED_STAGE} Build-ID: <${BLUE_OCEAN_URL}|${env.BUILD_NUMBER}>")
}
}
}