ci: move inline script into separate build-images.groovy file

Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos 2024-01-30 17:42:31 +01:00 committed by Niels de Vos
parent 31cddd1f36
commit ad0a645324
2 changed files with 28 additions and 31 deletions

20
build-images.groovy Normal file
View File

@ -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"
}
}
}

View File

@ -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