From 2d2b043b41f47c2c496d7449304d30d289402b7b Mon Sep 17 00:00:00 2001 From: Andy Thompson Date: Fri, 6 May 2022 09:31:10 +0100 Subject: [PATCH] Fix issue with pullRequest parameter being fetched before check --- Jenkinsfile | 56 ++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 94b367501..c5ff46f7f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,4 @@ -def isHarnessChange(env, pullRequest, harnesses) { +def isHarnessChange(harnesses) { def harnessLabels = harnesses.collect { "harness-${it}".toString() } << 'harness-all' return !env.CHANGE_ID || pullRequest.labels.size() == 0 || harnessLabels.any { pullRequest.labels.contains(it) } } @@ -35,7 +35,7 @@ pipeline { args '--group-add docker --entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' } } - when { expression { return isHarnessChange(env, pullRequest, ['base', 'drupal8', 'wordpress']) } } + when { expression { return isHarnessChange(['base', 'drupal8', 'wordpress']) } } stages { stage('Prepare') { steps { @@ -73,65 +73,65 @@ pipeline { } stages { stage('PHP') { - when { expression { return isHarnessChange(env, pullRequest, ['base']) } } + when { expression { return isHarnessChange(['base']) } } steps { sh './test php static' } } stage('Drupal 8') { - when { expression { return isHarnessChange(env, pullRequest, ['drupal8']) } } + when { expression { return isHarnessChange(['drupal8']) } } steps { sh './test drupal8 static' } } stage('Akeneo 5') { - when { expression { return isHarnessChange(env, pullRequest, ['akeneo']) } } + when { expression { return isHarnessChange(['akeneo']) } } steps { sh './test akeneo5 static' } } stage('Akeneo 4') { - when { expression { return isHarnessChange(env, pullRequest, ['akeneo']) } } + when { expression { return isHarnessChange(['akeneo']) } } steps { sh './test akeneo4 static' } } stage('Wordpress') { - when { expression { return isHarnessChange(env, pullRequest, ['wordpress']) } } + when { expression { return isHarnessChange(['wordpress']) } } steps { sh './test wordpress static' } } stage('PHP Dynamic') { - when { expression { return isHarnessChange(env, pullRequest, ['base']) } } + when { expression { return isHarnessChange(['base']) } } steps { sh './test php dynamic' } } stage('Drupal 8 Dynamic') { - when { expression { return isHarnessChange(env, pullRequest, ['drupal8']) } } + when { expression { return isHarnessChange(['drupal8']) } } steps { sh './test drupal8 dynamic' } } stage('Akeneo 5 Dynamic') { - when { expression { return isHarnessChange(env, pullRequest, ['akeneo']) } } + when { expression { return isHarnessChange(['akeneo']) } } steps { sh './test akeneo5 dynamic' } } stage('Akeneo 4 Dynamic') { - when { expression { return isHarnessChange(env, pullRequest, ['akeneo']) } } + when { expression { return isHarnessChange(['akeneo']) } } steps { sh './test akeneo4 dynamic' } } stage('Wordpress Dynamic') { - when { expression { return isHarnessChange(env, pullRequest, ['wordpress']) } } + when { expression { return isHarnessChange(['wordpress']) } } steps { sh './test wordpress dynamic' } } stage('PHP Mutagen') { - when { expression { return isHarnessChange(env, pullRequest, ['base']) } } + when { expression { return isHarnessChange(['base']) } } steps { sh './test php dynamic mutagen' } } stage('Drupal 8 Mutagen') { - when { expression { return isHarnessChange(env, pullRequest, ['drupal8']) } } + when { expression { return isHarnessChange(['drupal8']) } } steps { sh './test drupal8 dynamic mutagen' } } stage('Akeneo 5 Mutagen') { - when { expression { return isHarnessChange(env, pullRequest, ['akeneo']) } } + when { expression { return isHarnessChange(['akeneo']) } } steps { sh './test akeneo5 dynamic mutagen' } } stage('Akeneo 4 Dynamic Mutagen') { - when { expression { return isHarnessChange(env, pullRequest, ['akeneo']) } } + when { expression { return isHarnessChange(['akeneo']) } } steps { sh './test akeneo4 dynamic mutagen' } } stage('Wordpress Mutagen') { - when { expression { return isHarnessChange(env, pullRequest, ['wordpress']) } } + when { expression { return isHarnessChange(['wordpress']) } } steps { sh './test wordpress dynamic mutagen' } } } @@ -155,7 +155,7 @@ pipeline { args '--group-add docker --entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' } } - when { expression { return isHarnessChange(env, pullRequest, ['symfony', 'magento2', 'magento1']) } } + when { expression { return isHarnessChange(['symfony', 'magento2', 'magento1']) } } stages { stage('Prepare') { steps { @@ -189,41 +189,41 @@ pipeline { } stages { stage('Symfony') { - when { expression { return isHarnessChange(env, pullRequest, ['symfony']) } } + when { expression { return isHarnessChange(['symfony']) } } steps { sh './test symfony static' } } stage('Magento 2') { - when { expression { return isHarnessChange(env, pullRequest, ['magento2']) } } + when { expression { return isHarnessChange(['magento2']) } } steps { sh './test magento2 static' } } stage('Magento 1') { - when { expression { return isHarnessChange(env, pullRequest, ['magento1']) } } + when { expression { return isHarnessChange(['magento1']) } } steps { sh './test magento1 static' } } stage('Symfony Dynamic') { - when { expression { return isHarnessChange(env, pullRequest, ['symfony']) } } + when { expression { return isHarnessChange(['symfony']) } } steps { sh './test symfony dynamic' } } stage('Magento 2 Dynamic') { - when { expression { return isHarnessChange(env, pullRequest, ['magento2']) } } + when { expression { return isHarnessChange(['magento2']) } } steps { sh './test magento2 dynamic' } } stage('Magento 1 Dynamic') { - when { expression { return isHarnessChange(env, pullRequest, ['magento1']) } } + when { expression { return isHarnessChange(['magento1']) } } steps { sh './test magento1 dynamic' } } stage('Symfony Mutagen') { - when { expression { return isHarnessChange(env, pullRequest, ['symfony']) } } + when { expression { return isHarnessChange(['symfony']) } } steps { sh './test symfony dynamic mutagen' } } stage('Magento 2 Mutagen') { - when { expression { return isHarnessChange(env, pullRequest, ['magento2']) } } + when { expression { return isHarnessChange(['magento2']) } } steps { sh './test magento2 dynamic mutagen' } } stage('Magento 1 Mutagen') { - when { expression { return isHarnessChange(env, pullRequest, ['magento1']) } } + when { expression { return isHarnessChange(['magento1']) } } steps { sh './test magento1 dynamic mutagen' } } } @@ -248,7 +248,7 @@ pipeline { args '--group-add docker --entrypoint "" --volume /var/run/docker.sock:/var/run/docker.sock --volume "$HOME/.my127:/root/.my127"' } } - when { expression { return isHarnessChange(env, pullRequest, ['spryker']) } } + when { expression { return isHarnessChange(['spryker']) } } stages { stage('Prepare') { steps {