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
parent 15dd42ec
......@@ -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 } } }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment