Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,12 @@ jobs:
./scripts/build_image.py \
--stellar-cli-version "${{ steps.pair.outputs.cli }}" \
--rust-version "${{ steps.pair.outputs.rust }}" \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep passing the selected digest to the build

Dropping the explicit digest makes the CI build depend on build_image.py inference, which only works while the selected rust label has exactly one pin. In the documented refresh case where builds.json appends a new digest for the same default label, newest_pair.py will still select the latest pin, but this command calls resolve_rust_digest(..., digest=None) and exits with “declares multiple digests” before building. Keep passing ${{ steps.pair.outputs.digest }} so refreshed base tags remain buildable.

Useful? React with 👍 / 👎.

--rust-image-digest "${{ steps.pair.outputs.digest }}"
- name: smoke test
run: |
./scripts/smoke_test_image.py \
--image "${{ steps.pair.outputs.image }}" \
--stellar-cli-version "${{ steps.pair.outputs.cli }}" \
--rust-version "${{ steps.pair.outputs.rust }}" \
Comment on lines 39 to 47

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Pass the digest to the smoke test

The smoke script still declares --rust-image-digest as a required argument (scripts/smoke_test_image.py), but this workflow now invokes it without that argument, so argparse exits before any smoke checks run. The resolve step already exports steps.pair.outputs.digest; pass it here or make the smoke script infer it, otherwise every CI build workflow run fails at this step.

Useful? React with 👍 / 👎.

--rust-image-digest "${{ steps.pair.outputs.digest }}"
- name: wasm reproducibility
run: |
./scripts/repro_test.py \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ jobs:
RUST_VERSION=${{ matrix.rust_version }}
RUST_BASE_SUFFIX=${{ matrix.rust_base_suffix }}
RUST_IMAGE_DIGEST=${{ matrix.rust_image_digest }}
CLI_RUST_IMAGE_DIGEST=${{ matrix.cli_rust_image_digest }}
STELLAR_CLI_REV=${{ matrix.stellar_cli_ref }}
STELLAR_CLI_VERSION=${{ matrix.stellar_cli_version }}
BUILD_DATE=${{ steps.meta.outputs.build_date }}
Expand Down
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@
ARG RUST_VERSION
ARG RUST_BASE_SUFFIX
ARG RUST_IMAGE_DIGEST
# Falls back to RUST_IMAGE_DIGEST so direct `docker build` usage keeps working
# without supplying CLI_RUST_IMAGE_DIGEST. The build scripts and CI always set
# it explicitly (from cli_rust_version) so the builder stage can diverge from
# the final stage's base image.
ARG CLI_RUST_IMAGE_DIGEST=${RUST_IMAGE_DIGEST}
ARG STELLAR_CLI_REV
ARG STELLAR_CLI_VERSION
ARG BUILD_DATE
ARG SOURCE_REPO

FROM rust@${RUST_IMAGE_DIGEST} AS builder
FROM rust@${CLI_RUST_IMAGE_DIGEST} AS builder
ARG STELLAR_CLI_REV
ARG STELLAR_CLI_VERSION
SHELL ["/bin/bash", "-eo", "pipefail", "-c"]
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,12 @@ compare the resulting WASM sha256.
./scripts/validate_json.py

# Build a local image for a declared (cli, rust base) pair. The rust base is
# given as the label plus its pinned digest (copy the pin from builds.json).
# given as the label; the digest is resolved from builds.json automatically.
./scripts/build_image.py --stellar-cli-version 26.0.0 \
--rust-version 1.94.0-slim-trixie \
--rust-image-digest sha256:f7bf1c266d9e48c8d724733fd97ba60464c44b743eb4f46f935577d3242d81d0
--rust-version 1.94.0-slim-trixie

# Only when a label carries more than one digest in builds.json do you need
# --rust-image-digest to say which pin to build.

# Smoke-test the built image.
docker run --rm stellar-cli:26.0.0-rust1.94.0-slim-trixie --version
Expand Down
8 changes: 4 additions & 4 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ The script prints the chosen release tag as its final stdout line. Commit and pu

```sh
./scripts/validate_json.py
# --rust-version is the label; --rust-image-digest is the pin's digest from
# builds.json (it pins the FROM and is cross-checked against the image's
# --rust-version is the label; build_image.py resolves its pinned digest from
# builds.json (the digest pins the FROM and is cross-checked against the image's
# org.opencontainers.image.base.digest label). The built tag is label-only.
./scripts/build_image.py --stellar-cli-version 26.1.0 --rust-version 1.95.0-slim-trixie \
--rust-image-digest sha256:e14e87345b4d5964ddcc3491d27ee046a0f23820f340c3c1e24da6880141f7c0
# Pass --rust-image-digest only when one label carries multiple digests.
./scripts/build_image.py --stellar-cli-version 26.1.0 --rust-version 1.95.0-slim-trixie
./scripts/smoke_test_image.py --image stellar-cli:26.1.0-rust1.95.0-slim-trixie \
--stellar-cli-version 26.1.0 --rust-version 1.95.0-slim-trixie \
--rust-image-digest sha256:e14e87345b4d5964ddcc3491d27ee046a0f23820f340c3c1e24da6880141f7c0
Expand Down
130 changes: 127 additions & 3 deletions builds.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,148 @@
"default_distro": "trixie",
"stellar_cli_versions": [
{
"cli_rust_version": "1.90.0-slim-bookworm@sha256:64232e656c058f4468e8d024e990acff04f0fd5a5c0a88a574dc37773d7325c9",
"ref": "8c559e832fd969aa469784b66e70891fadf94f0a",
"rust_versions": [
"1.88.0-slim-trixie@sha256:9a7159329166b45f453351a077367f501aa3e98378f7e327530e7966a139d05f",
"1.90.0-slim-trixie@sha256:7fa728f3678acf5980d5db70960cf8491aff9411976789086676bdf0c19db39e",
"1.91.1-slim-trixie@sha256:f75071363e7f4771769d4cf81b1b7b290e607f4d4459e8731f6abdcee9982dc8",
"1.92.0-slim-trixie@sha256:bf3368a992915f128293ac76917ab6e561e4dda883273c8f5c9f6f8ea37a378e",
"1.94.0-slim-trixie@sha256:f7bf1c266d9e48c8d724733fd97ba60464c44b743eb4f46f935577d3242d81d0"
],
"version": "23.2.0"
},
{
"cli_rust_version": "1.90.0-slim-bookworm@sha256:64232e656c058f4468e8d024e990acff04f0fd5a5c0a88a574dc37773d7325c9",
"ref": "496ac35be7a7d8d923fcde9bbbc650ee593d1f6f",
"rust_versions": [
"1.85.0-slim-bookworm@sha256:1829c432be4a592f3021501334d3fcca24f238432b13306a4e62669dec538e52",
"1.86.0-slim-bookworm@sha256:57d415bbd61ce11e2d5f73de068103c7bd9f3188dc132c97cef4a8f62989e944",
"1.87.0-slim-bookworm@sha256:437507c3e719e4f968033b88d851ffa9f5aceeb2dcc2482cc6cb7647811a55eb",
"1.89.0-slim-trixie@sha256:8cffb8fe4e8a95cf0d6a2060375e5a28aff4c752155aa9f1f9193530769bdf66",
"1.90.0-slim-trixie@sha256:7fa728f3678acf5980d5db70960cf8491aff9411976789086676bdf0c19db39e",
"1.91.1-slim-trixie@sha256:f75071363e7f4771769d4cf81b1b7b290e607f4d4459e8731f6abdcee9982dc8",
"1.95.0-slim-trixie@sha256:e14e87345b4d5964ddcc3491d27ee046a0f23820f340c3c1e24da6880141f7c0"
],
"version": "23.2.1"
},
{
"cli_rust_version": "1.90.0-slim-bookworm@sha256:64232e656c058f4468e8d024e990acff04f0fd5a5c0a88a574dc37773d7325c9",
"ref": "08473ac20016c369067ce0dbca91d9595e72d6d4",
"rust_versions": [
"1.85.0-slim-bookworm@sha256:1829c432be4a592f3021501334d3fcca24f238432b13306a4e62669dec538e52",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add the omitted 23.3.0 Rust rows

This 23.3.0 entry omits stable Rust versions that the new source data says are present on mainnet: tags.csv lists 23.3.0 with Rust 1.84.1, 1.84.0 (40 contracts), and 1.81.0. Since resolve_matrix.py only publishes pairs declared in builds.json, those 42 stable mainnet contracts still won't get matching Docker images even though this change is intended to cover the stable cliver rows.

Useful? React with 👍 / 👎.

"1.88.0-slim-trixie@sha256:9a7159329166b45f453351a077367f501aa3e98378f7e327530e7966a139d05f",
"1.89.0-slim-trixie@sha256:8cffb8fe4e8a95cf0d6a2060375e5a28aff4c752155aa9f1f9193530769bdf66",
"1.90.0-slim-trixie@sha256:7fa728f3678acf5980d5db70960cf8491aff9411976789086676bdf0c19db39e",
"1.91.1-slim-trixie@sha256:f75071363e7f4771769d4cf81b1b7b290e607f4d4459e8731f6abdcee9982dc8",
"1.92.0-slim-trixie@sha256:bf3368a992915f128293ac76917ab6e561e4dda883273c8f5c9f6f8ea37a378e",
"1.93.1-slim-trixie@sha256:c0a38f5662afdb298898da1d70b909af4bda4e0acff2dc52aea6360a9b9c6956"
],
"version": "23.3.0"
},
{
"cli_rust_version": "1.95.0-slim-trixie@sha256:e14e87345b4d5964ddcc3491d27ee046a0f23820f340c3c1e24da6880141f7c0",
"ref": "fc6745f3d4e90d1ef68d14d0ae947404768fa5c0",
"rust_versions": [
"1.85.0-slim-bookworm@sha256:1829c432be4a592f3021501334d3fcca24f238432b13306a4e62669dec538e52",
"1.88.0-slim-trixie@sha256:9a7159329166b45f453351a077367f501aa3e98378f7e327530e7966a139d05f",
"1.89.0-slim-trixie@sha256:8cffb8fe4e8a95cf0d6a2060375e5a28aff4c752155aa9f1f9193530769bdf66",
"1.90.0-slim-trixie@sha256:7fa728f3678acf5980d5db70960cf8491aff9411976789086676bdf0c19db39e",
"1.91.1-slim-trixie@sha256:f75071363e7f4771769d4cf81b1b7b290e607f4d4459e8731f6abdcee9982dc8",
"1.92.0-slim-trixie@sha256:bf3368a992915f128293ac76917ab6e561e4dda883273c8f5c9f6f8ea37a378e",
"1.93.0-slim-trixie@sha256:760ad1d638d70ebbd0c61e06210e1289cbe45ff6425e3ea6e01241de3e14d08e",
"1.93.1-slim-trixie@sha256:c0a38f5662afdb298898da1d70b909af4bda4e0acff2dc52aea6360a9b9c6956",
"1.95.0-slim-trixie@sha256:e14e87345b4d5964ddcc3491d27ee046a0f23820f340c3c1e24da6880141f7c0"
],
"version": "23.4.0"
},
{
"cli_rust_version": "1.95.0-slim-trixie@sha256:e14e87345b4d5964ddcc3491d27ee046a0f23820f340c3c1e24da6880141f7c0",
"ref": "a152ec2488c25136808ad28277c24b3a0765ffd4",
"rust_versions": [
"1.85.0-slim-bookworm@sha256:1829c432be4a592f3021501334d3fcca24f238432b13306a4e62669dec538e52",
"1.86.0-slim-bookworm@sha256:57d415bbd61ce11e2d5f73de068103c7bd9f3188dc132c97cef4a8f62989e944",
"1.89.0-slim-trixie@sha256:8cffb8fe4e8a95cf0d6a2060375e5a28aff4c752155aa9f1f9193530769bdf66",
"1.90.0-slim-trixie@sha256:7fa728f3678acf5980d5db70960cf8491aff9411976789086676bdf0c19db39e",
"1.91.1-slim-trixie@sha256:f75071363e7f4771769d4cf81b1b7b290e607f4d4459e8731f6abdcee9982dc8",
"1.92.0-slim-trixie@sha256:bf3368a992915f128293ac76917ab6e561e4dda883273c8f5c9f6f8ea37a378e",
"1.93.0-slim-trixie@sha256:760ad1d638d70ebbd0c61e06210e1289cbe45ff6425e3ea6e01241de3e14d08e",
"1.93.1-slim-trixie@sha256:c0a38f5662afdb298898da1d70b909af4bda4e0acff2dc52aea6360a9b9c6956"
],
"version": "23.4.1"
},
{
"cli_rust_version": "1.95.0-slim-trixie@sha256:e14e87345b4d5964ddcc3491d27ee046a0f23820f340c3c1e24da6880141f7c0",
"ref": "a64925e9391c3d3b3ef8e53dc60c23db9e6a82e4",
"rust_versions": [
"1.87.0-slim-bookworm@sha256:437507c3e719e4f968033b88d851ffa9f5aceeb2dcc2482cc6cb7647811a55eb",
"1.90.0-slim-trixie@sha256:7fa728f3678acf5980d5db70960cf8491aff9411976789086676bdf0c19db39e",
"1.92.0-slim-trixie@sha256:bf3368a992915f128293ac76917ab6e561e4dda883273c8f5c9f6f8ea37a378e",
"1.93.0-slim-trixie@sha256:760ad1d638d70ebbd0c61e06210e1289cbe45ff6425e3ea6e01241de3e14d08e",
"1.93.1-slim-trixie@sha256:c0a38f5662afdb298898da1d70b909af4bda4e0acff2dc52aea6360a9b9c6956"
],
"version": "25.0.0"
},
{
"cli_rust_version": "1.95.0-slim-trixie@sha256:e14e87345b4d5964ddcc3491d27ee046a0f23820f340c3c1e24da6880141f7c0",
"ref": "a048a57a75762458b487052e0021ea704a926bee",
"rust_versions": [
"1.90.0-slim-bookworm@sha256:64232e656c058f4468e8d024e990acff04f0fd5a5c0a88a574dc37773d7325c9"
"1.86.0-slim-bookworm@sha256:57d415bbd61ce11e2d5f73de068103c7bd9f3188dc132c97cef4a8f62989e944",
"1.87.0-slim-bookworm@sha256:437507c3e719e4f968033b88d851ffa9f5aceeb2dcc2482cc6cb7647811a55eb",
"1.88.0-slim-trixie@sha256:9a7159329166b45f453351a077367f501aa3e98378f7e327530e7966a139d05f",
"1.89.0-slim-trixie@sha256:8cffb8fe4e8a95cf0d6a2060375e5a28aff4c752155aa9f1f9193530769bdf66",
"1.90.0-slim-trixie@sha256:7fa728f3678acf5980d5db70960cf8491aff9411976789086676bdf0c19db39e",
"1.91.1-slim-trixie@sha256:f75071363e7f4771769d4cf81b1b7b290e607f4d4459e8731f6abdcee9982dc8",
"1.92.0-slim-trixie@sha256:bf3368a992915f128293ac76917ab6e561e4dda883273c8f5c9f6f8ea37a378e",
"1.93.0-slim-trixie@sha256:760ad1d638d70ebbd0c61e06210e1289cbe45ff6425e3ea6e01241de3e14d08e",
"1.93.1-slim-trixie@sha256:c0a38f5662afdb298898da1d70b909af4bda4e0acff2dc52aea6360a9b9c6956",
"1.94.0-slim-trixie@sha256:f7bf1c266d9e48c8d724733fd97ba60464c44b743eb4f46f935577d3242d81d0",
"1.94.1-slim-trixie@sha256:cf09adf8c3ebaba10779e5c23ff7fe4df4cccdab8a91f199b0c142c53fef3e1a",
"1.95.0-slim-trixie@sha256:e14e87345b4d5964ddcc3491d27ee046a0f23820f340c3c1e24da6880141f7c0",
"1.96.0-slim-trixie@sha256:26abcef3d79b8d890c4ceb17093154573e1f6479cf6dd7c1450043b8458350f6"
],
"version": "25.1.0"
},
{
"cli_rust_version": "1.95.0-slim-trixie@sha256:e14e87345b4d5964ddcc3491d27ee046a0f23820f340c3c1e24da6880141f7c0",
"ref": "28484880988199233a7e8e87c97cb12dac323cb3",
"rust_versions": [
"1.86.0-slim-bookworm@sha256:57d415bbd61ce11e2d5f73de068103c7bd9f3188dc132c97cef4a8f62989e944",
"1.89.0-slim-trixie@sha256:8cffb8fe4e8a95cf0d6a2060375e5a28aff4c752155aa9f1f9193530769bdf66",
"1.90.0-slim-trixie@sha256:7fa728f3678acf5980d5db70960cf8491aff9411976789086676bdf0c19db39e",
"1.91.1-slim-trixie@sha256:f75071363e7f4771769d4cf81b1b7b290e607f4d4459e8731f6abdcee9982dc8",
"1.92.0-slim-trixie@sha256:bf3368a992915f128293ac76917ab6e561e4dda883273c8f5c9f6f8ea37a378e",
"1.93.0-slim-trixie@sha256:760ad1d638d70ebbd0c61e06210e1289cbe45ff6425e3ea6e01241de3e14d08e",
"1.93.1-slim-trixie@sha256:c0a38f5662afdb298898da1d70b909af4bda4e0acff2dc52aea6360a9b9c6956",
"1.94.0-slim-trixie@sha256:f7bf1c266d9e48c8d724733fd97ba60464c44b743eb4f46f935577d3242d81d0",
"1.94.1-slim-trixie@sha256:cf09adf8c3ebaba10779e5c23ff7fe4df4cccdab8a91f199b0c142c53fef3e1a",
"1.95.0-slim-trixie@sha256:e14e87345b4d5964ddcc3491d27ee046a0f23820f340c3c1e24da6880141f7c0"
],
"version": "25.2.0"
},
{
"cli_rust_version": "1.95.0-slim-trixie@sha256:e14e87345b4d5964ddcc3491d27ee046a0f23820f340c3c1e24da6880141f7c0",
"ref": "60f7458e7ecffddf2f2d91dc6d0d2db4fab03ecc",
"rust_versions": [
"1.85.0-slim-bookworm@sha256:1829c432be4a592f3021501334d3fcca24f238432b13306a4e62669dec538e52",
"1.88.0-slim-trixie@sha256:9a7159329166b45f453351a077367f501aa3e98378f7e327530e7966a139d05f",
"1.90.0-slim-trixie@sha256:7fa728f3678acf5980d5db70960cf8491aff9411976789086676bdf0c19db39e",
"1.92.0-slim-trixie@sha256:bf3368a992915f128293ac76917ab6e561e4dda883273c8f5c9f6f8ea37a378e",
"1.93.0-slim-trixie@sha256:760ad1d638d70ebbd0c61e06210e1289cbe45ff6425e3ea6e01241de3e14d08e",
"1.94.0-slim-trixie@sha256:f7bf1c266d9e48c8d724733fd97ba60464c44b743eb4f46f935577d3242d81d0"
"1.93.1-slim-trixie@sha256:c0a38f5662afdb298898da1d70b909af4bda4e0acff2dc52aea6360a9b9c6956",
"1.94.0-slim-trixie@sha256:f7bf1c266d9e48c8d724733fd97ba60464c44b743eb4f46f935577d3242d81d0",
"1.94.1-slim-trixie@sha256:cf09adf8c3ebaba10779e5c23ff7fe4df4cccdab8a91f199b0c142c53fef3e1a",
"1.95.0-slim-trixie@sha256:e14e87345b4d5964ddcc3491d27ee046a0f23820f340c3c1e24da6880141f7c0"
],
"version": "26.0.0"
},
{
"cli_rust_version": "1.95.0-slim-trixie@sha256:e14e87345b4d5964ddcc3491d27ee046a0f23820f340c3c1e24da6880141f7c0",
"ref": "1228cff8022b804659750b94b315932b0e0f3f6a",
"rust_versions": [
"1.95.0-slim-trixie@sha256:e14e87345b4d5964ddcc3491d27ee046a0f23820f340c3c1e24da6880141f7c0"
"1.89.0-slim-trixie@sha256:8cffb8fe4e8a95cf0d6a2060375e5a28aff4c752155aa9f1f9193530769bdf66",
"1.95.0-slim-trixie@sha256:e14e87345b4d5964ddcc3491d27ee046a0f23820f340c3c1e24da6880141f7c0",
"1.96.0-slim-trixie@sha256:26abcef3d79b8d890c4ceb17093154573e1f6479cf6dd7c1450043b8458350f6"
],
"version": "26.1.0"
}
Expand Down
6 changes: 5 additions & 1 deletion builds.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,16 @@
"items": {
"additionalProperties": false,
"properties": {
"cli_rust_version": {
"$ref": "#/definitions/rust_pin",
"description": "Fully-qualified rust base pin (<rust_base_key>@<image_digest>) to build this stellar-cli release - not the same as the rustc used to compile contracts"
},
"ref": {
"$ref": "#/definitions/git_sha",
"description": "Upstream stellar/stellar-cli git commit SHA for this release. Source of truth; version is metadata."
},
"rust_versions": {
"description": "Append-only list of fully-qualified rust base pins (<rust_base_key>@<image_digest>) this stellar-cli release was ever built against. Refreshes append the picker's freshly-resolved pins; previously-published pins are retained so the file stays consistent with the immutable tags in the registry. The same label may appear more than once with distinct digests (e.g. a rebuilt base) each pin is its own immutable image.",
"description": "Append-only list of fully-qualified rust base pins (<rust_base_key>@<image_digest>) this stellar-cli release was ever built against. Refreshes append the picker's freshly-resolved pins; previously-published pins are retained so the file stays consistent with the immutable tags in the registry. The same label may appear more than once with distinct digests (e.g. a rebuilt base) \u2014 each pin is its own immutable image.",
"items": {
"$ref": "#/definitions/rust_pin"
},
Expand Down
13 changes: 9 additions & 4 deletions scripts/build_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
parser.add_argument("--stellar-cli-version", required=True, metavar="V")
parser.add_argument("--rust-version", required=True, metavar="KEY")
parser.add_argument("--rust-image-digest", required=True, metavar="DIGEST")
parser.add_argument("--rust-image-digest", default=None, metavar="DIGEST")
parser.add_argument("--platform", default="", metavar="P")
parser.add_argument("--tag", default="", metavar="REF")
parser.add_argument("--source-repo", default="stellar/stellar-cli-docker", metavar="SLUG")
Expand All @@ -29,13 +29,15 @@ def main(argv: list[str] | None = None) -> int:
common.preflight_checks(["buildx"])

data = builds.load()
rust_digest = args.rust_image_digest
try:
builds.assert_pair_declared(
data, args.stellar_cli_version, f"{args.rust_version}@{rust_digest}"
rust_digest = builds.resolve_rust_digest(
data, args.stellar_cli_version, args.rust_version, args.rust_image_digest
)
stellar_ref = builds.stellar_cli_ref(data, args.stellar_cli_version)
parsed = rust_keys.parse(args.rust_version)
entry = builds.find_cli(data, args.stellar_cli_version)
cli_rust_pin = entry.get("cli_rust_version") if entry else None
cli_rust_digest = builds.digest_of(cli_rust_pin) if cli_rust_pin else rust_digest
Comment on lines +38 to +40
except ValueError as exc:
common.die(str(exc))

Expand All @@ -48,6 +50,7 @@ def main(argv: list[str] | None = None) -> int:
common.log(f"building {tag}")
common.log(f" stellar-cli {args.stellar_cli_version} ({stellar_ref})")
common.log(f" rust {args.rust_version} ({rust_digest})")
common.log(f" cli-build rust ({cli_rust_digest})")
common.log(f" base rust:{parsed.version}-{parsed.suffix}")
common.log(f" platform {args.platform or '<host native>'}")

Expand All @@ -63,6 +66,8 @@ def main(argv: list[str] | None = None) -> int:
"--build-arg",
f"RUST_IMAGE_DIGEST={rust_digest}",
"--build-arg",
f"CLI_RUST_IMAGE_DIGEST={cli_rust_digest}",
"--build-arg",
f"STELLAR_CLI_REV={stellar_ref}",
"--build-arg",
f"STELLAR_CLI_VERSION={args.stellar_cli_version}",
Expand Down
29 changes: 29 additions & 0 deletions scripts/lib/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,35 @@ def assert_pair_declared(data: dict[str, Any], cli: str, rust_pin: str) -> None:
)


def resolve_rust_digest(
data: dict[str, Any], cli: str, label: str, digest: str | None = None
) -> str:
"""Resolve the pinned base digest for a (cli, rust label) pair.

When `digest` is given, assert the exact `<label>@<digest>` pin is declared
and return it. When `digest` is omitted, return the sole digest declared for
the label; raise if the label is undeclared, or if it carries more than one
digest (the caller must then disambiguate with an explicit digest).
"""
if digest is not None:
assert_pair_declared(data, cli, f"{label}@{digest}")
return digest

entry = find_cli(data, cli)
if entry is None:
raise ValueError(f"unknown stellar-cli version: {cli}")
pins = [pin for pin in entry.get("rust_versions", []) if label_of(pin) == label]
if not pins:
raise ValueError(f"stellar-cli {cli} is not declared with rust base {label} in builds.json")
if len(pins) > 1:
choices = ", ".join(digest_of(pin) for pin in pins)
raise ValueError(
f"stellar-cli {cli} declares multiple digests for rust base {label}; "
f"pass --rust-image-digest to select one of: {choices}"
)
return digest_of(pins[0])
Comment on lines +101 to +110


def derive_default_rust(data: dict[str, Any], cli: str) -> str:
distro = data.get("default_distro")
if not distro:
Expand Down
Loading
Loading