-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathJenkinsfile.kola.aws
79 lines (69 loc) · 2.58 KB
/
Jenkinsfile.kola.aws
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
def utils, streams
node {
checkout scm
utils = load("utils.groovy")
streams = load("streams.groovy")
pod = readFile(file: "manifests/pod.yaml")
}
properties([
pipelineTriggers([]),
parameters([
string(name: 'STREAM',
description: 'The Stream we are testing against',
defaultValue: '',
trim: true),
string(name: 'VERSION',
description: 'Fedora CoreOS Build ID to test',
defaultValue: '',
trim: true),
string(name: 'S3_STREAM_DIR',
description: 'Fedora CoreOS S3 Stream Directory',
defaultValue: '',
trim: true)
])
])
currentBuild.description = "[${params.STREAM}] - ${params.VERSION}"
// substitute the right COSA image into the pod definition before spawning it
pod = pod.replace("COREOS_ASSEMBLER_IMAGE", "coreos-assembler:master")
// shouldn't need more than 256Mi for this job
pod = pod.replace("COREOS_ASSEMBLER_MEMORY_REQUEST", "256Mi")
podTemplate(cloud: 'openshift', label: 'coreos-assembler', yaml: pod, defaultContainer: 'jnlp') {
node('coreos-assembler') { container('coreos-assembler') {
def ami, ami_region
def no_ami = false
stage('Fetch Metadata') {
utils.shwrap("""
export AWS_CONFIG_FILE=\${AWS_FCOS_BUILDS_BOT_CONFIG}
coreos-assembler init https://github.com/coreos/fedora-coreos-config
coreos-assembler buildprep s3://${params.S3_STREAM_DIR}/builds
""")
def basearch = utils.shwrap_capture("coreos-assembler basearch")
def meta_json = "builds/${params.VERSION}/${basearch}/meta.json"
def meta = readJSON file: meta_json
if (meta.amis.size() > 0) {
ami = meta['amis'][0]['hvm']
ami_region = meta['amis'][0]['name']
} else {
no_ami = true
}
}
// fail immediately if the build contained no AMIs
if (no_ami) {
currentBuild.result = 'FAILURE'
return
}
stage('AWS Kola Run') {
utils.shwrap("""
export AWS_CONFIG_FILE=\${AWS_FCOS_KOLA_BOT_CONFIG}
kola run -p aws --aws-ami ${ami} --aws-region ${ami_region} -b fcos -j 5 || :
tar -cf - _kola_temp/ | xz -c9 > _kola_temp.tar.xz
""")
archiveArtifacts "_kola_temp.tar.xz"
}
def report = readJSON file: "_kola_temp/aws-latest/reports/report.json"
if (report["result"] != "PASS") {
currentBuild.result = 'FAILURE'
return
}
}}
}