From ad0a6453245993f78fe6f8fc4b51b5ef98933f0b Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Tue, 30 Jan 2024 17:42:31 +0100 Subject: [PATCH] ci: move inline script into separate build-images.groovy file Signed-off-by: Niels de Vos --- build-images.groovy | 20 ++++++++++++++++++++ jobs/build-images.yaml | 39 ++++++++------------------------------- 2 files changed, 28 insertions(+), 31 deletions(-) create mode 100644 build-images.groovy diff --git a/build-images.groovy b/build-images.groovy new file mode 100644 index 000000000..1a2a81ca9 --- /dev/null +++ b/build-images.groovy @@ -0,0 +1,20 @@ +def GIT_REPO = 'http://github.com/ceph/ceph-csi' +def GIT_BRANCH = 'devel' +node { + stage('checkout repository') { + git url: "${GIT_REPO}", branch: "${GIT_BRANCH}", changelog: false + } + stage('build images') { + def base_image = sh(script: 'source ${WORKSPACE}/build.env && echo ${BASE_IMAGE}', + returnStdout: true).trim() + parallel canary: { + sh "oc start-build --follow --build-arg=BASE_IMAGE='${base_image}' --build-arg=GO_ARCH=amd64 ceph-csi-canary" + }, + test: { + sh 'oc start-build --follow --build-arg=GOARCH=amd64 ceph-csi-test' + }, + devel: { + sh "oc start-build --follow --build-arg=BASE_IMAGE='${base_image}' --build-arg=GOARCH=amd64 ceph-csi-devel" + } + } +} diff --git a/jobs/build-images.yaml b/jobs/build-images.yaml index 97575995b..6f3bd4a65 100644 --- a/jobs/build-images.yaml +++ b/jobs/build-images.yaml @@ -10,37 +10,14 @@ - build-discarder: days-to-keep: 7 artifact-days-to-keep: 7 - # yamllint disable rule:line-length - dsl: | - def GIT_REPO = 'http://github.com/ceph/ceph-csi' - def GIT_BRANCH = 'devel' - node { - stage('checkout repository') { - git url: "${GIT_REPO}", branch: "${GIT_BRANCH}", changelog: false - } - stage('build images') { - def base_image = sh(script: 'source ${WORKSPACE}/build.env && echo ${BASE_IMAGE}', - returnStdout: true).trim() - parallel canary: { - sh "oc start-build --follow \ - --build-arg=BASE_IMAGE='${base_image}' \ - --build-arg=GO_ARCH=amd64 \ - ceph-csi-canary" - }, - test: { - sh 'oc start-build --follow \ - --build-arg=GOARCH=amd64 \ - ceph-csi-test' - }, - devel: { - sh "oc start-build --follow \ - --build-arg=BASE_IMAGE='${base_image}' \ - --build-arg=GOARCH=amd64 \ - ceph-csi-devel" - } - } - } - # yamllint enable rule:line-length + pipeline-scm: + scm: + git: + url: https://github.com/ceph/ceph-csi + branches: + - ci/devel + script-path: build-images.groovy + lightweight-checkout: true scm: - git: name: origin