From 168d23d0e3bfdbfc99ba83973fbe978eaeacba56 Mon Sep 17 00:00:00 2001 From: Tyler Mandry Date: Thu, 6 Jun 2024 14:56:13 -0700 Subject: [PATCH] Add debugging utils and comments to Fuchsia scripts This should help when debugging a failure in the Fuchsia build in CI. --- .../x86_64-gnu-integration/Dockerfile | 3 + .../x86_64-gnu-integration/build-fuchsia.sh | 86 ++++++++++++------- 2 files changed, 57 insertions(+), 32 deletions(-) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-integration/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-integration/Dockerfile index c8c754914aa63..e5f9a5c92bde7 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-integration/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-integration/Dockerfile @@ -1,3 +1,6 @@ +# This job builds Fuchsia. See docs at XXX TODO and the build-fuchsia.sh script +# in this directory for more details. + FROM ubuntu:22.04 ARG DEBIAN_FRONTEND=noninteractive diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-integration/build-fuchsia.sh b/src/ci/docker/host-x86_64/x86_64-gnu-integration/build-fuchsia.sh index 9cc508fe92881..ff2a05ed6c46c 100755 --- a/src/ci/docker/host-x86_64/x86_64-gnu-integration/build-fuchsia.sh +++ b/src/ci/docker/host-x86_64/x86_64-gnu-integration/build-fuchsia.sh @@ -2,50 +2,72 @@ # Downloads and builds the Fuchsia operating system using a toolchain installed # in $RUST_INSTALL_DIR. +# +# You may run this script locally using Docker with the following command: +# +# $ src/ci/docker/run.sh x86_64-gnu-integration set -euf -o pipefail -INTEGRATION_SHA=1011e3298775ee7cdf6f6dc73e808d6a86e33bd6 +# Set this variable to disable updating the Fuchsia checkout. This is useful for +# making local changes. You can find the Fuchsia checkout in `obj/fuchsia` in +# your local checkout after running this job for the first time. +KEEP_CHECKOUT= + +# Any upstream refs that should be cherry-picked. This can be used to include +# Gerrit changes from https://fxrev.dev during development (click the "Download" +# button on a changelist to see the cherry pick ref). Example: +# PICK_REFS=(refs/changes/71/1054071/2 refs/changes/74/1054574/2) PICK_REFS=() +# The commit hash of integration.git to check out (this controls the commit hash +# of fuchsia.git too). +INTEGRATION_SHA=1011e3298775ee7cdf6f6dc73e808d6a86e33bd6 + checkout=fuchsia jiri=.jiri_root/bin/jiri set -x -# This script will: -# - create a directory named "fuchsia" if it does not exist -# - download "jiri" to "fuchsia/.jiri_root/bin" -curl -s "https://fuchsia.googlesource.com/jiri/+/HEAD/scripts/bootstrap_jiri?format=TEXT" \ - | base64 --decode \ - | bash -s $checkout - -cd $checkout - -$jiri init \ - -partial=true \ - -analytics-opt=false \ - . - -$jiri import \ - -name=integration \ - -revision=$INTEGRATION_SHA \ - -overwrite=true \ - flower \ - "https://fuchsia.googlesource.com/integration" - -if [ -d ".git" ]; then - # Wipe out any local changes if we're reusing a checkout. - git checkout --force JIRI_HEAD -fi +if [ -z "$KEEP_CHECKOUT" ]; then + # This script will: + # - create a directory named "fuchsia" if it does not exist + # - download "jiri" to "fuchsia/.jiri_root/bin" + curl -s "https://fuchsia.googlesource.com/jiri/+/HEAD/scripts/bootstrap_jiri?format=TEXT" \ + | base64 --decode \ + | bash -s $checkout -$jiri update -autoupdate=false + cd $checkout -echo integration commit = $(git -C integration rev-parse HEAD) + $jiri init \ + -partial=true \ + -analytics-opt=false \ + . -for git_ref in "${PICK_REFS[@]}"; do - git fetch https://fuchsia.googlesource.com/fuchsia $git_ref - git cherry-pick --no-commit FETCH_HEAD -done + $jiri import \ + -name=integration \ + -revision=$INTEGRATION_SHA \ + -overwrite=true \ + flower \ + "https://fuchsia.googlesource.com/integration" + + if [ -d ".git" ]; then + # Wipe out any local changes if we're reusing a checkout. + git checkout --force JIRI_HEAD + fi + + $jiri update -autoupdate=false + + echo integration commit = $(git -C integration rev-parse HEAD) + + for git_ref in "${PICK_REFS[@]}"; do + git fetch https://fuchsia.googlesource.com/fuchsia $git_ref + git cherry-pick --no-commit FETCH_HEAD + done +else + cd $checkout +fi +# Run the script inside the Fuchsia checkout responsible for building Fuchsia. +# You can change arguments to the build by modifying this script. bash scripts/rust/build_fuchsia_from_rust_ci.sh