|
@@ -10,6 +10,8 @@ pipeline {
|
|
|
timeout(time: 20, unit: 'MINUTES')
|
|
|
}
|
|
|
environment {
|
|
|
+ PROMO_SDK=[ service_name: 'info_promo-sdk', image: 'iru/promo-sdk', repo: 'git@github.com:icruportal/web-sdk-demo.git', dockerfile: 'Dockerfile-promo-sdk' ]
|
|
|
+ PROMO_SEO=[ service_name: 'info_promo-seo', image: 'iru/promo-seo', repo: 'git@github.com:icruportal/web-registration.git', dockerfile: 'Dockerfile-promo-seo' ]
|
|
|
SERVICE_NAME_SDK='info_promo-sdk'
|
|
|
DOCKER_IMAGE_SDK='iru/promo-sdk'
|
|
|
GIT_REPO_SDK='git@github.com:icruportal/web-sdk-demo.git'
|
|
@@ -48,42 +50,43 @@ pipeline {
|
|
|
script {
|
|
|
switch (GIT_REPO) {
|
|
|
case 'promo-sdk':
|
|
|
- REPO=GIT_REPO_SDK
|
|
|
- DOCKER_IMAGE=DOCKER_IMAGE_SDK
|
|
|
- SERVICE_NAME=SERVICE_NAME_SDK
|
|
|
- DOCKER_FILE=DOCKER_FILE_SDK
|
|
|
+ REPO=PROMO_SDK.repo
|
|
|
+ DOCKER_IMAGE=PROMO_SDK.image
|
|
|
+ SERVICE_NAME=PROMO_SDK.service_name
|
|
|
+ DOCKER_FILE=PROMO_SDK.dockerfile
|
|
|
break
|
|
|
case 'promo-seo':
|
|
|
- REPO=GIT_REPO_SEO
|
|
|
- DOCKER_IMAGE=DOCKER_IMAGE_SEO
|
|
|
- SERVICE_NAME=SERVICE_NAME_SEO
|
|
|
- DOCKER_FILE=DOCKER_FILE_SEO
|
|
|
+ REPO=PROMO_SEO.repo
|
|
|
+ DOCKER_IMAGE=PROMO_SEO.image
|
|
|
+ SERVICE_NAME=PROMO_SEO.service_name
|
|
|
+ DOCKER_FILE=PROMO_SEO.dockerfile
|
|
|
break
|
|
|
}
|
|
|
echo REPO
|
|
|
echo DOCKER_IMAGE
|
|
|
echo SERVICE_NAME
|
|
|
+ echo DOCKER_FILE
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- stage("Build") {
|
|
|
- steps {
|
|
|
- script {
|
|
|
- echo "Building ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER}."
|
|
|
- withCredentials([sshUserPrivateKey(credentialsId: 'provision', keyFileVariable: 'GIT_SSH_KEY', passphraseVariable: '', usernameVariable: 'GIT_SSH_USERNAME')]) {
|
|
|
- sh """set +x
|
|
|
- cat ${GIT_SSH_KEY} > ${WORKSPACE}/id_rsa
|
|
|
- chmod 600 ${WORKSPACE}/id_rsa
|
|
|
- """
|
|
|
- }
|
|
|
- sh "docker build --build-arg branch=${branch} --build-arg git_repo=${REPO} --no-cache -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER} -f ./${DOCKER_FILE} ."
|
|
|
- NEWTAG = sh(script: "docker run --rm ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER} cat /tmp/version 2> /dev/null", returnStdout: true).trim()
|
|
|
- NEWTAG = branch + "-" + NEWTAG + "_" + BUILD_NUMBER
|
|
|
- echo "NEWTAG is $NEWTAG"
|
|
|
- sh "docker tag ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER} ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${NEWTAG}"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // stage("Build") {
|
|
|
+ // steps {
|
|
|
+ // script {
|
|
|
+ // echo "Building ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER}."
|
|
|
+ // withCredentials([sshUserPrivateKey(credentialsId: 'provision', keyFileVariable: 'GIT_SSH_KEY', passphraseVariable: '', usernameVariable: 'GIT_SSH_USERNAME')]) {
|
|
|
+ // sh """set +x
|
|
|
+ // cat ${GIT_SSH_KEY} > ${WORKSPACE}/id_rsa
|
|
|
+ // chmod 600 ${WORKSPACE}/id_rsa
|
|
|
+ // """
|
|
|
+ // }
|
|
|
+ // sh "docker build --build-arg branch=${branch} --build-arg git_repo=${REPO} --no-cache -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER} -f ./${DOCKER_FILE} ."
|
|
|
+ // NEWTAG = sh(script: "docker run --rm ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER} cat /tmp/version 2> /dev/null", returnStdout: true).trim()
|
|
|
+ // NEWTAG = branch + "-" + NEWTAG + "_" + BUILD_NUMBER
|
|
|
+ // echo "NEWTAG is $NEWTAG"
|
|
|
+ // sh "docker tag ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER} ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${NEWTAG}"
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
// stage("Publish") {
|
|
|
// steps {
|
|
|
// echo "Publishing ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${NEWTAG}"
|