blob: 0797a5f53796b1f8dc9080f0857ae35ac68d2c2e (
plain)
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
pipeline {
agent none
options {
timestamps()
}
environment {
KIWI_FILE = 'Fedora.kiwi'
IMAGE_TYPE = 'iso'
IMAGE_PROFILE = 'Workstation-Live'
IMAGE_VERSION = '45'
OUTPUT_DIR = 'outdir'
B2_ENDPOINT = 'https://s3.eu-central-003.backblazeb2.com'
AWS_DEFAULT_REGION = 'eu-central-003'
RPM_BUCKET = 'dist-sayagit-fedora-rpm'
ISO_BUCKET = 'dist-sayagit-fedora-iso'
// awscli2 sends CRC32 checksums by default, which B2 rejects. Ask for
// them only where the S3 API requires them.
AWS_REQUEST_CHECKSUM_CALCULATION = 'when_required'
AWS_RESPONSE_CHECKSUM_VALIDATION = 'when_required'
// Must match the <source path="dir://..."/> in
// repositories/kernel-surface.xml.
KERNEL_SURFACE_REPO = '/var/lib/kernel-surface-repo'
}
stages {
stage('Build Fedora Workstation Live ISO (ARM64)') {
agent {
kubernetes {
defaultContainer 'kiwi'
yaml """
apiVersion: v1
kind: Pod
metadata:
namespace: jenkins
spec:
nodeSelector:
kubernetes.io/arch: arm64
containers:
- name: kiwi
image: fedora:44
imagePullPolicy: Always
command: [ 'sleep' ]
args: [ 'infinity' ]
tty: true
securityContext:
privileged: true
resources:
requests:
cpu: "2"
memory: 4Gi
ephemeral-storage: 20Gi
limits:
memory: 12Gi
ephemeral-storage: 50Gi
"""
}
}
steps {
checkout scm
container('kiwi') {
script {
try {
// The kernel-surface RPM is a build input, not
// something this repository can produce: the image
// installs kernel-surface by name and <ignore>s
// Fedora's kernel packages, so it has to be in the
// local repository before kiwi starts. The buckets
// stay private, so it is pulled with credentials
// rather than fetched over a public URL.
withCredentials([usernamePassword(
credentialsId: 'backblaze-b2-dist-rpm',
usernameVariable: 'AWS_ACCESS_KEY_ID',
passwordVariable: 'AWS_SECRET_ACCESS_KEY')]) {
sh '''
set -eux
dnf --assumeyes install awscli2 createrepo_c
mkdir -p "${KERNEL_SURFACE_REPO}"
aws s3 sync --endpoint-url "${B2_ENDPOINT}" \\
"s3://${RPM_BUCKET}/fedora/${IMAGE_VERSION}/aarch64/" \\
"${KERNEL_SURFACE_REPO}/" \\
--exclude '*' --include 'kernel-surface-*.rpm'
# Say so here rather than letting kiwi fail
# several minutes later on an unresolvable
# package name.
if ! ls "${KERNEL_SURFACE_REPO}"/kernel-surface-*.rpm; then
echo "No kernel-surface RPM in ${RPM_BUCKET} for Fedora ${IMAGE_VERSION}." >&2
echo "Run the kernel-surface pipeline first." >&2
exit 1
fi
createrepo_c "${KERNEL_SURFACE_REPO}"
'''
}
sh '''
dnf --assumeyes install git kiwi kiwi-systemdeps distribution-gpg-keys
git config --global --add safe.directory .
git submodule update --init --recursive
./kiwi-build \\
--kiwi-file="${KIWI_FILE}" \\
--image-type="${IMAGE_TYPE}" \\
--image-profile="${IMAGE_PROFILE}" \\
--output-dir "${OUTPUT_DIR}"
ls -lh "${OUTPUT_DIR}-build"
'''
} catch (Exception e) {
echo "Caught exception: ${e.getMessage()}"
currentBuild.result = 'FAILURE'
throw e
}
}
stash name: "fedora-workstation-live-iso-stash", includes: "${OUTPUT_DIR}-build/Fedora.aarch64-${IMAGE_VERSION}.iso"
}
}
}
stage('Push Fedora Workstation Live ISO (ARM64)') {
agent {
kubernetes {
defaultContainer 's5cmd'
yaml """
apiVersion: v1
kind: Pod
metadata:
namespace: jenkins
spec:
containers:
- name: s5cmd
image: peakcom/s5cmd:v2.3.0
imagePullPolicy: IfNotPresent
command: [ 'sleep' ]
args: [ 'infinity' ]
tty: true
resources:
requests:
cpu: "0.5"
memory: 4Gi
"""
}
}
steps {
container('s5cmd') {
unstash "fedora-workstation-live-iso-stash"
withCredentials([usernamePassword(
credentialsId: 'backblaze-b2-dist-iso',
usernameVariable: 'AWS_ACCESS_KEY_ID',
passwordVariable: 'AWS_SECRET_ACCESS_KEY')]) {
sh '''
set -eux
cd "${OUTPUT_DIR}-build"
src="Fedora.aarch64-${IMAGE_VERSION}.iso"
moddate=$(date -r "${src}" -u +"%Y%m%d-%H%M%S")
dst="Fedora.Surface-Pro-12in.${IMAGE_PROFILE}.${IMAGE_VERSION}.${moddate}.aarch64.iso"
mv "${src}" "${dst}"
ls -lh
s5cmd --endpoint-url "${B2_ENDPOINT}" cp \\
"${dst}" \\
"s3://${ISO_BUCKET}/fedora/${IMAGE_VERSION}/aarch64/${dst}"
'''
}
}
}
}
}
}
|