diff --git a/Jenkinsfile b/Jenkinsfile index 533d5627..565878d4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,6 +27,11 @@ pipeline { } parameters { + booleanParam( + name: 'ONLY_PUSH_MLOPS_SCORER', + defaultValue: true, + description: "Whether to only push MLOps Scorer to remote container registry." + ) booleanParam( name: 'PUSH_TO_HARBOR', defaultValue: false, @@ -43,9 +48,9 @@ pipeline { description: 'Whether to also push distribution ZIP archive to S3.', ) booleanParam( - name: 'PUSH_TO_VORVAN', - defaultValue: false, - description: 'Whether to also push Docker images to h2o.ai maintained gcr.io repo Vorvan.', + name: 'PUSH_TO_VORVAN', + defaultValue: false, + description: 'Whether to also push Docker images to h2o.ai maintained gcr.io repo Vorvan.', ) } @@ -169,14 +174,20 @@ pipeline { def imageTags = isMasterBranch() || isReleaseBranch() ? "${versionText},${gitCommitHash}" : "${gitCommitHash}" withDockerCredentials(DOCKERHUB_CREDS, "FROM_") { withDockerCredentials("harbor.h2o.ai", "TO_") { - sh "./gradlew --init-script init.gradle jib \ - -Djib.to.auth.username=${TO_DOCKER_USERNAME} \ + def cmd = "./gradlew --init-script init.gradle " + if (params.ONLY_PUSH_MLOPS_SCORER) { + cmd += ":local-rest-scorer:jib " + } else { + cmd += "jib " + } + cmd += "-Djib.to.auth.username=${TO_DOCKER_USERNAME} \ -Djib.to.auth.password=${TO_DOCKER_PASSWORD} \ -Djib.from.auth.username=${FROM_DOCKER_USERNAME} \ -Djib.from.auth.password=${FROM_DOCKER_PASSWORD} \ -Djib.to.tags=${imageTags} \ -Djib.allowInsecureRegistries=true \ -DsendCredentialsOverHttp=true" + sh cmd } } } @@ -201,17 +212,23 @@ pipeline { steps { timeout(time: 30, unit: 'MINUTES') { script { + def cmd = "./gradlew --init-script init.gradle " + if (params.ONLY_PUSH_MLOPS_SCORER) { + cmd += ":local-rest-scorer:jib " + } else { + cmd += "jib " + } def gitCommitHash = env.GIT_COMMIT def imageTags = isMasterBranch() || isReleaseBranch() ? "${versionText},${gitCommitHash}" : "${gitCommitHash}" withDockerCredentials(DOCKERHUB_CREDS, "FROM_") { withDockerCredentials(DOCKERHUB_CREDS, "TO_") { - sh "./gradlew --init-script init.gradle jib \ - -Djib.to.auth.username=${TO_DOCKER_USERNAME} \ + cmd += "-Djib.to.auth.username=${TO_DOCKER_USERNAME} \ -Djib.to.auth.password=${TO_DOCKER_PASSWORD} \ -Djib.from.auth.username=${FROM_DOCKER_USERNAME} \ -Djib.from.auth.password=${FROM_DOCKER_PASSWORD} \ -Djib.to.tags=${imageTags} \ -PdockerRepositoryPrefix=h2oai/" + sh cmd } } } @@ -236,17 +253,23 @@ pipeline { steps { timeout(time: 30, unit: 'MINUTES') { script { + def cmd = "./gradlew --init-script init.gradle " + if (params.ONLY_PUSH_MLOPS_SCORER) { + cmd += ":local-rest-scorer:jib " + } else { + cmd += "jib " + } def gitCommitHash = env.GIT_COMMIT def imageTags = isMasterBranch() || isReleaseBranch() ? "${versionText},${gitCommitHash}" : "${gitCommitHash}" withDockerCredentials(DOCKERHUB_CREDS, "FROM_") { withGCRCredentials(VORVAN_CRED) { def gcrCreds = readFile("${GCR_JSON_KEY}") withEnv(['TO_DOCKER_USERNAME=_json_key', "TO_DOCKER_PASSWORD=${gcrCreds}"]) { - sh "./gradlew --init-script init.gradle jib \ - -Djib.from.auth.username=${FROM_DOCKER_USERNAME} \ + cmd += "-Djib.from.auth.username=${FROM_DOCKER_USERNAME} \ -Djib.from.auth.password=${FROM_DOCKER_PASSWORD} \ -Djib.to.tags=${imageTags} \ -PdockerRepositoryPrefix=gcr.io/vorvan/h2oai/" + sh cmd } } }