|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -eou pipefail |
| 4 | + |
| 5 | +# Checkout to the root directory of the project |
| 6 | +# We suppose this script is run from a copy of the git repository. |
| 7 | +base_dir="$(git rev-parse --show-toplevel)" |
| 8 | + |
| 9 | +if [ "$#" -ne 4 ]; then |
| 10 | + echo "Error: Missing arguments." |
| 11 | + echo "Usage: $0 <old_hash> <new_hash> <old_version> <new_version>" |
| 12 | + exit 1 |
| 13 | +fi |
| 14 | + |
| 15 | +old_hash=$1 |
| 16 | +new_hash=$2 |
| 17 | +old_version=$3 |
| 18 | +new_version=$4 |
| 19 | + |
| 20 | +length_old_hash=${#old_hash} |
| 21 | +length_new_hash=${#new_hash} |
| 22 | + |
| 23 | +if [ "$length_old_hash" -ne 8 ] || [ "$length_new_hash" -ne 8 ]; then |
| 24 | + echo "Error: Hashes must be exactly 8 characters long." |
| 25 | + echo "Old hash: $old_hash, New hash: $new_hash" |
| 26 | + echo "The correct hashes can be found on the GitHub release page of MinaProtocol/Mina." |
| 27 | + exit 1 |
| 28 | +fi |
| 29 | + |
| 30 | +# The docker images are named with only 7 characters of the hash. |
| 31 | +shorter_old_hash=${old_hash:0:7} |
| 32 | +shorter_new_hash=${new_hash:0:7} |
| 33 | + |
| 34 | +echo "Updating config_${old_hash} to config_${new_hash}" |
| 35 | +sed -i'' -e "s/config_${old_hash}/config_${new_hash}/g" \ |
| 36 | + "${base_dir}"/node/testing/src/node/ocaml/config.rs \ |
| 37 | + "${base_dir}"/node/testing/src/node/ocaml/mod.rs \ |
| 38 | + "${base_dir}"/node/testing/src/scenarios/multi_node/basic_connectivity_peer_discovery.rs \ |
| 39 | + "${base_dir}"/node/testing/src/scenarios/solo_node/basic_connectivity_accept_incoming.rs |
| 40 | +sed -i'' -e "s/${old_version}-${shorter_old_hash}/${new_version}-${shorter_new_hash}/g" \ |
| 41 | + "${base_dir}"/.github/workflows/ci.yaml \ |
| 42 | + "${base_dir}"/docker-compose.archive.devnet.compare.yml \ |
| 43 | + "${base_dir}"/node/testing/src/node/ocaml/config.rs |
0 commit comments