Skip to content

Commit 8bf49ed

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 8bf49ed

File tree

2 files changed

+71
-32
lines changed

2 files changed

+71
-32
lines changed

Diff for: 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

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

+68-32
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,86 @@
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
15+
#
16+
# Also see the docs in the rustc-dev-guide for more info:
17+
# https://github.com/rust-lang/rustc-dev-guide/pull/1989
518

619
set -euf -o pipefail
720

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

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

1442
set -x
1543

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
44+
if [ -z "$KEEP_CHECKOUT" ]; then
45+
# This script will:
46+
# - create a directory named "fuchsia" if it does not exist
47+
# - download "jiri" to "fuchsia/.jiri_root/bin"
48+
curl -s "https://fuchsia.googlesource.com/jiri/+/HEAD/scripts/bootstrap_jiri?format=TEXT" \
49+
| base64 --decode \
50+
| bash -s $checkout
4151

42-
$jiri update -autoupdate=false
52+
cd $checkout
4353

44-
echo integration commit = $(git -C integration rev-parse HEAD)
54+
$jiri init \
55+
-partial=true \
56+
-analytics-opt=false \
57+
.
4558

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

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

0 commit comments

Comments
 (0)