forked from coreos/fedora-coreos-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cci.jenkinsfile
71 lines (62 loc) · 3.02 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
// Documentation: https://github.com/coreos/coreos-ci/blob/main/README-upstream-ci.md
cosaPod {
checkoutToDir(scm, 'config')
def basearch = shwrapCapture("cosa basearch")
def mechanical_streams = ['branched', 'rawhide']
shwrap("cd config && ci/validate")
shwrap("""
mkdir -p /srv/fcos && cd /srv/fcos
cosa init ${env.WORKSPACE}/config
curl -LO https://raw.githubusercontent.com/coreos/fedora-coreos-releng-automation/main/scripts/download-overrides.py
python3 download-overrides.py
# prep from the latest builds so that we generate a diff on PRs that add packages
cosa buildprep https://builds.coreos.fedoraproject.org/prod/streams/${env.CHANGE_TARGET}/builds
""")
// use a --parent-build arg so we can diff later and it matches prod
def parent_arg = ""
def parent_commit = ""
if (shwrapRc("test -e /srv/fcos/builds/latest/${basearch}/meta.json") == 0) {
shwrap("cp /srv/fcos/builds/latest/${basearch}/meta.json .") // readJSON wants it in the WORKSPACE
def meta = readJSON file: "meta.json"
def version = meta["buildid"]
parent_arg = "--parent-build ${version}"
parent_commit = meta["ostree-commit"]
}
// do a build. If we are operating on a mechanical stream then we
// can pin packages in lockfiles but we don't maintain a full set
// so we can't do a strict build.
def no_strict_build = false
if (env.CHANGE_TARGET in mechanical_streams) {
no_strict_build = true
}
fcosBuild(skipInit: true, noStrict: no_strict_build, extraFetchArgs: '--with-cosa-overrides', extraArgs: parent_arg)
parallel metal: {
shwrap("cd /srv/fcos && cosa buildextend-metal")
}, metal4k: {
shwrap("cd /srv/fcos && cosa buildextend-metal4k")
}
stage("Test ISO") {
shwrap("cd /srv/fcos && cosa buildextend-live")
try {
shwrap("cd /srv/fcos && kola testiso -S --scenarios pxe-install,pxe-offline-install,iso-install --output-dir tmp/kola-testiso")
shwrap("cd /srv/fcos && kola testiso -S --scenarios iso-offline-install --qemu-multipath --output-dir tmp/kola-testiso-mpath")
} finally {
shwrap("cd /srv/fcos && tar -cf - tmp/kola-testiso/ tmp/kola-testiso-mpath/ | xz -c9 > ${env.WORKSPACE}/kola-testiso.tar.xz")
archiveArtifacts allowEmptyArchive: true, artifacts: 'kola-testiso.tar.xz'
}
}
// also print the pkgdiff as a separate stage to make it more visible
if (parent_arg != "") {
stage("RPM Diff") {
shwrap("""
cd /srv/fcos
new_commit=\$(jq -r '.["ostree-commit"]' builds/latest/${basearch}/meta.json)
rpm-ostree db diff --repo tmp/repo ${parent_commit} \${new_commit} | tee tmp/diff.txt
if grep -q Downgraded tmp/diff.txt; then
echo "Downgrade detected. This is likely unintentional. If not, you may safely ignore this error."
exit 1
fi
""")
}
}
}