update deploy2prod jenkinsfile
This commit is contained in:
27
openshift/prod/Jenkinsfile
vendored
27
openshift/prod/Jenkinsfile
vendored
@@ -6,6 +6,12 @@ def prod_project = "${PROD_NAMESPACE}"
|
||||
def jenkinsslave = "nodejs15-agent"
|
||||
def dist_path = "dist/apps/mina-sidor-fa"
|
||||
|
||||
def REGISTRY = 'nexus.arbetsformedlingen.se:5555'
|
||||
def PROJECT_CONTAINING_IMAGES = "app-af-nexus"
|
||||
def USE_CONFIG_MAP = false
|
||||
def CONFIG_MAP_KEY = "${appname}-config"
|
||||
def CONFIG_MAP_PATH = "./openshift/config-maps/${prod_project}.yaml"
|
||||
|
||||
pipeline {
|
||||
|
||||
agent {
|
||||
@@ -43,7 +49,7 @@ pipeline {
|
||||
CACHE_DIRECTORY=/home/jenkins/.npm/cache
|
||||
mkdir -p ${CACHE_DIRECTORY}
|
||||
echo "_auth=${ENCODED}" >> .npmrc
|
||||
|
||||
|
||||
# set -x
|
||||
cat .npmrc
|
||||
|
||||
@@ -163,10 +169,11 @@ pipeline {
|
||||
echo '### Trying to deploy to prod... ###'
|
||||
script {
|
||||
openshift.withCluster() {
|
||||
def api = "https://pocpconsole.arbetsformedlingen.se:443"
|
||||
env.API = sh(script:"set +x; echo ${api}", returnStdout: true).replaceAll(/https?/, 'insecure')
|
||||
def encodedToken = openshift.selector('secret/imagepromote-token').object().data.tokenbase64
|
||||
env.TOKEN = sh(script:"set +x; echo ${encodedToken} | base64 --decode", returnStdout: true)
|
||||
utilities.defineAuth()
|
||||
// def api = "https://ocpcluster-a.arbetsformedlingen.se:443"
|
||||
// env.API = sh(script:"set +x; echo ${api}", returnStdout: true).replaceAll(/https?/, 'insecure')
|
||||
// def encodedToken = openshift.selector('secret/imagepromote-token').object().data.tokenbase64
|
||||
// env.TOKEN = sh(script:"set +x; echo ${encodedToken} | base64 --decode", returnStdout: true)
|
||||
}
|
||||
|
||||
openshift.withCluster( env.API, env.TOKEN ) {
|
||||
@@ -174,10 +181,12 @@ pipeline {
|
||||
// Wait for approval
|
||||
timeout(time:1440, unit:'MINUTES') {
|
||||
input message: "Go Live with ${ appname } in Production?", ok: "Confirm"
|
||||
openshift.raw("tag nexus.arbetsformedlingen.se:5555/app-af-nexus/${ appname }:${BUILD_TAG} ${appname}:${BUILD_TAG} --insecure")
|
||||
openshift.raw("tag ${ appname }:latest ${ appname }:${BUILD_TAG}")
|
||||
openshift.raw("set image dc/${ appname } ${ appname }=nexus.arbetsformedlingen.se:5555/app-af-nexus/${ appname }:${BUILD_TAG} --record=true --source=docker")
|
||||
openshift.selector("dc", "${ appname }").rollout().status();
|
||||
def label = "${ env.BUILD_NUMBER }"
|
||||
utilities.rollout("${ appname }", "${ appname }", "latest", label, PROJECT_CONTAINING_IMAGES, REGISTRY, USE_CONFIG_MAP, "${ CONFIG_MAP_KEY }", CONFIG_MAP_PATH)
|
||||
//openshift.raw("tag nexus.arbetsformedlingen.se:5555/app-af-nexus/${ appname }:${BUILD_TAG} ${appname}:${BUILD_TAG} --insecure")
|
||||
//openshift.raw("tag ${ appname }:latest ${ appname }:${BUILD_TAG}")
|
||||
//openshift.raw("set image dc/${ appname } ${ appname }=nexus.arbetsformedlingen.se:5555/app-af-nexus/${ appname }:${BUILD_TAG} --record=true --source=docker")
|
||||
//openshift.selector("dc", "${ appname }").rollout().status();
|
||||
echo '### Deployed to prod! ###'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user