Skip to content

Commit

Permalink
Merge branch 'list-new-commits-daniel-wong' into 'master'
Browse files Browse the repository at this point in the history
Added list-new-commits.sh to testnet/tools/nns-tools.

This is useful for figure out which canisters we want to upgrade.

This is super easy to run. No arguments are required.

(There are no optional arguments either, but we could add that later, if desired.)

This supersedes diff-latest-nns-from-deployed.sh, whose contents has now been replaced with a redirect. This is better version of that, because this does ALL (NNS) canisters, not just the one that you name on the command line. Other than that, they are very similar (hence, this supersedes). 

See merge request dfinity-lab/public/ic!13485
  • Loading branch information
daniel-wong-dfinity-org committed Jul 12, 2023
2 parents 7daffc6 + b6c094e commit 5236dd2
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 35 deletions.
37 changes: 2 additions & 35 deletions testnet/tools/nns-tools/diff-latest-nns-from-deployed.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail

NNS_TOOLS_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
source "$NNS_TOOLS_DIR/lib/include.sh"

help() {
print_green "
Usage: $0 <NNS_CANISTER_NAME> (<NETWORK>)
This script will give you a git diff between the latest version with assets available in S3 against the latest version
deployed. It can be used to determine if an upgrade proposal should be created.
NNS_CANISTER_NAME: The human readable canister name (governance, cycles-minting, ledger, root, sns-wasm, registry,
lifeline, and genesis-token supported)
NETWORK: The URL of the replica to hit, or 'ic'. Defaults to 'ic'
"
}

if [ $# -lt 1 ]; then
help
exit 1
fi

NNS_CANISTER_NAME=$1
NETWORK=${2:-ic}

LAST_DEPLOYED_COMMIT=$(nns_canister_git_version "$NETWORK" "$NNS_CANISTER_NAME")
echo >&2 "Deployed version: $LAST_DEPLOYED_COMMIT"

echo >&2 "Finding latest version with assets..."
NEXT_COMMIT_TO_DEPLOY=$(latest_commit_with_prebuilt_artifacts 2>/dev/null)
echo >&2 "Latest with assets: $NEXT_COMMIT_TO_DEPLOY"

CANISTER_CODE_LOCATION=$(get_nns_canister_code_location "$NNS_CANISTER_NAME")

echo >&2 "Commits that could be deployed: "
set -x
git log --format="%C(auto) %h %s" "$LAST_DEPLOYED_COMMIT".."$NEXT_COMMIT_TO_DEPLOY" -- $CANISTER_CODE_LOCATION
echo "This has been superseded by ./list-new-commits.sh."
exit 1
45 changes: 45 additions & 0 deletions testnet/tools/nns-tools/list-new-commits.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -euo pipefail

NNS_TOOLS_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
source "$NNS_TOOLS_DIR/lib/include.sh"

help() {
print_green "
Usage: $0
Prints unreleased canister git logs. This indicates which canisters should be
released.
TODO: Add support for SNS canisters.
"
exit 1
}

if [ $# -ne 0 ]; then
help
fi

# TODO: Let caller override this from the command line.
RELEASE_CANDIDATE_COMMIT_ID=$(latest_commit_with_prebuilt_artifacts 2>/dev/null)
echo "Tip of master:" "$RELEASE_CANDIDATE_COMMIT_ID"

# TODO: Some entries are commented out, because they are not in rs/nns/canister_ids.json.
NNS_CANISTERS=(
cycles-minting
governance
genesis-token
lifeline
registry
root
sns-wasm
)

for canister_name in "${NNS_CANISTERS[@]}"; do
echo
echo Canister: "$canister_name"

network=ic
released_commit_id=$(nns_canister_git_version "$network" "$canister_name" 2>/dev/null)
root=$(get_nns_canister_code_location "$canister_name")
git log --format="%C(auto) %h %s" "$released_commit_id".."$RELEASE_CANDIDATE_COMMIT_ID" -- $root
done

0 comments on commit 5236dd2

Please sign in to comment.