Skip to content

Commit b953e3a

Browse files
authored
republish canton images (#3278)
Signed-off-by: Itai Segall <itai.segall@digitalasset.com>
1 parent 955bf68 commit b953e3a

File tree

27 files changed

+97
-516
lines changed

27 files changed

+97
-516
lines changed

MAINTENANCE.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,12 @@
1616
1. Generate a patch file of the JSON API v2 OpenAPI definition by running `diff-openapi.sh` in `token-standard/dependencies/canton-json-api-v2/openapi/`.
1717
2. Choose the Canton version you wish to upgrade to. The currently published versions on
1818
Artifactory can be found [here](https://digitalasset.jfrog.io/ui/repos/tree/General/canton-enterprise).
19-
3. Compute the hashes of the corresponding enterprise and oss versions by running:
20-
`nix store prefetch-file --json --hash-type sha256 https://digitalasset.jfrog.io/artifactory/canton-enterprise/canton-enterprise-<version>.tar.gz | jq -r '.hash'` and
21-
`nix store prefetch-file --json --hash-type sha256 https://www.canton.io/releases/canton-open-source-<version>.tar.gz | jq -r '.hash'`
22-
4. Update the Canton version and hashes of the oss and enterprise versions in `nix/canton-sources.json`.
23-
5. In case you have also made configuration changes to Canton in `simple-topology-canton.conf`, remember
19+
3. Update the hashes in `nix/canton-sources.json` by running: `build-tools/bump-canton.sh <version>`
20+
4. In case you have also made configuration changes to Canton in `simple-topology-canton.conf`, remember
2421
to also make the corresponding changes for our cluster deployments. It is recommended to test any configuration
2522
changes on scratchnet first.
26-
6. Update the OpenAPI definitions from step 1 by running `update-openapi.sh` in `token-standard/dependencies/canton-json-api-v2/openapi/`.
27-
7. Cleanup the `openapi.patch` file.
23+
5. Update the OpenAPI definitions from step 1 by running `update-openapi.sh` in `token-standard/dependencies/canton-json-api-v2/openapi/`.
24+
6. Cleanup the `openapi.patch` file.
2825
Check `token-standard/dependencies/canton-json-api-v2/openapi/CHANGES.md` and apply any changes manually if CI breaks due to
2926
token standard CLI issues that look caused by bad OpenAPI definitions.
3027

build-tools/bump-canton.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
set -euo pipefail
7+
8+
# shellcheck disable=SC1091
9+
source "${TOOLS_LIB}/libcli.source"
10+
11+
if [ "$#" -ne 1 ]; then
12+
echo "Usage: $0 <new-canton-version>"
13+
exit 1
14+
fi
15+
16+
NEW_VERSION="$1"
17+
18+
function set_value() {
19+
local key="$1"
20+
local value="$2"
21+
22+
jq --arg key "$key" --arg value "$value" '.[ $key ] = $value' nix/canton-sources.json > nix/canton-sources.tmp.json
23+
mv nix/canton-sources.tmp.json nix/canton-sources.json
24+
}
25+
26+
set_value version "$NEW_VERSION"
27+
28+
_info "Fetching enterprise tar.gz hash..."
29+
enterprise_sha256=$(nix store prefetch-file --json --hash-type sha256 "https://digitalasset.jfrog.io/artifactory/canton-enterprise/canton-enterprise-${NEW_VERSION}.tar.gz" | jq -r '.hash')
30+
# Apparently, nix256 is a thing... While nix seems to accept both, when you have the wrong one,
31+
# nix shows the nix256-formatted one, so we use that one too
32+
# (also for backward compatibility with the format we used before this script)
33+
enterprise_nix256="sha256:"$(nix hash convert --to nix32 "$enterprise_sha256")
34+
set_value enterprise_sha256 "$enterprise_nix256"
35+
36+
_info "Fetching open source tar.gz hash..."
37+
oss_sha256=$(nix store prefetch-file --json --hash-type sha256 "https://www.canton.io/releases/canton-open-source-${NEW_VERSION}.tar.gz" | jq -r '.hash')
38+
oss_nix256="sha256:"$(nix hash convert --to nix32 "$oss_sha256")
39+
set_value oss_sha256 "$oss_nix256"
40+
41+
for img in base participant mediator sequencer; do
42+
_info "Fetching image sha256 for canton-$img..."
43+
sha=$(skopeo inspect "docker://europe-docker.pkg.dev/da-images/public-all/docker/canton-$img:${CANTON_VERSION}" --format '{{.Digest}}')
44+
set_value "canton_${img}_image_sha256" "$sha"
45+
done

cluster/images/canton-base-image-dep.mk

Lines changed: 0 additions & 5 deletions
This file was deleted.

cluster/images/canton-cometbft-sequencer/local.mk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ target-driver := $(dir)/target/driver.jar
88
$(dir)/$(docker-build): $(target-driver)
99
$(dir)/$(docker-build): build_arg := --build-arg base_version=$(shell get-snapshot-version)
1010

11-
include cluster/images/canton-base-image-dep.mk
12-
1311
$(target-driver): ${COMETBFT_DRIVER}/driver.jar
1412
cp $< $@
1513

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
ARG base_version
5-
FROM canton:${base_version}
4+
ARG canton_version
5+
ARG image_sha256
6+
FROM europe-docker.pkg.dev/da-images/public-all/docker/canton-base:${canton_version}@${image_sha256}
67

7-
ARG base_version
8-
LABEL org.opencontainers.image.base.name="canton:${base_version}"
8+
ARG canton_version
9+
LABEL org.opencontainers.image.base.name="canton-base:${canton_version}"
910

1011
EXPOSE 5007
1112
EXPOSE 5008
@@ -18,9 +19,3 @@ COPY app.conf bootstrap.sc /app/
1819

1920
HEALTHCHECK --start-period=10m \
2021
CMD grpcurl -plaintext localhost:5061 grpc.health.v1.Health/Check && grpcurl -plaintext localhost:5062 grpc.health.v1.Health/Check || exit 1
21-
22-
# Not upstreamed on purpose, this is the Splice part to allow easy overrides from within Splice:
23-
COPY additional-config.conf /app/
24-
USER root
25-
RUN chown -R nonroot:nonroot /app/additional-config.conf
26-
USER nonroot

cluster/images/canton-domain/additional-config.conf

Lines changed: 0 additions & 4 deletions
This file was deleted.

cluster/images/canton-domain/app.conf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# This file is frozen, and will be deleted soon (in favor of its copy upstream in Canton repo).
2-
# Please DO NOT modify this file. For quick iterations on config changes, use additional-config.conf.
3-
# For permanent ones, please upstream the change to Canton repo.
4-
51
include required(file("/app/storage.conf"))
62

73
canton {

cluster/images/canton-domain/local.mk

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44
dir := $(call current_dir)
55

66
$(dir)/$(docker-build): $(dir)/app.conf $(dir)/bootstrap.sc
7-
$(dir)/$(docker-build): build_arg := --build-arg base_version=$(shell get-snapshot-version)
8-
9-
include cluster/images/canton-base-image-dep.mk
7+
$(dir)/$(docker-build): build_arg := --build-arg canton_version=${CANTON_VERSION} --build-arg image_sha256=${CANTON_BASE_IMAGE_SHA256}

cluster/images/canton-mediator/Dockerfile

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
# Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
ARG base_version
5-
FROM canton:${base_version}
4+
ARG canton_version
5+
ARG image_sha256
66

7-
ARG base_version
8-
LABEL org.opencontainers.image.base.name="canton:${base_version}"
7+
FROM europe-docker.pkg.dev/da-images/public-all/docker/canton-mediator:${canton_version}@${image_sha256}
98

10-
EXPOSE 5007
11-
EXPOSE 10013
12-
13-
COPY app.conf /app/
14-
15-
# Not upstreamed on purpose, this is the Splice part to allow easy overrides from within Splice:
169
COPY additional-config.conf /app/
1710
USER root
1811
RUN chown -R nonroot:nonroot /app/additional-config.conf

cluster/images/canton-mediator/app.conf

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)