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

Commit

Permalink
restore jenkins
Browse files Browse the repository at this point in the history
  • Loading branch information
jackjii79 committed Jan 26, 2024
1 parent 3ad6ff0 commit 80cbb2d
Showing 1 changed file with 6 additions and 29 deletions.
35 changes: 6 additions & 29 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ 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 Down Expand Up @@ -174,20 +169,14 @@ pipeline {
def imageTags = isMasterBranch() || isReleaseBranch() ? "${versionText},${gitCommitHash}" : "${gitCommitHash}"
withDockerCredentials(DOCKERHUB_CREDS, "FROM_") {
withDockerCredentials("harbor.h2o.ai", "TO_") {
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} \
sh "./gradlew --init-script init.gradle jib \
-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 @@ -212,23 +201,17 @@ 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_") {
cmd += "-Djib.to.auth.username=${TO_DOCKER_USERNAME} \
sh "./gradlew --init-script init.gradle jib \
-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 @@ -253,23 +236,17 @@ pipeline {
steps {
timeout(time: 30, unit: 'MINUTES') {
script {
def cmd = "./gradlew --init-script init.gradle --stacktrace "
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}"]) {
cmd += "-Djib.from.auth.username=${FROM_DOCKER_USERNAME} \
sh "./gradlew --init-script init.gradle jib \
-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 80cbb2d

Please sign in to comment.