2019-10-16 13:20:21 +00:00
|
|
|
container('publish-images') {
|
|
|
|
timeout(time: 15, unit: 'MINUTES') {
|
|
|
|
dir ("docker/deploy/${OS_NAME}") {
|
|
|
|
def binaryPackage = "${PROJECT_NAME}-${PACKAGE_VERSION}.tar.gz"
|
2019-10-16 15:07:48 +00:00
|
|
|
def dockerRegistryURL = "registry.zilliz.com"
|
|
|
|
|
2019-10-16 13:20:21 +00:00
|
|
|
withCredentials([usernamePassword(credentialsId: "${params.JFROG_CREDENTIALS_ID}", usernameVariable: 'JFROG_USERNAME', passwordVariable: 'JFROG_PASSWORD')]) {
|
|
|
|
def downloadStatus = sh(returnStatus: true, script: "curl -u${JFROG_USERNAME}:${JFROG_PASSWORD} -O ${params.JFROG_ARTFACTORY_URL}/milvus/package/${binaryPackage}")
|
|
|
|
|
|
|
|
if (downloadStatus != 0) {
|
|
|
|
error("\" Download \" ${params.JFROG_ARTFACTORY_URL}/milvus/package/${binaryPackage} \" failed!")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sh "tar zxvf ${binaryPackage}"
|
|
|
|
def imageName = "${PROJECT_NAME}/engine:${DOCKER_VERSION}"
|
|
|
|
|
|
|
|
try {
|
2019-10-16 15:29:40 +00:00
|
|
|
def isExistImage = sh(returnStatus: true, script: "docker inspect --type=image ${imageName} 2>&1 > /dev/null")
|
2019-10-16 14:56:35 +00:00
|
|
|
if (isExistImage == 0) {
|
|
|
|
sh "docker rmi ${imageName}"
|
|
|
|
}
|
2019-10-16 15:07:48 +00:00
|
|
|
|
2019-10-16 13:20:21 +00:00
|
|
|
def customImage = docker.build("${imageName}")
|
2019-10-16 15:07:48 +00:00
|
|
|
|
2019-10-16 15:42:57 +00:00
|
|
|
isExistImage = sh(returnStatus: true, script: "docker inspect --type=image ${dockerRegistryURL}/${imageName} 2>&1 > /dev/null")
|
2019-10-16 15:07:48 +00:00
|
|
|
if (isExistImage == 0) {
|
|
|
|
sh "docker rmi ${dockerRegistryURL}/${imageName}"
|
|
|
|
}
|
|
|
|
|
2019-10-16 15:23:49 +00:00
|
|
|
docker.withRegistry("https://${dockerRegistryURL}", "${params.DOCKER_CREDENTIALS_ID}") {
|
2019-10-16 13:20:21 +00:00
|
|
|
customImage.push()
|
|
|
|
}
|
|
|
|
} catch (exc) {
|
|
|
|
throw exc
|
|
|
|
} finally {
|
2019-10-16 15:29:40 +00:00
|
|
|
def isExistImage = sh(returnStatus: true, script: "docker inspect --type=image ${imageName} 2>&1 > /dev/null")
|
2019-10-16 15:07:48 +00:00
|
|
|
if (isExistImage == 0) {
|
|
|
|
sh "docker rmi ${imageName}"
|
|
|
|
}
|
2019-10-16 13:20:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|