Skip to content

Commit 246c9bf

Browse files
committed
Add debugging utils and comments to Fuchsia scripts
This should help when debugging a failure in the Fuchsia build in CI.
1 parent e1ac0fa commit 246c9bf

File tree

2 files changed

+68
-32
lines changed

2 files changed

+68
-32
lines changed

src/ci/docker/host-x86_64/x86_64-gnu-integration/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# This job builds a toolchain capable of building Fuchsia, and then builds
2+
# Fuchsia. See the build-fuchsia.sh script in this directory for more details.
3+
14
FROM ubuntu:22.04
25

36
ARG DEBIAN_FRONTEND=noninteractive

src/ci/docker/host-x86_64/x86_64-gnu-integration/build-fuchsia.sh

+65-32
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,83 @@
22

33
# Downloads and builds the Fuchsia operating system using a toolchain installed
44
# in $RUST_INSTALL_DIR.
5+
#
6+
# You may run this script locally using Docker with the following command:
7+
#
8+
# $ src/ci/docker/run.sh x86_64-gnu-integration
9+
#
10+
# Alternatively, from within the container with --dev, assuming you have made it
11+
# as far as building the toolchain with the above command:
12+
#
13+
# $ src/ci/docker/run.sh --dev x86_64-gnu-integration
14+
# docker# ../src/ci/docker/host-x86_64/x86_64-gnu-integration/build-fuchsia.sh
515

616
set -euf -o pipefail
717

8-
INTEGRATION_SHA=1011e3298775ee7cdf6f6dc73e808d6a86e33bd6
18+
# Set this variable to 1 to disable updating the Fuchsia checkout. This is
19+
# useful for making local changes. You can find the Fuchsia checkout in
20+
# `obj/fuchsia` in your local checkout after running this job for the first
21+
# time.
22+
KEEP_CHECKOUT=
23+
24+
# Any upstream refs that should be cherry-picked. This can be used to include
25+
# Gerrit changes from https://fxrev.dev during development (click the "Download"
26+
# button on a changelist to see the cherry pick ref). Example:
27+
# PICK_REFS=(refs/changes/71/1054071/2 refs/changes/74/1054574/2)
928
PICK_REFS=()
1029

30+
# The commit hash of Fuchsia's integration.git to check out. This controls the
31+
# commit hash of fuchsia.git and some other repos in the "monorepo" checkout, in
32+
# addition to versions of prebuilts. It should be bumped regularly by the
33+
# Fuchsia team – we aim for every 1-2 months.
34+
INTEGRATION_SHA=1011e3298775ee7cdf6f6dc73e808d6a86e33bd6
35+
1136
checkout=fuchsia
1237
jiri=.jiri_root/bin/jiri
1338

1439
set -x
1540

16-
# This script will:
17-
# - create a directory named "fuchsia" if it does not exist
18-
# - download "jiri" to "fuchsia/.jiri_root/bin"
19-
curl -s "https://fuchsia.googlesource.com/jiri/+/HEAD/scripts/bootstrap_jiri?format=TEXT" \
20-
| base64 --decode \
21-
| bash -s $checkout
22-
23-
cd $checkout
24-
25-
$jiri init \
26-
-partial=true \
27-
-analytics-opt=false \
28-
.
29-
30-
$jiri import \
31-
-name=integration \
32-
-revision=$INTEGRATION_SHA \
33-
-overwrite=true \
34-
flower \
35-
"https://fuchsia.googlesource.com/integration"
36-
37-
if [ -d ".git" ]; then
38-
# Wipe out any local changes if we're reusing a checkout.
39-
git checkout --force JIRI_HEAD
40-
fi
41+
if [ -z "$KEEP_CHECKOUT" ]; then
42+
# This script will:
43+
# - create a directory named "fuchsia" if it does not exist
44+
# - download "jiri" to "fuchsia/.jiri_root/bin"
45+
curl -s "https://fuchsia.googlesource.com/jiri/+/HEAD/scripts/bootstrap_jiri?format=TEXT" \
46+
| base64 --decode \
47+
| bash -s $checkout
4148

42-
$jiri update -autoupdate=false
49+
cd $checkout
4350

44-
echo integration commit = $(git -C integration rev-parse HEAD)
51+
$jiri init \
52+
-partial=true \
53+
-analytics-opt=false \
54+
.
4555

46-
for git_ref in "${PICK_REFS[@]}"; do
47-
git fetch https://fuchsia.googlesource.com/fuchsia $git_ref
48-
git cherry-pick --no-commit FETCH_HEAD
49-
done
56+
$jiri import \
57+
-name=integration \
58+
-revision=$INTEGRATION_SHA \
59+
-overwrite=true \
60+
flower \
61+
"https://fuchsia.googlesource.com/integration"
62+
63+
if [ -d ".git" ]; then
64+
# Wipe out any local changes if we're reusing a checkout.
65+
git checkout --force JIRI_HEAD
66+
fi
67+
68+
$jiri update -autoupdate=false
69+
70+
echo integration commit = $(git -C integration rev-parse HEAD)
71+
72+
for git_ref in "${PICK_REFS[@]}"; do
73+
git fetch https://fuchsia.googlesource.com/fuchsia $git_ref
74+
git cherry-pick --no-commit FETCH_HEAD
75+
done
76+
else
77+
echo Reusing existing Fuchsia checkout
78+
cd $checkout
79+
fi
5080

81+
# Run the script inside the Fuchsia checkout responsible for building Fuchsia.
82+
# You can change arguments to the build by setting KEEP_CHECKOUT=1 above and
83+
# modifying them in build_fuchsia_from_rust_ci.sh.
5184
bash scripts/rust/build_fuchsia_from_rust_ci.sh

0 commit comments

Comments
 (0)