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()
script {
FAILED_STAGE=env.STAGE_NAME
sh 'npm --version'
dir('goofy-client') {
sh 'npm install'
if (env.BRANCH_NAME == 'release') {
sh 'npm run ci-prodBuild'
}
else {
sh 'npm run ci-build'
}
sh 'npm run ci-test'
}
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:build-latest", "goofy-builder:${env.BRANCH_NAME}-${version}")
if (env.BRANCH_NAME == 'release') {
openshift.tag("goofy-builder:${env.BRANCH_NAME}-${version}", "goofy-builder:latest")
}
if (env.BRANCH_NAME == 'master') {
def dc = openshift.selector('dc', 'goofy-e2e')
openshift.tag("goofy-builder:${env.BRANCH_NAME}-${version}", "goofy-builder:snapshot-latest")
openshift.tag("goofy-builder:${env.BRANCH_NAME}-${version}", "goofy-builder:e2e-latest")
dc.rollout().status()
}
}
}
}
}
}
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
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('nexus deploy'){
when {
anyOf {
branch 'master'
branch 'release'
branch 'nexus'
}
}
steps {
script {
FAILED_STAGE = env.STAGE_NAME
}
container('maven-11') {
sh 'mvn -pl -goofy-client -DskipTests deploy'
}
}
}
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.tag("goofy-builder:snapshot-latest", "sh-kiel-dev/goofy:snapshot-latest")
}
if (env.BRANCH_NAME == 'release') {
openshift.tag("goofy-builder:latest", "sh-kiel-dev/goofy:latest")
}
}
if (env.BRANCH_NAME == 'master') {
openshift.withProject('sh-kiel-dev') {
def dc = openshift.selector('deployments', 'goofy')
dc.rollout().status()
}
}
}
}
post {
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}>")
}
}
}