From 9273955d9202fb6de3411dc98313adec22c4c07e Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Wed, 31 Jan 2024 09:52:31 +0100 Subject: [PATCH] ci: replace inline `dsl:` script by Groovy files Jenkins Jobs Builder does not like the inline `dsl:` scripts anymore, so replace them by Groovy files in the main directory, similar to other jobs. Signed-off-by: Niels de Vos --- jjb-deploy.groovy | 16 ++++++++++++++++ jjb-validate.groovy | 14 ++++++++++++++ jobs/build-images.yaml | 4 ++-- jobs/jjb-deploy.yaml | 26 ++++++++------------------ jobs/jjb-validate.yaml | 24 ++++++++---------------- 5 files changed, 48 insertions(+), 36 deletions(-) create mode 100644 jjb-deploy.groovy create mode 100644 jjb-validate.groovy diff --git a/jjb-deploy.groovy b/jjb-deploy.groovy new file mode 100644 index 000000000..e53ce3501 --- /dev/null +++ b/jjb-deploy.groovy @@ -0,0 +1,16 @@ +node { + stage('build-images') { + parallel jjb: { + sh "oc start-build --follow jjb" + }, + mirror_images: { + sh 'oc start-build --follow mirror-images' + } + } + stage('checkout ci repository') { + git url: "${GIT_REPO}", branch: "${GIT_BRANCH}", changelog: false + } + stage('deployment') { + sh "./deploy/jjb.sh --cmd deploy --GIT_REF ${GIT_BRANCH} --GIT_REPO ${GIT_REPO}" + } +} diff --git a/jjb-validate.groovy b/jjb-validate.groovy new file mode 100644 index 000000000..a3a917b8f --- /dev/null +++ b/jjb-validate.groovy @@ -0,0 +1,14 @@ +if (params.ghprbPullId != null) { + GIT_BRANCH = "pull/${ghprbPullId}/merge" +} + +node { + stage('checkout ci repository') { + checkout([$class: 'GitSCM', branches: [[name: 'FETCH_HEAD']], + userRemoteConfigs: [[url: "${GIT_REPO}", + refspec: "${GIT_BRANCH}"]]]) + } + stage('validation') { + sh "./deploy/jjb.sh --cmd validate --GIT_REF ${GIT_BRANCH} --GIT_REPO ${GIT_REPO}" + } +} diff --git a/jobs/build-images.yaml b/jobs/build-images.yaml index 6f3bd4a65..04c3d4520 100644 --- a/jobs/build-images.yaml +++ b/jobs/build-images.yaml @@ -15,9 +15,9 @@ git: url: https://github.com/ceph/ceph-csi branches: - - ci/devel + - ci/centos script-path: build-images.groovy - lightweight-checkout: true + lightweight-checkout: false scm: - git: name: origin diff --git a/jobs/jjb-deploy.yaml b/jobs/jjb-deploy.yaml index 4c3e471f9..950ad9f91 100644 --- a/jobs/jjb-deploy.yaml +++ b/jobs/jjb-deploy.yaml @@ -18,24 +18,14 @@ - build-discarder: days-to-keep: 7 artifact-days-to-keep: 7 - dsl: | - node { - stage('build-images') { - parallel jjb: { - sh "oc start-build --follow jjb" - }, - mirror_images: { - sh 'oc start-build --follow mirror-images' - } - } - stage('checkout ci repository') { - git url: "${GIT_REPO}", branch: "${GIT_BRANCH}", changelog: false - } - stage('deployment') { - sh "./deploy/jjb.sh --cmd deploy \ - --GIT_REF ${GIT_BRANCH} --GIT_REPO ${GIT_REPO}" - } - } + pipeline-scm: + scm: + git: + url: https://github.com/ceph/ceph-csi + branches: + - ci/centos + script-path: jjb-deploy.groovy + lightweight-checkout: false scm: - git: name: origin diff --git a/jobs/jjb-validate.yaml b/jobs/jjb-validate.yaml index 25d4d6cc3..bac53eb0a 100644 --- a/jobs/jjb-validate.yaml +++ b/jobs/jjb-validate.yaml @@ -18,22 +18,14 @@ - build-discarder: days-to-keep: 7 artifact-days-to-keep: 7 - dsl: | - if (params.ghprbPullId != null) { - GIT_BRANCH = "pull/${ghprbPullId}/merge" - } - - node { - stage('checkout ci repository') { - checkout([$class: 'GitSCM', branches: [[name: 'FETCH_HEAD']], - userRemoteConfigs: [[url: "${GIT_REPO}", - refspec: "${GIT_BRANCH}"]]]) - } - stage('validation') { - sh "./deploy/jjb.sh --cmd validate \ - --GIT_REF ${GIT_BRANCH} --GIT_REPO ${GIT_REPO}" - } - } + pipeline-scm: + scm: + git: + url: https://github.com/ceph/ceph-csi + branches: + - ci/centos + script-path: jjb-validate.groovy + lightweight-checkout: false triggers: - github-pull-request: status-url: ${RUN_DISPLAY_URL}