[sync] fix canton pull (#18781)

This commit is contained in:
Gary Verhaegen 2024-03-18 19:17:52 +01:00 committed by GitHub
parent 327fd4115e
commit e0963a7cd4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 7 deletions

View File

@ -184,16 +184,16 @@ jobs:
git fetch
git checkout origin/$(Build.SourceBranchName)
ci/refresh-canton.sh
version=$(ci/refresh-canton.sh)
branch="main-canton-update-$canton3_version"
branch="main-canton-update-$version"
if git diff --exit-code origin/$(Build.SourceBranchName) -- canton build.sh >/dev/null; then
echo "Already up-to-date with latest Canton source & snapshot."
else
if [ "main" = "$(Build.SourceBranchName)" ]; then
git add build.sh canton
open_pr "$branch" "update canton to $canton3_version" "tell-slack: canton" "" "$(Build.SourceBranchName)"
open_pr "$branch" "update canton to $version" "tell-slack: canton" "" "$(Build.SourceBranchName)"
az extension add --name azure-devops
trap "az devops logout" EXIT
echo "$(System.AccessToken)" | az devops login --org "https://dev.azure.com/digitalasset"

View File

@ -8,7 +8,7 @@ DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd "$DIR/.."
if [ -z "${GITHUB_TOKEN:-}" ]; then
echo "This script requires GITHUB_TOKEN to be a valid GitHub token with read access to DACH-NY/canton."
echo "> This script requires GITHUB_TOKEN to be a valid GitHub token with read access to DACH-NY/canton." >&2
exit 1
fi
@ -20,9 +20,9 @@ CANTON_DIR=${1:-//unset}
if [ "//unset" = "$CANTON_DIR" ]; then
CANTON_DIR=$(realpath "$DIR/../.canton")
echo "Using '$CANTON_DIR' as '\$1' was not provided." >&2
echo "> Using '$CANTON_DIR' as '\$1' was not provided." >&2
if ! [ -d "$CANTON_DIR" ]; then
echo "Cloning canton for the first time, this may take a while..." >&2
echo "> Cloning canton for the first time, this may take a while..." >&2
git clone git@github.com:DACH-NY/canton.git "$CANTON_DIR" >$LOG 2>&1
fi
(
@ -33,7 +33,7 @@ if [ "//unset" = "$CANTON_DIR" ]; then
fi
if ! [ -d "$CANTON_DIR" ]; then
echo "CANTON_DIR '$CANTON_DIR' does not seem to exist."
echo "> CANTON_DIR '$CANTON_DIR' does not seem to exist." >&2
exit 1
fi
@ -53,4 +53,11 @@ for path in community daml-common-staging README.md; do
done
done
commit_sha_8=$(git -C "$CANTON_DIR" log -n1 --format=%h --abbrev=8 HEAD)
commit_date=$(git -C "$CANTON_DIR" log -n1 --format=%cd --date=format:%Y%m%d HEAD)
number_of_commits=$(git -C "$CANTON_DIR" rev-list --count HEAD)
is_modified=$(if ! git -C "$CANTON_DIR" diff-index --quiet HEAD; then echo "-dirty"; fi)
echo $commit_date.$number_of_commits.v$commit_sha_8$is_modified
trap - EXIT