From 26b1861b8632188be29f45152cbdb292e3d2bb24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20de=20la=20R=C3=BAa=20Mart=C3=ADnez?= Date: Thu, 24 Oct 2024 18:43:42 +0200 Subject: [PATCH] [HWORKS-1555] Add Jenkins pipeline for building sklearnserver img (#29) --- Jenkinsfile | 39 ++++++++++++++++++++++++++++++ VERSION | 1 + python/sklearn-build-manifest.json | 7 ++++++ 3 files changed, 47 insertions(+) create mode 100644 Jenkinsfile create mode 100644 VERSION create mode 100644 python/sklearn-build-manifest.json diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000000..90ecc518a82 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,39 @@ +@Library("jenkins-library@main") + +import com.logicalclocks.jenkins.k8s.ImageBuilder + +properties([ + parameters([ + choice(name: 'image', choices: ['all', 'sklearnserver'], description: 'Which docker image to build'), + choice(name: 'branch', choices: ['', 'master', 'release-0.11.2', 'release-0.14.0'], description: 'Which branch to build'), + ]) +]) + +node("local") { + stage('Clone repository') { + if (params.branch == '' || params.branch == 'master'){ + checkout scm + } else { + sshagent (credentials: ['id_rsa']) { + sh """ + git fetch --all + git checkout ${params.branch} + git pull + """ + } + } + } + + stage('Build and push image(s)') { + version = readFile "${env.WORKSPACE}/VERSION" + withEnv(["VERSION=${version.trim()}"]) { + + if(params.image == 'all' || params.image == 'sklearnserver'){ + + def builder = new ImageBuilder(this) + m = readFile "${env.WORKSPACE}/python/sklearn-build-manifest.json" + builder.run(m) + } + } + } +} \ No newline at end of file diff --git a/VERSION b/VERSION new file mode 100644 index 00000000000..99eba4de931 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +4.1.0 \ No newline at end of file diff --git a/python/sklearn-build-manifest.json b/python/sklearn-build-manifest.json new file mode 100644 index 00000000000..d52063d878c --- /dev/null +++ b/python/sklearn-build-manifest.json @@ -0,0 +1,7 @@ +[ + { + "name": "hopsworks/sklearnserver", + "version": "env:VERSION", + "dockerFile": "python/sklearn.Dockerfile" + } +]