-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
93 lines (79 loc) · 3.14 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
#!groovy
def hook
def testingFarmRequestId
pipeline {
// The pipeline doesn't need an agent, but individual stages can have one if they need
agent none
libraries {
// Library version is pinned down to make sure that things don't break unexpectedly
lib("fedora-pipeline-library@52e1c8a21798e61f4bf186dfd79092d147db76f2")
}
environment {
TESTING_FARM_API_KEY = credentials('testing-farm-api-key')
FEDORA_CI_TESTING_FARM_API_URL = "https://api.dev.testing-farm.io"
FEDORA_CI_TESTING_FARM_ARTIFACTS_URL = "http://artifacts.dev.testing-farm.io"
}
stages {
stage('Schedule Test') {
agent {
// We can run this stage on a proper agent, if we want
label 'dist-git'
}
steps {
script {
// Create webhook in Jenkins where we will receive updates from Testing Farm
hook = registerWebhook()
// https://testing-farm.gitlab.io/api/#operation/requestsPost
def requestPayload = [
api_key: env.TESTING_FARM_API_KEY,
test: [
fmf: [
url: "https://src.fedoraproject.org/rpms/vim",
ref: "bea8236b360616fe67569ea9de27c887d36fb9f8"
]
],
environments: [
[
arch: "x86_64",
os: [
compose: "Fedora-Rawhide"
],
tmt: [
context: [
arch: "x86_64",
distro: "fedora-37",
trigger: "build"
]
],
artifacts: [
[
id: "83123680", // Koji Task ID
type: "fedora-koji-build"
]
]
]
],
notification: [
webhook: [
url: hook.getURL()
]
]
]
def response = submitTestingFarmRequest(payloadMap: requestPayload)
testingFarmRequestId = response['id']
}
}
}
stage('Wait for Test Results') {
// Don't occupy an executor while waiting for Testing Farm to finish
agent none
steps {
script {
def response = waitForTestingFarm(requestId: testingFarmRequestId, hook: hook)
echo "Done!"
echo "${response.apiResponse}"
}
}
}
}
}