build canton 3x in the CI (#17966)

* build canton 3.x in build.yml

* Apply suggestions from code review

Co-authored-by: Gary Verhaegen <gary.verhaegen@digitalasset.com>

* Apply suggestions from code review

Co-authored-by: Gary Verhaegen <gary.verhaegen@digitalasset.com>

* apply suggestions

---------

Co-authored-by: Gary Verhaegen <gary.verhaegen@digitalasset.com>
This commit is contained in:
Paul Brauner 2023-12-05 16:18:35 +01:00 committed by GitHub
parent 96f16df3c0
commit 1794212369
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 69 additions and 21 deletions

View File

@ -223,7 +223,7 @@ jobs:
set -euo pipefail
git fetch
git checkout origin/main
ci/build-canton-3x.sh
ci/build-canton-3x.sh HEAD
env:
GITHUB_TOKEN: $(CANTON_READONLY_TOKEN)
- template: ci/tell-slack-failed.yml

1
canton-3x/canton-3x-sha Normal file
View File

@ -0,0 +1 @@
c47319c9

View File

@ -6,6 +6,8 @@ set -euo pipefail
eval "$(./dev-env/bin/dade-assist)"
DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
tmp=$(mktemp -d)
trap 'rm -rf ${tmp}' EXIT
@ -15,9 +17,11 @@ else
repo_url="https://$GITHUB_TOKEN@github.com/DACH-NY/canton"
fi
git clone --depth 1 --branch main $repo_url $tmp
head=$(git -C $tmp rev-parse HEAD)
echo "cloned at revision $head"
commitish=${1:-$(cat "$DIR"/../canton-3x/canton-3x-sha)}
git clone $repo_url $tmp
git -C $tmp reset --hard $commitish
echo "cloned at revision $commitish"
daml_common_staging_src="$tmp/daml-common-staging"
community_src="$tmp/community"

View File

@ -251,6 +251,33 @@ jobs:
trigger_sha: '$(trigger_sha)'
- template: report-end.yml
- job: build_canton_3x_with_bazel
dependsOn:
- check_for_release
- build_canton
variables:
- name: release_sha
value: $[ dependencies.check_for_release.outputs['out.release_sha'] ]
- template: job-variables.yml
timeoutInMinutes: 60
pool:
name: 'ubuntu_20_04'
demands: assignment -equals default
steps:
- template: report-start.yml
- checkout: self
- bash: |
set -euo pipefail
git checkout $(release_sha)
if [ -x ci/build-canton-3x.sh ]; then
ci/build-canton-3x.sh
fi
env:
GITHUB_TOKEN: $(CANTON_READONLY_TOKEN)
name: build_canton_3x
- template: report-end.yml
- job: platform_independence_test
condition: and(succeeded(),
eq(dependencies.check_for_release.outputs['out.is_release'], 'false'))

View File

@ -193,18 +193,40 @@ jobs:
git fetch
git checkout origin/main
get_canton_version_for_major_version() {
major=$1
curl -u $AUTH \
--fail \
--location \
--silent \
https://digitalasset.jfrog.io/artifactory/api/storage/assembly/canton \
| jq -r '.children[].uri' \
| sed -e 's/^\///' \
| grep -P "^${major}\.\d+\.\d+" \
| sort -V \
| tail -1
}
canton_version_to_commitish() {
canton_version=$1
STABLE_REGEX="\d+\.\d+\.\d+"
SNAPSHOT_REGEX="^${STABLE_REGEX}-snapshot\.\d{8}\.\d+(\.\d+)?\.v[0-9a-f]{8}$"
if (echo "$1" | grep -q -P "${SNAPSHOT_REGEX}"); then
# Extracting commit (short) sha from snapshot version
echo "${canton_version: -8}"
else
# relying on stable version tag
echo "v$canton_version"
fi
}
### bump canton 3.x sha ###
canton_version_to_commitish $(get_canton_version_for_major_version 3) > canton-3x/canton-3x-sha
### update binaries ###
canton_version=$(curl -u $AUTH \
--fail \
--location \
--silent \
https://digitalasset.jfrog.io/artifactory/api/storage/assembly/canton \
| jq -r '.children[].uri' \
| sed -e 's/^\///' \
| grep -P '^2\.\d+\.\d+' \
| sort -V \
| tail -1)
canton_version=$(get_canton_version_for_major_version 2)
ee_url="https://digitalasset.jfrog.io/artifactory/assembly/canton/$canton_version/canton-enterprise-$canton_version.tar.gz"
ee_tmp=$(mktemp)
@ -231,13 +253,7 @@ jobs:
### code drop ###
STABLE_REGEX="\d+\.\d+\.\d+"
SNAPSHOT_REGEX="^${STABLE_REGEX}-snapshot\.\d{8}\.\d+(\.\d+)?\.v[0-9a-f]{8}$"
if (echo "$canton_version" | grep -q -P "${SNAPSHOT_REGEX}"); then
commitish=${canton_version: -8}
else
commitish=v$canton_version
fi
commitish=$(canton_version_to_commitish $canton_version)
tmp=$(mktemp -d)
trap "rm -rf ${tmp}" EXIT