Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DevOps] Isolate docker image build & push #367

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions ci/jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ pipeline {
parameters {
booleanParam(name: 'skipTesting', defaultValue: false, description: 'Skip testing')
text(name: "testTargets", defaultValue: "${ALL_TESTS.keySet().join('\n')}", description: "A select set of tests to run")
booleanParam(name: 'buildWheels', defaultValue: true, description: 'Build Python wheels')
booleanParam(name: 'buildAndPush', defaultValue: true, description: 'Build h2ogpt docker image & push if image does not exists in harbor')
booleanParam(name: 'publish', defaultValue: false, description: 'Upload to HF')
}
options {
ansiColor('xterm')
timestamps()
}
stages {
stage('Build') {
stage('Init') {
agent {
label "linux && docker"
}
Expand All @@ -51,8 +53,22 @@ pipeline {
def commitMsg = sh(returnStdout: true, script: 'git log -1 --pretty=format:"[%an] %s"').trim()
currentBuild.displayName = "${env.BUILD_ID} - [${shortHash}]"
currentBuild.description = "${commitMsg}"
}
}
}

sh "make docker_build"
stage('Build Wheels') {
when {
anyOf {
expression { return params.buildWheels }
}
beforeAgent true
}
agent {
label "linux && docker"
}
steps {
script {
docker.image("harbor.h2o.ai/library/python:3.10").inside("--entrypoint='' --security-opt seccomp=unconfined -e USE_WHEEL=1 -e HOME=${WORKSPACE}") {
sh "make clean dist"
}
Expand All @@ -63,6 +79,23 @@ pipeline {
}
}

stage('Build & Push Docker Image') {
when {
anyOf {
expression { return params.buildAndPush }
}
beforeAgent true
}
agent {
label "linux && docker"
}
steps {
script {
sh "make docker_build"
}
}
}

stage('Tests') {
when {
anyOf {
Expand Down