Attention needed from Adam Perry, Briana Berger and Owners Override
Briana Berger has uploaded the change for review![Open in Gerrit]()
Laura Peskin would like Owners Override to review this change authored by Briana Berger.
Commit message
[starnix] Creates Docker container build script for Starnix tests.
Bug: 427767342
Change-Id: Ie5df3f02435633b369d6abe6e645706cf14ef5d3
Change diff
diff --git a/scripts/docker/OWNERS b/scripts/docker/OWNERS
new file mode 100644
index 0000000..895af78
--- /dev/null
+++ b/scripts/docker/OWNERS
@@ -0,0 +1,2 @@
+briana...@google.com
+include /src/starnix/OWNERS
diff --git a/scripts/docker/build_starnix_alpine_container.sh b/scripts/docker/build_starnix_alpine_container.sh
new file mode 100644
index 0000000..3eeca70
--- /dev/null
+++ b/scripts/docker/build_starnix_alpine_container.sh
@@ -0,0 +1,112 @@
+#!/bin/bash
+# Copyright 2025 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This code is utilized by infra's run_script.py to automatically build and upload these
+# containers to CIPD as per b/427767342.
+set -e
+
+# If specified, infra uses this to upload the packages created here.
+CIPD_YAML_MANIFEST=""
+ARCHITECTURES="amd64 arm64"
+
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --cipd-yaml-manifest)
+ CIPD_YAML_MANIFEST="$2"
+ echo "Creating cipd YAML manifest at: ${CIPD_YAML_MANIFEST}"
+ shift
+ shift
+ ;;
+ --architectures)
+ ARCHITECTURES="$2"
+ shift
+ shift
+ ;;
+ *)
+ echo "Unrecognized argument: $1"
+ exit 1
+ ;;
+ esac
+done
+
+# Move to the directory of the script to find Dockerfile
+SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
+
+FUCHSIA_ROOT=$(git rev-parse --show-toplevel)
+if [ -z "${FUCHSIA_ROOT}" ]; then
+ echo "Could not find fuchsia root directory. Are you in a git repository?"
+ exit 1
+fi
+
+# Dockerfile is expected to be at src/starnix/containers/alpine/Dockerfile
+DOCKERFILE_DIR="${FUCHSIA_ROOT}/src/starnix/containers/alpine"
+
+echo "Building docker images for alpine..."
+for arch in ${ARCHITECTURES}; do
+ echo "Building for ${arch}..."
+ docker buildx build --platform "linux/${arch}" --load -t "alpine-${arch}" "${DOCKERFILE_DIR}"
+done
+
+
+OUT_DIR="${FUCHSIA_ROOT}/out/alpine_cipd"
+rm -rf "${OUT_DIR}"
+mkdir -p "${OUT_DIR}"
+
+echo "Saving docker images..."
+for arch in ${ARCHITECTURES}; do
+ arch_dir="${OUT_DIR}/${arch}"
+ mkdir -p "${arch_dir}"
+ docker save -o "${arch_dir}/alpine.tar" "alpine-${arch}:latest"
+done
+
+GIT_REV=$(git -C "${FUCHSIA_ROOT}" rev-parse HEAD)
+GIT_REPO=$(git -C "${FUCHSIA_ROOT}" config --get remote.origin.url)
+
+CIPD_CLIENT="cipd"
+
+function create_cipd_yaml() {
+ local arch=$1
+ local content_dir=$2
+ local cipd_package_name="fuchsia/starnix/alpine-image-${arch}"
+ local cipd_yaml_file="${OUT_DIR}/cipd-${arch}.yaml"
+ local generated_cipd_file="${OUT_DIR}/alpine-${arch}.cipd"
+
+ echo "Creating ${arch} package..."
+
+ tee <<EOF > "${cipd_yaml_file}"
+package: ${cipd_package_name}
+install_mode: copy
+data:
+ - file: alpine.tar
+EOF
+}
+
+for arch in ${ARCHITECTURES}; do
+ create_cipd_yaml "${arch}" "${OUT_DIR}/${arch}"
+done
+
+if [[ -n "$CIPD_YAML_MANIFEST" ]]; then
+ # The output file is a JSON file that contains a list of YAML files.
+ # It is consumed by the run_script recipe.
+ echo "[" > "${CIPD_YAML_MANIFEST}"
+ first=true
+ for arch in ${ARCHITECTURES}; do
+ if [ "$first" = true ]; then
+ first=false
+ else
+ echo "," >> "${CIPD_YAML_MANIFEST}"
+ fi
+ tee -a <<EOF >> "${CIPD_YAML_MANIFEST}"
+ {
+ "path": "${OUT_DIR}/cipd-${arch}.yaml",
+ "tags": {
+ "git_repository": "${GIT_REPO}",
+ "git_revision": "${GIT_REV}"
+ }
+ }
+EOF
+ done
+ echo "]" >> "${CIPD_YAML_MANIFEST}"
+fi
Change information
Files:
- A scripts/docker/OWNERS
- A scripts/docker/build_starnix_alpine_container.sh
Change size: M
Delta: 2 files changed, 114 insertions(+), 0 deletions(-)
Open in GerritRelated details
Attention is currently required from:
- Adam Perry
- Briana Berger
- Owners Override
Gerrit-MessageType: newchange
Gerrit-Project: fuchsia
Gerrit-Branch: main
Gerrit-Change-Id: Ie5df3f02435633b369d6abe6e645706cf14ef5d3
Gerrit-Change-Number: 1420204
Gerrit-PatchSet: 10
You received this message because you are subscribed to the Google Groups "owners-override" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
.