Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 99f9a35

Browse files
committedMar 19, 2025
Cache fuchsia checkout in a docker layer
This allows the Fuchsia checkout to be cached and shared across builds, which avoids any rate limits with checking out Fuchsia. Note though that the Fuchsia checkout is about 27GiB as of checkout, which might cause separate problems. try-job: x86_64-fuchsia
1 parent 75530e9 commit 99f9a35

File tree

5 files changed

+171
-62
lines changed

5 files changed

+171
-62
lines changed
 

‎src/ci/docker/host-x86_64/dist-various-2/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ WORKDIR /tmp
8484
COPY scripts/shared.sh /tmp/
8585
COPY scripts/build-fuchsia-toolchain.sh /tmp/
8686
RUN /tmp/build-fuchsia-toolchain.sh
87+
COPY scripts/checkout-fuchsia.sh /tmp/
88+
RUN /tmp/checkout-fuchsia.sh
8789
COPY host-x86_64/dist-various-2/build-solaris-toolchain.sh /tmp/
8890
RUN /tmp/build-solaris-toolchain.sh x86_64 amd64 solaris-i386 pc
8991
RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc sun

‎src/ci/docker/host-x86_64/x86_64-fuchsia/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ WORKDIR /tmp
3737
COPY scripts/shared.sh /tmp/
3838
COPY scripts/build-fuchsia-toolchain.sh /tmp/
3939
RUN /tmp/build-fuchsia-toolchain.sh
40+
COPY scripts/checkout-fuchsia.sh /tmp/
41+
RUN /tmp/checkout-fuchsia.sh
4042

4143
ENV CARGO_TARGET_X86_64_UNKNOWN_FUCHSIA_AR /usr/local/bin/llvm-ar
4244
ENV CARGO_TARGET_X86_64_UNKNOWN_FUCHSIA_RUSTFLAGS \

‎src/ci/docker/host-x86_64/x86_64-fuchsia/build-fuchsia.sh

+1-62
Original file line numberDiff line numberDiff line change
@@ -19,68 +19,7 @@
1919

2020
set -euf -o pipefail
2121

22-
# Set this variable to 1 to disable updating the Fuchsia checkout. This is
23-
# useful for making local changes. You can find the Fuchsia checkout in
24-
# `obj/x86_64-fuchsia/fuchsia` in your local checkout after running this
25-
# job for the first time.
26-
KEEP_CHECKOUT=
27-
28-
# Any upstream refs that should be cherry-picked. This can be used to include
29-
# Gerrit changes from https://fxrev.dev during development (click the "Download"
30-
# button on a changelist to see the cherry pick ref). Example:
31-
# PICK_REFS=(refs/changes/71/1054071/2 refs/changes/74/1054574/2)
32-
PICK_REFS=()
33-
34-
# The commit hash of Fuchsia's integration.git to check out. This controls the
35-
# commit hash of fuchsia.git and some other repos in the "monorepo" checkout, in
36-
# addition to versions of prebuilts. It should be bumped regularly by the
37-
# Fuchsia team – we aim for every 1-2 months.
38-
INTEGRATION_SHA=f6f83d3e3852209f7752be55694006afbe979e50
39-
40-
checkout=fuchsia
41-
jiri=.jiri_root/bin/jiri
42-
43-
set -x
44-
45-
if [ -z "$KEEP_CHECKOUT" ]; then
46-
# This script will:
47-
# - create a directory named "fuchsia" if it does not exist
48-
# - download "jiri" to "fuchsia/.jiri_root/bin"
49-
curl -s "https://fuchsia.googlesource.com/jiri/+/HEAD/scripts/bootstrap_jiri?format=TEXT" \
50-
| base64 --decode \
51-
| bash -s $checkout
52-
53-
cd $checkout
54-
55-
$jiri init \
56-
-partial=true \
57-
-analytics-opt=false \
58-
.
59-
60-
$jiri import \
61-
-name=integration \
62-
-revision=$INTEGRATION_SHA \
63-
-overwrite=true \
64-
flower \
65-
"https://fuchsia.googlesource.com/integration"
66-
67-
if [ -d ".git" ]; then
68-
# Wipe out any local changes if we're reusing a checkout.
69-
git checkout --force JIRI_HEAD
70-
fi
71-
72-
$jiri update -autoupdate=false
73-
74-
echo integration commit = $(git -C integration rev-parse HEAD)
75-
76-
for git_ref in "${PICK_REFS[@]}"; do
77-
git fetch https://fuchsia.googlesource.com/fuchsia $git_ref
78-
git cherry-pick --no-commit FETCH_HEAD
79-
done
80-
else
81-
echo Reusing existing Fuchsia checkout
82-
cd $checkout
83-
fi
22+
cd fuchsia
8423

8524
# Run the script inside the Fuchsia checkout responsible for building Fuchsia.
8625
# You can change arguments to the build by setting KEEP_CHECKOUT=1 above and
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/usr/bin/env bash
2+
3+
# Downloads and builds the Fuchsia operating system using a toolchain installed
4+
# 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-fuchsia
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-fuchsia
14+
# docker# git config --global --add safe.directory /checkout/obj/fuchsia
15+
# docker# ../src/ci/docker/host-x86_64/x86_64-fuchsia/checkout-fuchsia.sh
16+
#
17+
# Also see the docs in the rustc-dev-guide for more info:
18+
# https://github.com/rust-lang/rustc-dev-guide/pull/1989
19+
20+
set -euf -o pipefail
21+
22+
# Set this variable to 1 to disable updating the Fuchsia checkout. This is
23+
# useful for making local changes. You can find the Fuchsia checkout in
24+
# `obj/x86_64-fuchsia/fuchsia` in your local checkout after running this
25+
# job for the first time.
26+
KEEP_CHECKOUT=
27+
28+
# Any upstream refs that should be cherry-picked. This can be used to include
29+
# Gerrit changes from https://fxrev.dev during development (click the "Download"
30+
# button on a changelist to see the cherry pick ref). Example:
31+
# PICK_REFS=(refs/changes/71/1054071/2 refs/changes/74/1054574/2)
32+
PICK_REFS=()
33+
34+
# The commit hash of Fuchsia's integration.git to check out. This controls the
35+
# commit hash of fuchsia.git and some other repos in the "monorepo" checkout, in
36+
# addition to versions of prebuilts. It should be bumped regularly by the
37+
# Fuchsia team – we aim for every 1-2 months.
38+
INTEGRATION_SHA=f6f83d3e3852209f7752be55694006afbe979e50
39+
40+
checkout=fuchsia
41+
jiri=.jiri_root/bin/jiri
42+
43+
set -x
44+
45+
if [ -z "$KEEP_CHECKOUT" ]; then
46+
# This script will:
47+
# - create a directory named "fuchsia" if it does not exist
48+
# - download "jiri" to "fuchsia/.jiri_root/bin"
49+
curl -s "https://fuchsia.googlesource.com/jiri/+/HEAD/scripts/bootstrap_jiri?format=TEXT" \
50+
| base64 --decode \
51+
| bash -s $checkout
52+
53+
cd $checkout
54+
55+
$jiri init \
56+
-partial=true \
57+
-analytics-opt=false \
58+
.
59+
60+
$jiri import \
61+
-name=integration \
62+
-revision=$INTEGRATION_SHA \
63+
-overwrite=true \
64+
flower \
65+
"https://fuchsia.googlesource.com/integration"
66+
67+
if [ -d ".git" ]; then
68+
# Wipe out any local changes if we're reusing a checkout.
69+
git checkout --force JIRI_HEAD
70+
fi
71+
72+
$jiri update -autoupdate=false
73+
74+
echo integration commit = $(git -C integration rev-parse HEAD)
75+
76+
for git_ref in "${PICK_REFS[@]}"; do
77+
git fetch https://fuchsia.googlesource.com/fuchsia $git_ref
78+
git cherry-pick --no-commit FETCH_HEAD
79+
done
80+
else
81+
echo Reusing existing Fuchsia checkout
82+
cd $checkout
83+
fi
+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/usr/bin/env bash
2+
3+
# Downloads and builds the Fuchsia operating system using a toolchain installed
4+
# 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-fuchsia
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-fuchsia
14+
# docker# git config --global --add safe.directory /checkout/obj/fuchsia
15+
# docker# ../src/ci/docker/host-x86_64/x86_64-fuchsia/build-fuchsia.sh
16+
#
17+
# Also see the docs in the rustc-dev-guide for more info:
18+
# https://github.com/rust-lang/rustc-dev-guide/pull/1989
19+
20+
set -euf -o pipefail
21+
22+
# Set this variable to 1 to disable updating the Fuchsia checkout. This is
23+
# useful for making local changes. You can find the Fuchsia checkout in
24+
# `obj/x86_64-fuchsia/fuchsia` in your local checkout after running this
25+
# job for the first time.
26+
KEEP_CHECKOUT=
27+
28+
# Any upstream refs that should be cherry-picked. This can be used to include
29+
# Gerrit changes from https://fxrev.dev during development (click the "Download"
30+
# button on a changelist to see the cherry pick ref). Example:
31+
# PICK_REFS=(refs/changes/71/1054071/2 refs/changes/74/1054574/2)
32+
PICK_REFS=()
33+
34+
# The commit hash of Fuchsia's integration.git to check out. This controls the
35+
# commit hash of fuchsia.git and some other repos in the "monorepo" checkout, in
36+
# addition to versions of prebuilts. It should be bumped regularly by the
37+
# Fuchsia team – we aim for every 1-2 months.
38+
INTEGRATION_SHA=f6f83d3e3852209f7752be55694006afbe979e50
39+
40+
checkout=fuchsia
41+
jiri=.jiri_root/bin/jiri
42+
43+
set -x
44+
45+
if [ -z "$KEEP_CHECKOUT" ]; then
46+
# This script will:
47+
# - create a directory named "fuchsia" if it does not exist
48+
# - download "jiri" to "fuchsia/.jiri_root/bin"
49+
curl -s "https://fuchsia.googlesource.com/jiri/+/HEAD/scripts/bootstrap_jiri?format=TEXT" \
50+
| base64 --decode \
51+
| bash -s $checkout
52+
53+
cd $checkout
54+
55+
$jiri init \
56+
-partial=true \
57+
-analytics-opt=false \
58+
.
59+
60+
$jiri import \
61+
-name=integration \
62+
-revision=$INTEGRATION_SHA \
63+
-overwrite=true \
64+
flower \
65+
"https://fuchsia.googlesource.com/integration"
66+
67+
if [ -d ".git" ]; then
68+
# Wipe out any local changes if we're reusing a checkout.
69+
git checkout --force JIRI_HEAD
70+
fi
71+
72+
$jiri update -autoupdate=false
73+
74+
echo integration commit = $(git -C integration rev-parse HEAD)
75+
76+
for git_ref in "${PICK_REFS[@]}"; do
77+
git fetch https://fuchsia.googlesource.com/fuchsia $git_ref
78+
git cherry-pick --no-commit FETCH_HEAD
79+
done
80+
else
81+
echo Reusing existing Fuchsia checkout
82+
cd $checkout
83+
fi

0 commit comments

Comments
 (0)
Failed to load comments.