Skip to content

Commit d86b8c3

Browse files
committed
Balenalib now supports Debian bullseye container
* Remove temporary workarounds used to build our own balenalib-bullseye Docker container approximation.
1 parent f1c9b15 commit d86b8c3

9 files changed

+31
-119
lines changed

.travis.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@ jobs:
2626
# the first sign of trouble.
2727
before_script:
2828
- stage="$(echo ${TRAVIS_BUILD_STAGE_NAME} | tr '[A-Z]' '[a-z]')"
29-
- |
30-
if [[ "${debian_version}" == 'bullseye' ]]; then
31-
if [[ "${stage}" == 'build-env' ]]; then
32-
bash -ec "./balenalib-bullseye-build.sh build"
33-
elif [[ "${stage}" == 'server' ]]; then
34-
bash -ec "./balenalib-bullseye-build.sh run"
35-
fi
36-
fi
3729
# For some reason executing a function with 'set -e; f' hangs Travis
3830
# on error in the function, whereas 'bash -ec f' errors the build as
3931
# expected.

balenalib-bullseye-build.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

build-all.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
# Account name prefix for docker image tags.
1111
readonly DOCKERHUB_USER='arturklauser'
12+
readonly GITHUB_REPO='raspberrypi-rstudio'
1213

1314
source ./build-functions.sh
1415

@@ -18,11 +19,6 @@ function main() {
1819
docker container prune --force
1920
docker image prune --force
2021

21-
# Build our own bullseye starting image since there ain't any yet.
22-
if [[ "${debian_version}" == 'bullseye' ]]; then
23-
./balenalib-bullseye-build.sh
24-
fi
25-
2622
build 'build-env'
2723
(# handle docker in background
2824
push 'build-env'

build.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function usage() {
1919
Usage: $script_name <debian-version> <stage>
2020
debian-version: stretch ..... Debian version 9
2121
buster ...... Debian version 10
22-
bullseye .... Debian version 11 (experimental)
22+
bullseye .... Debian version 11
2323
stage: build-env ......... create build environment
2424
server-deb ........ build server Debian package
2525
desktop-deb ....... build desktop Debian package
@@ -131,12 +131,6 @@ EOF
131131
else
132132
readonly CROSS_BUILD_FIX=''
133133
fi
134-
if [[ "${DEBIAN_VERSION}" == 'bullseye' ]]; then
135-
# shellcheck disable=SC2016
136-
readonly BULLSEYE_FIX='s#(balenalib)/(raspberrypi3)#$1-$2#'
137-
else
138-
readonly BULLSEYE_FIX=''
139-
fi
140134

141135
# Build the docker image.
142136
(for i in {0..100}; do
@@ -150,7 +144,6 @@ EOF
150144
set -x
151145
time \
152146
perl -pe "${CROSS_BUILD_FIX}" "${DOCKERFILE}" \
153-
| perl -pe "${BULLSEYE_FIX}" \
154147
| docker build \
155148
--build-arg DEBIAN_VERSION="${DEBIAN_VERSION}" \
156149
--build-arg VERSION_TAG="${VERSION_TAG}" \
@@ -164,6 +157,7 @@ EOF
164157
--build-arg BUILD_DATE="$(timestamp)" \
165158
-t "${IMAGE_NAME}:${VERSION_TAG}-${DEBIAN_VERSION}" \
166159
-
160+
167161
set +x
168162
kill $pid
169163

buildx.sh

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function usage() {
1919
Usage: $script_name <debian-version> <stage>
2020
debian-version: stretch ..... Debian version 9
2121
buster ...... Debian version 10
22-
bullseye .... Debian version 11 (experimental)
22+
bullseye .... Debian version 11
2323
stage: build-env ......... create build environment
2424
server-deb ........ build server Debian package
2525
desktop-deb ....... build desktop Debian package
@@ -114,7 +114,13 @@ EOF
114114

115115
# Parallelism is no greater than number of available CPUs and max 2.
116116
readonly NPROC=$(nproc 2> /dev/null)
117-
readonly BUILD_PARALLELISM=$(min '2' "${NPROC}")
117+
# Travis: There is a 50 minute job time limit. The aarch64 VM has 32 CPUs.
118+
# Make use of them to stay within the job time limit.
119+
if [ "$TRAVIS" = 'true' ]; then
120+
readonly BUILD_PARALLELISM=$(min '8' "${NPROC}")
121+
else
122+
readonly BUILD_PARALLELISM=$(min '2' "${NPROC}")
123+
fi
118124

119125
# If we're running on real or simulated ARM we comment out the cross-build
120126
# lines.
@@ -125,20 +131,21 @@ EOF
125131
else
126132
readonly CROSS_BUILD_FIX=''
127133
fi
128-
if [[ "${DEBIAN_VERSION}" == 'bullseye' ]]; then
129-
# shellcheck disable=SC2016
130-
readonly BULLSEYE_FIX='s#(balenalib)/(raspberrypi3)#$1-$2#'
131-
else
132-
readonly BULLSEYE_FIX=''
133-
fi
134134

135135
# Build the docker image.
136136
# --load \
137137

138+
(for i in {0..100}; do
139+
sleep 1
140+
echo "Still building ... ($i min)"
141+
sleep 59
142+
done) &
143+
pid=$!
144+
# Get current commit SHA. Works also on --depth=1 shallow clones.
145+
ref="$(git log --pretty=format:'%H' HEAD^!)"
138146
set -x
139147
time \
140148
perl -pe "${CROSS_BUILD_FIX}" "${DOCKERFILE}" \
141-
| perl -pe "${BULLSEYE_FIX}" \
142149
| perl -pe 's#^(FROM '"${DOCKERHUB_USER}"'/\S+)#$1-buildx#' \
143150
| docker buildx build \
144151
--platform linux/arm/v7 \
@@ -151,11 +158,14 @@ EOF
151158
--build-arg VERSION_PATCH="${VERSION_PATCH}" \
152159
--build-arg PACKAGE_RELEASE="${PACKAGE_RELEASE}" \
153160
--build-arg BUILD_PARALLELISM="${BUILD_PARALLELISM}" \
154-
--build-arg VCS_REF="$(git log --pretty=format:'%H' HEAD~..HEAD)" \
161+
--build-arg TRAVIS="${TRAVIS}" \
162+
--build-arg VCS_REF="${ref}" \
155163
--build-arg BUILD_DATE="$(timestamp)" \
156164
-t "${IMAGE_NAME}:${VERSION_TAG}-${DEBIAN_VERSION}-buildx" \
157165
-
166+
158167
set +x
168+
kill $pid
159169

160170
echo "Done building at $(timestamp)"
161171
}

docker/Dockerfile.balenalib-raspberrypi3-debian-bullseye-build

Lines changed: 0 additions & 29 deletions
This file was deleted.

docker/Dockerfile.balenalib-raspberrypi3-debian-bullseye-run

Lines changed: 0 additions & 29 deletions
This file was deleted.

docker/Dockerfile.server

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,12 @@ RUN set -x \
195195
texlive-latex-extra \
196196
texlive-fonts-recommended \
197197
lmodern \
198-
# bullseye provisional balenalib image doesn't have this; don't fail
199-
&& (apt-get install -y texlive-generic-extra || true) \
198+
#--- begin not bullseye
199+
&& if [[ "${DEBIAN_VERSION}" != 'bullseye' ]]; then \
200+
# bullseye balenalib image doesn't have this; don't fail
201+
apt-get install -y texlive-generic-extra; \
202+
fi \
203+
#--- end not bullseye
200204
&& apt-get clean \
201205
&& rm -rf /var/lib/apt/lists/*
202206

tools/dry-run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ function main() {
6767

6868
rm -f "${log}"
6969
run ./build-all.sh
70-
# expected: like above + 2 balenalib bullseye pre-builds
71-
check_num_lines './build-all.sh' 'would execute: docker build ' 14
70+
# expected: same as above
71+
check_num_lines './build-all.sh' 'would execute: docker build ' 12
7272
check_num_lines './build-all.sh' 'would execute: docker push ' 12
7373

7474
teardown

0 commit comments

Comments
 (0)