Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jackjii79 committed Jan 24, 2024
1 parent 5b366e2 commit dcb6d5c
Showing 1 changed file with 32 additions and 9 deletions.
41 changes: 32 additions & 9 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.',
)
}

Expand Down Expand Up @@ -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
}
}
}
Expand All @@ -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
}
}
}
Expand All @@ -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
}
}
}
Expand Down

0 comments on commit dcb6d5c

Please sign in to comment.