|
@@ -16,6 +16,7 @@ pipeline {
|
|
|
DOCKER_CERT_PATH='/run/secrets/swarm'
|
|
|
DHOST='tcp://dev-iru-swarm.infoclinica.lan:2376 DOCKER_TLS_VERIFY=1'
|
|
|
DOCKER_REGISTRY='dev-registry.infoclinica.ru:5000'
|
|
|
+ BASE_REGISTRY='images.sdsys.ru'
|
|
|
NEWTAG=''
|
|
|
}
|
|
|
parameters {
|
|
@@ -38,12 +39,15 @@ pipeline {
|
|
|
stages {
|
|
|
stage("Build") {
|
|
|
steps {
|
|
|
- echo "Building ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER}."
|
|
|
- sh "docker build --build-arg repo=${repo} --no-cache -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} ."
|
|
|
script {
|
|
|
- NEWTAG = sh script: "docker run --rm ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} rpm -q --qf %{VERSION}-%{RELEASE} ${PACKAGE_NAME} 2> /dev/null", returnStdout: true
|
|
|
- NEWTAG = repo + "-" + NEWTAG + "_" + BUILD_NUMBER
|
|
|
- echo "NEWTAG is $NEWTAG"
|
|
|
+ withCredentials([usernamePassword(credentialsId: 'registry', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
|
|
|
+ echo "Building ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER}."
|
|
|
+ sh "docker login -u ${USERNAME} -p ${PASSWORD} ${BASE_REGISTRY}"
|
|
|
+ sh "docker build --build-arg repo=${repo} --no-cache -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} ."
|
|
|
+ }
|
|
|
+ NEWTAG = sh script: "docker run --rm ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} rpm -q --qf %{VERSION}-%{RELEASE} ${PACKAGE_NAME} 2> /dev/null", returnStdout: true
|
|
|
+ NEWTAG = repo + "-" + NEWTAG + "_" + BUILD_NUMBER
|
|
|
+ echo "NEWTAG is $NEWTAG"
|
|
|
}
|
|
|
sh "docker tag ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${NEWTAG}"
|
|
|
}
|