From 60e5ba58955221c37d19361f446ba2fb5cc0706a Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> Date: Wed, 30 Jun 2021 11:52:03 -0400 Subject: [PATCH] Jenkinsfile: Migrate properties to declarative options/triggers. Properties is a scripted pipeline concept and doesn't work correctly in the context of a *declarative* pipeline. * Jenkinsfile: Add 'ansicolor' to the list of requirements in the top comment. (properties): Remove. (triggers): New directive. Change-Id: Idceff87a005a935ff6af2931fd0ed466d0e73911 --- Jenkinsfile | 57 +++++++++++++++++------------------------------------ 1 file changed, 18 insertions(+), 39 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d97776fd..4b44570b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,6 +7,7 @@ // Requirements: // 1. gerrit-trigger plugin // 2. ws-cleanup plugin +// 3. ansicolor plugin // Configuration globals. def SUBMODULES = ['daemon', 'lrc', 'client-gnome', 'client-qt'] @@ -17,46 +18,28 @@ def REMOTE_BASE_DIR = '/srv/repository/ring' def RING_PUBLIC_KEY_FINGERPRINT = 'A295D773307D25A33AE72F2F64CD5FA175348F84' def SNAPCRAFT_KEY = '/var/lib/jenkins/.snap/key' -properties( - [ - [ - $class: 'BuildDiscarderProperty', - strategy: [$class: 'LogRotator', numToKeepStr: '30'] - ], - pipelineTriggers([ - [ - $class: 'GerritTrigger', - gerritProjects: [ - [ - $class: "GerritProject", - pattern: "ring-project", - branches: [ - [$class: "Branch", pattern: "master"] - ] - ] - ], - triggerOnEvents: [ - [ - $class: "PluginPatchsetCreatedEvent", - excludeDrafts: true, - excludeTrivialRebase: true, - excludeNoCodeChange: true - ], - [ - $class: "PluginCommentAddedContainsEvent", - commentAddedCommentContains: '!build' - ] - ] - ] - ]) - ] -) - pipeline { agent { label 'guix' } + triggers { + gerrit customUrl: '', + gerritProjects: [ + [branches: [[compareType: 'PLAIN', pattern: 'master']], + compareType: 'PLAIN', + disableStrictForbiddenFileVerification: false, + pattern: 'ring-project']], + triggerOnEvents: [ + commentAddedContains('!build'), + patchsetCreated(excludeDrafts: true, excludeNoCodeChange: true, + excludeTrivialRebase: true)] + } + + options { + ansiColor('xterm') + } + parameters { string(name: 'GERRIT_REFSPEC', defaultValue: 'refs/heads/master', @@ -88,10 +71,6 @@ pipeline { TARBALLS = '/opt/ring-contrib' // set the cache directory } - options { - ansiColor('xterm') - } - stages { stage('Check configuration') { when { not { expression { fileExists TARBALLS } } } -- GitLab