forked from coreos/coreos-assembler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cci.jenkinsfile
81 lines (72 loc) · 3.37 KB
/
.cci.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
@Library('github.com/coreos/coreos-ci-lib@master') _
coreos.pod([image: 'registry.fedoraproject.org/fedora:31', runAsUser: 0, kvm: true, memory: "9Gi"]) {
checkout scm
stage("Build") {
coreos.shwrap("""
dnf install -y git
git submodule update --init
./build.sh
""")
}
stage("Test") {
parallel check: {
coreos.shwrap("""
make check
make unittest
""")
},
fcos: {
coreos.shwrap("chown builder: /srv")
// just split into separate invocations to make it easier to see where it fails
cosa_cmd("init https://github.com/coreos/fedora-coreos-config")
cosa_cmd("fetch")
cosa_cmd("build")
try {
cosa_cmd("kola run -- --parallel 8")
} finally {
coreos.shwrap("cd /srv && tar -cf - tmp/kola/ | xz -c9 > ${env.WORKSPACE}/kola.tar.xz")
archiveArtifacts allowEmptyArchive: true, artifacts: 'kola.tar.xz'
}
// sanity check kola actually ran and dumped its output in tmp/
coreos.shwrap("test -d /srv/tmp/kola")
cosa_cmd("buildextend-metal")
cosa_cmd("buildextend-installer")
cosa_cmd("buildextend-openstack")
cosa_cmd("buildextend-vmware")
cosa_cmd("compress")
cosa_cmd("buildupload --dry-run s3 --acl=public-read my-nonexistent-bucket/my/prefix")
}
}
stage("Pruning test") {
// Test that first build has been pruned
cosa_cmd("build ostree --force-image")
cosa_cmd("build ostree --force-image")
cosa_cmd("build ostree --force-image")
coreos.shwrap("cat /srv/builds/builds.json")
coreos.shwrap('jq -e ".builds|length == 3" /srv/builds/builds.json')
coreos.shwrap('jq -e ".builds[2].id | endswith(\\"0-1\\")" /srv/builds/builds.json')
// Test --skip-prune
cosa_cmd("build ostree --force-image --skip-prune")
coreos.shwrap("cat /srv/builds/builds.json")
coreos.shwrap('jq -e ".builds|length == 4" /srv/builds/builds.json')
coreos.shwrap('jq -e ".builds[3].id | endswith(\\"0-1\\")" /srv/builds/builds.json')
// Test prune --dry-run
cosa_cmd("prune --workdir /srv --dry-run")
coreos.shwrap("cat /srv/builds/builds.json")
coreos.shwrap('jq -e ".builds|length == 4" /srv/builds/builds.json')
coreos.shwrap('jq -e ".builds[3].id | endswith(\\"0-1\\")" /srv/builds/builds.json')
// Test --keep-last-n=0 skips pruning
cosa_cmd("prune --workdir /srv --keep-last-n=0")
coreos.shwrap("cat /srv/builds/builds.json")
coreos.shwrap('jq -e ".builds|length == 4" /srv/builds/builds.json')
coreos.shwrap('jq -e ".builds[3].id | endswith(\\"0-1\\")" /srv/builds/builds.json')
// Test prune --keep-last-n=1
cosa_cmd("prune --workdir /srv --keep-last-n=1")
coreos.shwrap("cat /srv/builds/builds.json")
coreos.shwrap('jq -e ".builds|length == 1" /srv/builds/builds.json')
coreos.shwrap('jq -e ".builds[0].id | endswith(\\"0-4\\")" /srv/builds/builds.json')
}
}
def cosa_cmd(args) {
coreos.shwrap("cd /srv && sudo -u builder cosa ${args}")
}