-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJenkinsfile
115 lines (98 loc) · 3.58 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!groovy
@Library('fedora-pipeline-library@e39c66874db516f9c33f052936d78b566b90be53') _
def msg
def nvr
def artifactId
def allBuilds
// testcase name: baseos-qe.koji-build.scratch-build.validation
def pipelineMetadata = [
pipelineName: 'scratch-build-test',
pipelineDescription: 'Scratch-build components in Koji',
testCategory: 'validation',
testType: 'scratch-build',
maintainer: 'baseos-qe',
docs: 'https://github.com/fedora-ci/scratch-build-test',
contact: [
irc: '#fedora-ci',
email: '[email protected]'
],
]
pipeline {
agent {
label 'centos9'
}
options {
buildDiscarder(logRotator(daysToKeepStr: '21', artifactNumToKeepStr: '100'))
skipDefaultCheckout()
}
triggers {
ciBuildTrigger(
noSquash: true,
providerList: [
rabbitMQSubscriber(
name: 'RabbitMQ-public',
overrides: [
topic: 'org.fedoraproject.prod.bodhi.update.status.testing.koji-build-group.build.complete',
queue: '8d8bb00d-03d6-48e1-936a-05d22c728224'
],
checks: [
[field: '$.update.release.dist_tag', expectedValue: '^f[3-9]{1}[0-9]{1}$'],
[field: '$.artifact.builds[0].nvr', expectedValue: '^(annobin-|binutils-|glibc-|gcc-|llvm-|clang-|systemtap-|redhat-rpm-config-).*$']
]
)
]
)
}
parameters {
string(name: 'CI_MESSAGE', defaultValue: '{}', description: 'CI Message')
}
stages {
stage('Prepare') {
steps {
script {
msg = readJSON text: params.CI_MESSAGE
if (!msg) {
abort('Bad input, nothing to do.')
}
def kojiBuild = msg['artifact']['builds'][0]
artifactId = "koji-build:${kojiBuild['task_id']}"
nvr = kojiBuild['nvr']
def allBuildsJson = msg['artifact']['builds']
allBuilds = ""
allBuildsJson.each { key ->
if(!allBuilds) {
allBuilds = "${key['nvr']}"
} else {
allBuilds = "${allBuilds},${key['nvr']}"
}
}
}
}
}
stage('Scratch-Build in Koji') {
environment {
KOJI_KEYTAB = credentials('fedora-keytab')
KRB_PRINCIPAL = 'bpeck/[email protected]'
DIST_GIT_URL = 'https://src.fedoraproject.org'
}
steps {
checkout scm
sendMessage(type: 'running', artifactId: artifactId, pipelineMetadata: pipelineMetadata, dryRun: isPullRequest())
script {
sh("./scratch-build.sh ${allBuilds} ${msg['update']['release']['name'].toLowerCase()}")
}
}
}
}
post {
success {
sendMessage(type: 'complete', artifactId: artifactId, pipelineMetadata: pipelineMetadata, dryRun: isPullRequest())
}
failure {
sendMessage(type: 'error', artifactId: artifactId, pipelineMetadata: pipelineMetadata, dryRun: isPullRequest())
}
unstable {
sendMessage(type: 'complete', artifactId: artifactId, pipelineMetadata: pipelineMetadata, dryRun: isPullRequest())
}
}
}