-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
haiku-release.yml
309 lines (309 loc) · 11.8 KB
/
haiku-release.yml
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
---
roles:
- name: owner
oauth:
groups: ["admin"]
github:
teams: ["haiku:infrastructure"]
local:
users: ["admin"]
resource_types:
- name: rclone
type: registry-image
tags: ["((worker_tag))"]
source:
repository: ghcr.io/kallisti5/concourse-rclone-resource
tag: 1.68.1-1
resources:
- name: pipeline-time-trigger
tags: ["((worker_tag))"]
type: time
icon: alarm
source:
start: 1:00 AM
stop: 6:00 AM
location: America/Chicago
days: ((days))
- name: haiku-git
tags: ["((worker_tag))"]
type: git
icon: git
source:
uri: https://review.haiku-os.org/haiku.git
branch: ((branch))
- name: backblaze
tags: ["((worker_tag))"]
type: rclone
source:
config: |
[remote]
type = b2
hard_delete = true
account = ((b2account))
key = ((b2secret))
- name: wasabi-east
tags: ["((worker_tag))"]
type: rclone
source:
config: |
[remote]
type = s3
provider = Wasabi
access_key_id = ((s3key))
secret_access_key = ((s3secret))
endpoint = s3.us-east-1.wasabisys.com
acl = public-read
# Jobs
jobs:
- name: compile-((branch))-((arch))
public: true
plan:
- get: pipeline-time-trigger
tags: ["((worker_tag))"]
trigger: true
- get: haiku-git
tags: ["((worker_tag))"]
trigger: false
- task: build-((branch))-((media))
tags: ["((worker_tag))"]
config:
platform: linux
image_resource:
type: registry-image
source: { repository: ((container-registry))/toolchain-worker-((branch)) }
inputs:
- name: haiku-git
outputs:
- name: generated.((arch))
params:
DEFAULT_GEOLOCATION_SERVICE_KEY: ((mozilla-service-key))
DEFAULT_GEOCODING_SERVICE_KEY: ((geocoding-service-key))
run:
path: /bin/bash
args:
- -e
- -c
- |
export PATH="$PATH:/usr/local/bin"
cd haiku-git && git restore-mtime && cd ..
cd generated.((arch))
TOOLCHAIN_PRIMARY=""
TOOLCHAIN_SECONDARY=""
case "((arch))" in
"x86_gcc2h")
PRI_TRIPLET=$(../haiku-git/build/scripts/find_triplet x86_gcc2)
SEC_TRIPLET=$(../haiku-git/build/scripts/find_triplet x86)
TOOLCHAIN_PRIMARY="--cross-tools-prefix /toolchains/cross-tools-x86_gcc2/bin/${PRI_TRIPLET}-"
TOOLCHAIN_SECONDARY="--cross-tools-prefix /toolchains/cross-tools-x86/bin/${SEC_TRIPLET}-"
;;
"x86_64h")
PRI_TRIPLET=$(../haiku-git/build/scripts/find_triplet x86_64)
SEC_TRIPLET=$(../haiku-git/build/scripts/find_triplet x86)
TOOLCHAIN_PRIMARY="--cross-tools-prefix /toolchains/cross-tools-x86_64/bin/${PRI_TRIPLET}-"
TOOLCHAIN_SECONDARY="--cross-tools-prefix /toolchains/cross-tools-x86/bin/${SEC_TRIPLET}-"
;;
*)
PRI_TRIPLET=$(../haiku-git/build/scripts/find_triplet ((arch)))
TOOLCHAIN_PRIMARY="--cross-tools-prefix /toolchains/cross-tools-((arch))/bin/${PRI_TRIPLET}-"
TOOLCHAIN_SECONDARY=""
;;
esac
# Geolocation service / Geocoding service key
echo "// Autogenerated by the build system" > ../haiku-git/src/kits/network/libnetservices/DefaultGeolocationServiceKey.h
echo "#define DEFAULT_GEOLOCATION_SERVICE_KEY \"$DEFAULT_GEOLOCATION_SERVICE_KEY\"" >> ../haiku-git/src/kits/network/libnetservices/DefaultGeolocationServiceKey.h
echo "#define DEFAULT_GEOCODING_SERVICE_KEY \"$DEFAULT_GEOCODING_SERVICE_KEY\"" >> ../haiku-git/src/kits/network/libnetservices/DefaultGeolocationServiceKey.h
# EFI Signing Key
# TODO: risc-v is efi, but sbsign needs code added to support signing
if [[ "((branch))" != "r1beta3" ]]; then
case "((arch))" in
"x86_64")
echo "((efi-db-key))" | base64 -d > efi.key
;;
"arm")
echo "((efi-db-key))" | base64 -d > efi.key
;;
"arm64")
echo "((efi-db-key))" | base64 -d > efi.key
;;
esac
fi
if [[ "((branch))" != "master" ]]; then
export SOURCES="--include-sources"
fi
if [[ -f efi.key ]]; then
../haiku-git/configure --efi-signing-key efi.key --distro-compatibility official $SOURCES $TOOLCHAIN_PRIMARY $TOOLCHAIN_SECONDARY
else
../haiku-git/configure --distro-compatibility official $SOURCES $TOOLCHAIN_PRIMARY $TOOLCHAIN_SECONDARY
fi
jam -q -j2 @((profile))-((media))
#jam -q build \<repository\>Haiku # not really needed
rm -f efi.key
- task: package-((media))
tags: ["((worker_tag))"]
config:
platform: linux
image_resource:
type: registry-image
source: { repository: ((container-registry))/general-worker }
inputs:
- name: haiku-git
- name: generated.((arch))
outputs:
- name: images.((arch))
run:
path: /bin/bash
args:
- -e
- -c
- |
RELEASE=$(git -C haiku-git describe --tags --long | cut -d\- -f1,2 | sed 's/\-/\_/g' | sed 's/\_0//g')
NAME="haiku-((branch))-$RELEASE-((arch))-((media))"
cd generated.((arch))
# Normalize the artifact name
if [[ "((media))" == "anyboot" ]]; then
EXTENSION="iso"
cp haiku-((profile))-((media)).${EXTENSION} ${NAME}.${EXTENSION}
elif [[ "((media))" == "mmc" ]]; then
EXTENSION="image"
cp haiku-((media)).${EXTENSION} ${NAME}.${EXTENSION}
elif [[ "((media))" == "raw" ]]; then
EXTENSION="image"
cp haiku-((profile)).${EXTENSION} ${NAME}.${EXTENSION}
fi
ARTIFACT="${NAME}.${EXTENSION}"
if [[ "((branch))" == "master" ]]; then
# If nightly; compress build as tightly as possible
zip -j -9 ../images.((arch))/${NAME}.zip ../haiku-git/ReadMe.md ${ARTIFACT}
ARTIFACT="${NAME}.zip"
else
# otherwise, raw image in output directory
mv ${ARTIFACT} ../images.((arch))/
fi
# Change to output directory to generate remaining information
cd ../images.((arch))
sha256sum --tag ${ARTIFACT} > ${ARTIFACT}.sha256
echo "untrusted comment: minisign encrypted secret key" > /tmp/minisign.key
echo "((minisign-private))" >> /tmp/minisign.key
echo "((minisign-key))" | minisign -H -s /tmp/minisign.key -Sm ${ARTIFACT}
rm -f /tmp/minisign.key
echo "Resulting artifacts:"
find . -ls
- task: package-repository
tags: ["((worker_tag))"]
config:
platform: linux
image_resource:
type: registry-image
source: { repository: ((container-registry))/general-worker }
inputs:
- name: haiku-git
- name: generated.((arch))
outputs:
- name: repository.((arch))
run:
path: /bin/bash
args:
- -e
- -c
- |
PRI_ARCH="((arch))"
case "((arch))" in
"x86_gcc2h" | "x86_64h")
PRI_ARCH=$(echo "((arch))" | sed 's/h$//')
;;
esac
REPODIR="generated.((arch))/objects/haiku/$PRI_ARCH/packaging/repositories/Haiku"
VERSION=$(basename $REPODIR/packages/haiku-*.hpkg | cut -d- -f2)
TARGET_REPO="repository.((arch))/$PRI_ARCH/$VERSION"
mkdir -p $TARGET_REPO
cp -R $REPODIR/* $TARGET_REPO
echo "untrusted comment: minisign encrypted secret key" > /tmp/minisign.key
echo "((minisign-private))" >> /tmp/minisign.key
echo "((minisign-key))" | minisign -H -s /tmp/minisign.key -Sm $TARGET_REPO/repo
rm -f /tmp/minisign.key
echo "Resulting artifacts:"
find $TARGET_REPO -ls
- task: package-catkeys
tags: ["((worker_tag))"]
config:
platform: linux
image_resource:
type: registry-image
source: { repository: ((container-registry))/toolchain-worker-((branch)) }
inputs:
- name: haiku-git
- name: generated.((arch))
outputs:
- name: catkeys.((arch))
run:
path: /bin/bash
args:
- -e
- -c
- |
cd generated.((arch))
#jam -q catkeys
cd objects
find catalogs/ -name 'en.catkeys' -exec cp --parents -r {} ../../catkeys.((arch))/ \;
cd ../../catkeys.((arch))
ARTIFACT="haiku-((branch))-((arch))-catkeys.zip"
zip -9 -r ${ARTIFACT} catalogs/
rm -rf catalogs
sha256sum --tag ${ARTIFACT} > ${ARTIFACT}.sha256
- put: wasabi-east
tags: ["((worker_tag))"]
params:
source: images.((arch))
destination:
- dir: "remote:((bucket_image))/((arch))/"
args:
- -c
#- -vv
- put: wasabi-east
tags: ["((worker_tag))"]
params:
source: catkeys.((arch))
destination:
- dir: "remote:haiku-translations/"
args:
- -c
#- -vv
- put: backblaze
tags: ["((worker_tag))"]
params:
source: repository.((arch))
destination:
- dir: "remote:((bucket_repo))/haiku/((branch))/"
args:
- -c
#- -vv
- task: purge-caches
tags: ["((worker_tag))"]
config:
platform: linux
image_resource:
type: registry-image
source: { repository: ((container-registry))/general-worker }
inputs:
- name: repository.((arch))
run:
path: /bin/bash
args:
- -e
- -c
- |
PRI_ARCH="((arch))"
case "((arch))" in
"x86_gcc2h" | "x86_64h")
PRI_ARCH=$(echo "((arch))" | sed 's/h$//')
;;
esac
TARGET_REPO="repository.((arch))/$PRI_ARCH"
cd $TARGET_REPO;
date;
for i in $(find . -type f -print); do
URI=https://cdn.hpkg.haiku-os.org/haiku/((branch))/$PRI_ARCH/$(echo "$i" | sed 's/^\.\///')
date; echo -n "$URI ";
curl -o /dev/null -s -w "%{http_code}\n" --url "https://api.bunny.net/purge?url=$URI" \
--header "AccessKey: ((cdn-secret))";
done;