This repository has been archived by the owner on Jun 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
231 lines (193 loc) · 6.76 KB
/
.gitlab-ci.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
image: gmacario/build-yocto
variables:
GIT_SUBMODULE_STRATEGY: 'recursive'
GIT_SSL_NO_VERIFY: 'true'
BITBAKEDIR: '$CI_PROJECT_DIR/bitbake'
IMAGE_DIR: '$CI_PROJECT_DIR/build/tmp-glibc/deploy/images'
VERSION: 'git describe --long'
RELEASE_VERSION: 'echo $CI_COMMIT_REF_NAME | cut -d- -f2'
PARSE_X86_RELEASE_VERSION: 'python3 ../meta-titania/bin/parse_release_version.py $IMAGE_DIR/qemux86-64/x86-titania-image-qemux86-64.testdata.json'
SHA_HASH: 'git rev-parse HEAD'
stages:
- setup
- build_rpi
- build_x86
- convert_x86
- release_build_rpi
- release_build_x86
- release_convert_x86
#
# Jobs below
#
bitbake:
stage: setup
script:
- source openembedded-core/oe-init-build-env
# Should be available early with the new bitbake 1.38 since it parses everything immediately
# when adding a layer and would break on ux-titania & friends otherwise
- echo 'LIBERTARIA_GIT_ORIGIN = "'${LIBERTARIA_GIT_ORIGIN}'"' >> ./conf/local.conf
# meta-virtualisation complains when 'virtualization' DISTRO_FEATURE is not set
# Suppressing the warning because we only want container stuff
- echo 'SKIP_META_VIRT_SANITY_CHECK = "1"' >> ./conf/local.conf
# # Add the layers
- bitbake-layers add-layer ../meta-raspberrypi
../meta-oe/meta-oe
../meta-oe/meta-python
../meta-oe/meta-filesystems
../meta-oe/meta-networking
../meta-oe/meta-python
../meta-go
../meta-virtualization
../meta-swupdate
../meta-titania
# Making sure config locations point where we want them to
- echo 'SSTATE_DIR = "${TOPDIR}/sstate-cache"' >> ./conf/local.conf
- echo 'DL_DIR = "${TOPDIR}/downloads"' >> ./conf/local.conf
- echo 'TMPDIR = "${TOPDIR}/tmp"' >> ./conf/local.conf
- echo 'DISTRO = "titania"' >> ./conf/local.conf
- echo 'BUILD_ID = "'$(eval $SHA_HASH)'"' >> ./conf/local.conf
artifacts:
paths:
- build
expire_in: 14 days
x86:
stage: build_x86
script:
# Adding the SSH key
- eval $(ssh-agent)
- echo $SSH_KEY_B64 | base64 -d | ssh-add -
# Ensure we have the host key
- mkdir -p ~/.ssh
- echo $SSH_HOST_KEY_B64 | base64 -d >> ~/.ssh/known_hosts
- source openembedded-core/oe-init-build-env
- MACHINE="qemux86-64" bitbake -C install dapp
- MACHINE="qemux86-64" bitbake x86-titania-image
- cp -H $IMAGE_DIR/qemux86-64/x86-titania-image-qemux86-64.wic.gz $CI_PROJECT_DIR/titania-x86-$(eval $VERSION).img.gz
cache:
key: "x86"
paths:
- build/downloads
- build/sstate-cache
artifacts:
paths:
- titania-x86-*.img.gz
expire_in: 3 days
except:
refs:
- /^release-.*$/
# Create a vmdk file as artifact for x86-virt image
create_vmdk:
stage: convert_x86
# libertaria/yocto-build is all gmacario/build-yocto
# with addition of qemu-utils packages
image: libertaria/yocto-build
script:
- gunzip $CI_PROJECT_DIR/titania-x86-$(eval $VERSION).img.gz
- qemu-img convert -O vmdk $CI_PROJECT_DIR/titania-x86-$(eval $VERSION).img $CI_PROJECT_DIR/titania-x86-$(eval $VERSION).vmdk
artifacts:
paths:
- titania-x86-*.vmdk
expire_in: 3 days
except:
refs:
- /^release-.*$/
raspberry:
stage: build_rpi
script:
# Adding the SSH key
- eval $(ssh-agent)
- echo $SSH_KEY_B64 | base64 -d | ssh-add -
# Ensure we have the host key
- mkdir ~/.ssh || true
- echo $SSH_HOST_KEY_B64 | base64 -d >> ~/.ssh/known_hosts
- source openembedded-core/oe-init-build-env
# Force rebuild for Docker
- MACHINE="raspberrypi3" bitbake -C install dapp
- MACHINE="raspberrypi3" bitbake rpi-titania-image
- MACHINE="raspberrypi3" bitbake rpi-titania-update
- cp -H $IMAGE_DIR/raspberrypi3/rpi-titania-image-raspberrypi3.wic.gz $CI_PROJECT_DIR/titania-arm-rpi-$(eval $VERSION).img.gz
- cp -H $IMAGE_DIR/raspberrypi3/rpi-titania-update-raspberrypi3.swu $CI_PROJECT_DIR/titania-arm-rpi-$(eval $VERSION).swu
cache:
key: "rpi"
paths:
- build/sstate-cache
- build/downloads
artifacts:
paths:
- titania-arm-rpi-*.img.gz
- titania-arm-rpi-*.swu
expire_in: 3 days
except:
refs:
- /^release-.*$/
# ============
# Release jobs
# ============
release_raspberry:
stage: release_build_rpi
script:
# Adding the SSH key
- eval $(ssh-agent)
- echo $SSH_KEY_B64 | base64 -d | ssh-add -
# Ensure we have the host key
- mkdir ~/.ssh || true
- echo $SSH_HOST_KEY_B64 | base64 -d >> ~/.ssh/known_hosts
- source openembedded-core/oe-init-build-env
# Force rebuild for Docker
- MACHINE="raspberrypi3" bitbake -C install dapp
- MACHINE="raspberrypi3" bitbake rpi-titania-image
- MACHINE="raspberrypi3" bitbake rpi-titania-update
- cp -H $IMAGE_DIR/raspberrypi3/rpi-titania-image-raspberrypi3.wic.gz $CI_PROJECT_DIR/titania-arm-rpi-$(eval $RELEASE_VERSION).img.gz
- cp -H $IMAGE_DIR/raspberrypi3/rpi-titania-update-raspberrypi3.swu $CI_PROJECT_DIR/titania-arm-rpi-$(eval $RELEASE_VERSION).swu
cache:
paths: []
artifacts:
paths:
- titania-arm-rpi-*.img.gz
- titania-arm-rpi-*.swu
expire_in: 90 days
only:
refs:
- /^release-.*$/
job_release_build_x86:
stage: release_build_x86
# `extends: x86` doesn't work because if the x86 job is not added (because of release branch),
# neither this job will be added to the pipeline.
script:
# Adding the SSH key
- eval $(ssh-agent)
- echo $SSH_KEY_B64 | base64 -d | ssh-add -
# Ensure we have the host key
- mkdir -p ~/.ssh
- echo $SSH_HOST_KEY_B64 | base64 -d >> ~/.ssh/known_hosts
- source openembedded-core/oe-init-build-env
- MACHINE="qemux86-64" bitbake -C install dapp
- MACHINE="qemux86-64" bitbake x86-titania-image
# Ensure the branch name matches with the distro version defined in titania.conf
- test "$(eval $PARSE_X86_RELEASE_VERSION)" = "$(eval $RELEASE_VERSION)"
- cp -H $IMAGE_DIR/qemux86-64/x86-titania-image-qemux86-64.wic.gz $CI_PROJECT_DIR/titania-x86-$(eval $RELEASE_VERSION).img.gz
only:
refs:
- /^release-.*$/
cache:
paths: []
artifacts:
paths:
- titania-x86-*.img.gz
expire_in: 90 days
job_release_convert_x86:
stage: release_convert_x86
image: libertaria/yocto-build
script:
- gunzip $CI_PROJECT_DIR/titania-x86-$(eval $RELEASE_VERSION).img.gz
- qemu-img convert -O vmdk $CI_PROJECT_DIR/titania-x86-$(eval $RELEASE_VERSION).img $CI_PROJECT_DIR/titania-x86-$(eval $RELEASE_VERSION).vmdk
only:
refs:
- /^release-.*$/
cache:
paths: []
artifacts:
paths:
- titania-x86-*.vmdk
expire_in: 90 days
# TODO: add GPG signature