fix
This commit is contained in:
parent
88342e4a22
commit
fb23d37963
1 changed files with 19 additions and 25 deletions
44
books/jenkins/Jenkinsfile
vendored
44
books/jenkins/Jenkinsfile
vendored
|
|
@ -5,19 +5,15 @@ pipeline {
|
||||||
}
|
}
|
||||||
agent {
|
agent {
|
||||||
node {
|
node {
|
||||||
label 'nodejs'
|
label 'nodejs'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
//TODO: Edit these vars as per your env
|
DEV_PROJECT = "youruser-books-dev"
|
||||||
DEV_PROJECT = "zqjsga-books-dev"
|
STAGE_PROJECT = "youruser-books-stage"
|
||||||
STAGE_PROJECT = "zqjsga-books-stage"
|
APP_GIT_URL = "https://github.com/youruser/DO288-apps"
|
||||||
APP_GIT_URL = "https://github.com/shautvast/DO288-apps"
|
NEXUS_SERVER = "http://nexus-common.apps.cluster.domain.example.com/repository/nodejs"
|
||||||
NEXUS_SERVER = "http://nexus-common.apps.eu45.prod.nextcle.com"
|
|
||||||
//it says replace the whole value
|
|
||||||
// NEXUS_SERVER = "http://nexus-common.apps.cluster.domain.example.com/repository/nodejs"
|
|
||||||
|
|
||||||
|
|
||||||
// DO NOT CHANGE THE GLOBAL VARS BELOW THIS LINE
|
// DO NOT CHANGE THE GLOBAL VARS BELOW THIS LINE
|
||||||
APP_NAME = "books"
|
APP_NAME = "books"
|
||||||
|
|
@ -61,12 +57,10 @@ pipeline {
|
||||||
'''
|
'''
|
||||||
|
|
||||||
echo '### Creating a new app in DEV env ###'
|
echo '### Creating a new app in DEV env ###'
|
||||||
sh '''
|
sh '''
|
||||||
oc project ${DEV_PROJECT}
|
oc project ${DEV_PROJECT}
|
||||||
oc new-app --as-deployment-config --name books nodejs:12~${APP_GIT_URL}\
|
oc new-app --as-deployment-config --name books nodejs:12~${APP_GIT_URL} --build-env npm_config_registry=${NEXUS_SERVER} --context-dir ${APP_NAME}
|
||||||
--build-env npm_config_registry=${NEXUS_SERVER} --context-dir ${APP_NAME}
|
oc expose svc/${APP_NAME}
|
||||||
|
|
||||||
oc expose svc/${APP_NAME}
|
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -108,9 +102,10 @@ pipeline {
|
||||||
timeout(time: 60, unit: 'MINUTES') {
|
timeout(time: 60, unit: 'MINUTES') {
|
||||||
input message: "Promote to Staging?"
|
input message: "Promote to Staging?"
|
||||||
}
|
}
|
||||||
script{
|
script {
|
||||||
openshift.withCluster() {
|
openshift.withCluster() {
|
||||||
openshift.tag("${DEV_PROJECT}/books/latest", "${STAGE_PROJECT}/books:stage")
|
openshift.tag("${DEV_PROJECT}/books:latest", "${STAGE_PROJECT}/books:stage")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -126,9 +121,9 @@ pipeline {
|
||||||
|
|
||||||
echo '### Creating a new app in Staging ###'
|
echo '### Creating a new app in Staging ###'
|
||||||
sh '''
|
sh '''
|
||||||
oc project ${STAGE_PROJECT}
|
oc project ${STAGE_PROJECT}
|
||||||
oc new-app --as-depoyment-config --name books -i books:stage
|
oc new-app --name books -i books:stage --as-deployment-config
|
||||||
oc expose svc ${APP_NAME}
|
oc expose svc/${APP_NAME}
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -142,12 +137,11 @@ pipeline {
|
||||||
|
|
||||||
openshift.withCluster() {
|
openshift.withCluster() {
|
||||||
openshift.withProject( "${STAGE_PROJECT}" ) {
|
openshift.withProject( "${STAGE_PROJECT}" ) {
|
||||||
def deployment = openshift.selector("dc", "${APP_NAME}").rollout()
|
def deployment = openshift.selector("dc", "${APP_NAME}").rollout()
|
||||||
openshift.selector("dc", "$APP_NAME").related('pods').untilEach(1){
|
openshift.selector("dc", "${APP_NAME}").related('pods').untilEach(1) {
|
||||||
return (it.object().status.phase == "Running")
|
return (it.object().status.phase == "Running")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Deployment to Staging env is complete. Access the app at the URL http://${routeHost}."
|
echo "Deployment to Staging env is complete. Access the app at the URL http://${routeHost}."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue