Skip to content

Commit 9fd7042

Browse files
committed
Revert "un-hardcode gcr.io repo from various scripts"
This reverts commit 6d0637e.
1 parent 6d0637e commit 9fd7042

File tree

1 file changed

+66
-61
lines changed

1 file changed

+66
-61
lines changed

buildkite/scripts/release/manager.sh

Lines changed: 66 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ DEFAULT_ARCHITECTURES="amd64"
5151
DEFAULT_PROFILE=devnet
5252

5353
DEBIAN_CACHE_FOLDER=${DEBIAN_CACHE_FOLDER:-~/.release/debian/cache}
54-
DEFAULT_DOCKER_REPO="europe-west3-docker.pkg.dev/o1labs-192920/euro-docker-repo"
54+
GCR_REPO="gcr.io/o1labs-192920"
55+
DOCKER_IO_REPO="docker.io/minaprotocol"
5556
DEBIAN_REPO=packages.o1test.net
5657

5758
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
@@ -186,6 +187,17 @@ function get_arch_suffix() {
186187
esac
187188
}
188189

190+
function get_repo() {
191+
local __publish_to_docker_io="$1"
192+
193+
if [[ $__publish_to_docker_io == 1 ]]; then
194+
echo $DOCKER_IO_REPO
195+
else
196+
echo $GCR_REPO
197+
fi
198+
199+
}
200+
189201
function get_artifact_with_suffix() {
190202
local __artifact=$1
191203
local __network="${2:-""}"
@@ -238,7 +250,7 @@ function extract_version_from_deb() {
238250

239251

240252
function calculate_docker_tag() {
241-
local __docker_repo=$1
253+
local __publish_to_docker_io=$1
242254
local __artifact=$2
243255
local __target_version=$3
244256
local __codename=$4
@@ -251,7 +263,11 @@ function calculate_docker_tag() {
251263
local __arch_suffix
252264
__arch_suffix=$(get_arch_suffix $__arch)
253265

254-
echo "$__docker_repo/$__artifact:$__target_version-$__codename$__network_suffix$__arch_suffix"
266+
if [[ $__publish_to_docker_io == 1 ]]; then
267+
echo "$DOCKER_IO_REPO/$__artifact:$__target_version-$__codename$__network_suffix$__arch_suffix"
268+
else
269+
echo "$GCR_REPO/$__artifact:$__target_version-$__codename$__network_suffix$__arch_suffix"
270+
fi
255271
}
256272

257273
function storage_list() {
@@ -482,20 +498,27 @@ function promote_and_verify_docker() {
482498
local __codename=$4
483499
local __network=$5
484500
local __profile=$6
485-
local __source_docker_repo=$7
486-
local __target_docker_repo=$8
487-
local __verify=$9
488-
local __arch=${10}
489-
local __dry_run=${11}
501+
local __publish_to_docker_io=$7
502+
local __verify=$8
503+
local __arch=$9
504+
local __dry_run=${10}
490505

491506
local __suffix
492507
__suffix=$(get_suffix $__artifact $__network $__profile)
493508

494509
local __artifact_full_source_version=$__source_version-$__codename${__suffix}
495510
local __artifact_full_target_version=$__target_version-$__codename${__suffix}
496511

512+
if [[ $__publish_to_docker_io == 1 ]]; then
513+
local __publish_arg="-p"
514+
local __repo=$DOCKER_IO_REPO
515+
else
516+
local __publish_arg=""
517+
local __repo=$GCR_REPO
518+
fi
519+
497520
echo " 🐋 Publishing $__artifact docker for '$__network' network and '$__codename' codename with '$__target_version' version and '$__arch' "
498-
echo " 📦 Target version: $(calculate_docker_tag $__target_docker_repo $__artifact $__target_version $__codename "$__network" "$__profile")"
521+
echo " 📦 Target version: $(calculate_docker_tag $__publish_to_docker_io $__artifact $__target_version $__codename $__network $__profile )"
499522
echo ""
500523
if [[ $__dry_run == 0 ]]; then
501524
prefix_cmd "$SUBCOMMAND_TAB" $SCRIPTPATH/../../../scripts/docker/promote.sh \
@@ -504,8 +527,7 @@ function promote_and_verify_docker() {
504527
-v $__artifact_full_source_version \
505528
-t $__artifact_full_target_version \
506529
-a $__arch \
507-
-r $__source_docker_repo \
508-
-p $__target_docker_repo
530+
$__publish_arg
509531

510532
echo ""
511533

@@ -519,7 +541,7 @@ function promote_and_verify_docker() {
519541
-v "$__target_version" \
520542
-c "$__codename" \
521543
-s "$__suffix" \
522-
-r "$__target_docker_repo" \
544+
-r "$__repo" \
523545
-a "$__arch"
524546

525547
echo ""
@@ -602,8 +624,7 @@ function publish_help(){
602624
printf " %-25s %s\n" "--target-version" "[path] target version of build to publish";
603625
printf " %-25s %s\n" "--codenames" "[comma separated list] list of debian codenames to publish. e.g bullseye,focal";
604626
printf " %-25s %s\n" "--channel" "[string] target debian channel";
605-
printf " %-25s %s\n" "--source-docker-repo" "[string] source docker repo. Default: $DEFAULT_DOCKER_REPO";
606-
printf " %-25s %s\n" "--target-docker-repo" "[string] target docker repo. Default: $DEFAULT_DOCKER_REPO";
627+
printf " %-25s %s\n" "--publish-to-docker-io" "[bool] publish to docker.io instead of gcr.io";
607628
printf " %-25s %s\n" "--only-dockers" "[bool] publish only docker images";
608629
printf " %-25s %s\n" "--only-debians" "[bool] publish only debian packages";
609630
printf " %-25s %s\n" "--verify" "[bool] verify packages are published correctly. WARINING: it requires docker engine to be installed";
@@ -636,8 +657,7 @@ function publish(){
636657
local __target_version
637658
local __codenames="$DEFAULT_CODENAMES"
638659
local __channel
639-
local __source_docker_repo=$DEFAULT_DOCKER_REPO
640-
local __target_docker_repo=$DEFAULT_DOCKER_REPO
660+
local __publish_to_docker_io=0
641661
local __only_dockers=0
642662
local __only_debians=0
643663
local __verify=0
@@ -684,13 +704,9 @@ function publish(){
684704
__channel=${2:?$error_message}
685705
shift 2;
686706
;;
687-
--source-docker-repo )
688-
__source_docker_repo=${2:?$error_message}
689-
shift 2;
690-
;;
691-
--target-docker-repo )
692-
__target_docker_repo=${2:?$error_message}
693-
shift 2;
707+
--publish-to-docker-io )
708+
__publish_to_docker_io=1
709+
shift 1;
694710
;;
695711
--only-dockers )
696712
__only_dockers=1
@@ -773,7 +789,7 @@ function publish(){
773789
echo " - Target version: $__target_version"
774790
echo " - Publishing codenames: $__codenames"
775791
echo " - Target channel: $__channel"
776-
echo " - Docker repository: $__source_docker_repo -> $__target_docker_repo"
792+
echo " - Publish to docker.io: $__publish_to_docker_io"
777793
echo " - Only dockers: $__only_dockers"
778794
echo " - Only debians: $__only_debians"
779795
echo " - Verify: $__verify"
@@ -874,7 +890,7 @@ function publish(){
874890
fi
875891

876892
if [[ $__only_debians == 0 ]]; then
877-
promote_and_verify_docker $artifact $__source_version $__target_version $__codename $network $__profile $__source_docker_repo $__target_docker_repo $__verify $__arch $__dry_run
893+
promote_and_verify_docker $artifact $__source_version $__target_version $__codename $network $__profile $__publish_to_docker_io $__verify $__arch $__dry_run
878894
fi
879895
done
880896
;;
@@ -898,7 +914,7 @@ function publish(){
898914
fi
899915

900916
if [[ $__only_debians == 0 ]]; then
901-
promote_and_verify_docker $artifact $__source_version $__target_version $__codename $network $__profile $__source_docker_repo $__target_docker_repo $__verify $__arch $__dry_run
917+
promote_and_verify_docker $artifact $__source_version $__target_version $__codename $network $__profile $__publish_to_docker_io $__verify $__arch $__dry_run
902918
fi
903919
done
904920
;;
@@ -922,7 +938,7 @@ function publish(){
922938
fi
923939

924940
if [[ $__only_debians == 0 ]]; then
925-
promote_and_verify_docker $artifact $__source_version $__target_version $__codename $network $__profile $__source_docker_repo $__target_docker_repo $__verify $__arch $__dry_run
941+
promote_and_verify_docker $artifact $__source_version $__target_version $__codename $network $__profile $__publish_to_docker_io $__verify $__arch $__dry_run
926942
fi
927943
done
928944
;;
@@ -952,16 +968,14 @@ function promote_help(){
952968
echo ""
953969
printf " %-25s %s\n" "-h | --help" "show help";
954970
printf " %-25s %s\n" "--arch" "[string] target architecture. Default: $DEFAULT_ARCHITECTURES";
955-
printf " %-25s %s\n" "--profile" "[string] build profile to publish. e.g lightnet, mainnet. default: $DEFAULT_PROFILE";
956971
printf " %-25s %s\n" "--artifacts" "[comma separated list] list of artifacts to publish. e.g mina-logproc,mina-archive,mina-rosetta";
957972
printf " %-25s %s\n" "--networks" "[comma separated list] list of networks to publish. e.g devnet,mainnet";
958973
printf " %-25s %s\n" "--source-version" "[path] source version of build to publish";
959974
printf " %-25s %s\n" "--target-version" "[path] target version of build to publish";
960975
printf " %-25s %s\n" "--codenames" "[comma separated list] list of debian codenames to publish. e.g bullseye,focal";
961976
printf " %-25s %s\n" "--source-channel" "[string] source debian channel";
962977
printf " %-25s %s\n" "--target-channel" "[string] target debian channel";
963-
printf " %-25s %s\n" "--source-docker-repo" "[string] source docker repo. Default: $DEFAULT_DOCKER_REPO";
964-
printf " %-25s %s\n" "--target-docker-repo" "[string] target docker repo. Default: $DEFAULT_DOCKER_REPO";
978+
printf " %-25s %s\n" "--publish-to-docker-io" "[bool] publish to docker.io instead of gcr.io";
965979
printf " %-25s %s\n" "--only-dockers" "[bool] publish only docker images";
966980
printf " %-25s %s\n" "--only-debians" "[bool] publish only debian packages";
967981
printf " %-25s %s\n" "--verify" "[bool] verify packages are published correctly. WARINING: it requires docker engine to be installed";
@@ -991,16 +1005,14 @@ function promote(){
9911005
local __strip_network_from_archive=0
9921006
local __source_channel
9931007
local __target_channel
994-
local __source_docker_repo="$DEFAULT_DOCKER_REPO"
995-
local __target_docker_repo="$DEFAULT_DOCKER_REPO"
1008+
local __publish_to_docker_io=0
9961009
local __only_dockers=0
9971010
local __only_debians=0
9981011
local __verify=0
9991012
local __dry_run=0
10001013
local __debian_repo=$DEBIAN_REPO
10011014
local __debian_sign_key=""
10021015
local __arch="$DEFAULT_ARCHITECTURES"
1003-
local __profile="$DEFAULT_PROFILE"
10041016

10051017

10061018
while [ ${#} -gt 0 ]; do
@@ -1037,13 +1049,9 @@ function promote(){
10371049
__target_channel=${2:?$error_message}
10381050
shift 2;
10391051
;;
1040-
--source-docker-repo )
1041-
__source_docker_repo=${2:?$error_message}
1042-
shift 2;
1043-
;;
1044-
--target-docker-repo )
1045-
__target_docker_repo=${2:?$error_message}
1046-
shift 2;
1052+
--publish-to-docker-io )
1053+
__publish_to_docker_io=1
1054+
shift 1;
10471055
;;
10481056
--only-dockers )
10491057
__only_dockers=1
@@ -1077,10 +1085,6 @@ function promote(){
10771085
__arch=${2:?$error_message}
10781086
shift 2;
10791087
;;
1080-
--profile )
1081-
__profile=${2:?$error_message}
1082-
shift 2;
1083-
;;
10841088
* )
10851089
echo -e "${RED} !! Unknown option: $1${CLEAR}\n";
10861090
echo "";
@@ -1128,8 +1132,7 @@ function promote(){
11281132
echo " - Target version: $__target_version"
11291133
fi
11301134
fi
1131-
echo " - Source Docker repo: $__source_docker_repo"
1132-
echo " - Target Docker repo: $__target_docker_repo"
1135+
echo " - Publish to docker.io: $__publish_to_docker_io"
11331136
echo " - Only dockers: $__only_dockers"
11341137
echo " - Only debians: $__only_debians"
11351138
echo " - Verify: $__verify"
@@ -1145,7 +1148,7 @@ function promote(){
11451148

11461149
if [[ $__source_version == "$__target_version" ]]; then
11471150
echo " ⚠️ Warning: Source version and target version are the same.
1148-
Script will do promotion but it won't have an effect at the end unless you are publishing dockers..."
1151+
Script will do promotion but it won't have an effect at the end unless you are publishing dockers from gcr.io to docker.io ..."
11491152
echo ""
11501153
fi
11511154

@@ -1199,7 +1202,7 @@ function promote(){
11991202
fi
12001203

12011204
if [[ $__only_debians == 0 ]]; then
1202-
promote_and_verify_docker $artifact $__source_version $__target_version $__codename $network $__profile $__source_docker_repo $__target_docker_repo $__verify $__arch $__dry_run
1205+
promote_and_verify_docker $artifact $__source_version $__target_version $__codename $network $__profile $__publish_to_docker_io $__verify $__arch $__dry_run
12031206
fi
12041207
done
12051208
;;
@@ -1222,7 +1225,7 @@ function promote(){
12221225
fi
12231226

12241227
if [[ $__only_debians == 0 ]]; then
1225-
promote_and_verify_docker $artifact $__source_version $__target_version $__codename $network $__profile $__source_docker_repo $__target_docker_repo $__verify $__arch $__dry_run
1228+
promote_and_verify_docker $artifact $__source_version $__target_version $__codename $network $__profile $__publish_to_docker_io $__verify $__arch $__dry_run
12261229
fi
12271230
done
12281231
;;
@@ -1244,7 +1247,7 @@ function promote(){
12441247
fi
12451248

12461249
if [[ $__only_debians == 0 ]]; then
1247-
promote_and_verify_docker $artifact $__source_version $__target_version $__codename $network $__profile $__source_docker_repo $__target_docker_repo $__verify $__arch $__dry_run
1250+
promote_and_verify_docker $artifact $__source_version $__target_version $__codename $network $__profile $__publish_to_docker_io $__verify $__arch $__dry_run
12481251
fi
12491252
done
12501253
;;
@@ -1279,7 +1282,7 @@ function verify_help(){
12791282
printf " %-25s %s\n" "--codenames" "[comma separated list] list of debian codenames to publish. e.g bullseye,focal";
12801283
printf " %-25s %s\n" "--channel" "[string] target debian channel";
12811284
printf " %-25s %s\n" "--debian-repo" "[string] debian repository. default: $DEBIAN_REPO";
1282-
printf " %-25s %s\n" "--docker-repo" "[string] docker repo. Default: $DEFAULT_DOCKER_REPO";
1285+
printf " %-25s %s\n" "--docker-io" "[bool] publish to docker.io instead of gcr.io";
12831286
printf " %-25s %s\n" "--only-dockers" "[bool] publish only docker images";
12841287
printf " %-25s %s\n" "--only-debians" "[bool] publish only debian packages";
12851288
printf " %-25s %s\n" "--arch" "[string] architecture (amd64 or arm64)";
@@ -1331,13 +1334,13 @@ function verify(){
13311334
local __version
13321335
local __codenames="$DEFAULT_CODENAMES"
13331336
local __channel="unstable"
1337+
local __docker_io=0
13341338
local __only_dockers=0
13351339
local __only_debians=0
13361340
local __debian_repo=$DEBIAN_REPO
13371341
local __debian_repo_signed=0
13381342
local __archs="$DEFAULT_ARCHITECTURES"
13391343
local __profile=$DEFAULT_PROFILE
1340-
local __docker_repo="$DEFAULT_DOCKER_REPO"
13411344
local __build_flag=""
13421345

13431346
while [ ${#} -gt 0 ]; do
@@ -1374,8 +1377,8 @@ function verify(){
13741377
__signed_debian_repo=1
13751378
shift 1;
13761379
;;
1377-
--docker-repo )
1378-
__docker_repo=${2:?$error_message}
1380+
--docker-io )
1381+
__publish_to_docker_io=1
13791382
shift 1;
13801383
;;
13811384
--only-dockers )
@@ -1412,7 +1415,7 @@ function verify(){
14121415
echo " - Networks: $__networks"
14131416
echo " - Version: $__version"
14141417
echo " - Promoting codenames: $__codenames"
1415-
echo " - Docker repo: $__docker_repo"
1418+
echo " - Published to docker.io: $__docker_io"
14161419
echo " - Debian repo: $__debian_repo"
14171420
echo " - Debian repos is signed: $__debian_repo_signed"
14181421
echo " - Channel: $__channel"
@@ -1433,6 +1436,8 @@ function verify(){
14331436
read -r -a __networks_arr <<< "$__networks"
14341437
read -r -a __codenames_arr <<< "$__codenames"
14351438
read -r -a __archs_arr <<< "$__archs"
1439+
local __repo
1440+
__repo=$(get_repo $__docker_io)
14361441

14371442
for __arch in "${__archs_arr[@]}"; do
14381443
echo " 🖥️ Verifying for architecture: $__arch"
@@ -1484,14 +1489,14 @@ function verify(){
14841489

14851490
if [[ $__only_debians == 0 ]]; then
14861491

1487-
echo " 📋 Verifying: $artifact docker on $(calculate_docker_tag "$__docker_repo" $artifact $__version $__codename "$network" "$__arch")"
1492+
echo " 📋 Verifying: $artifact docker on $(calculate_docker_tag "$__docker_io" $artifact $__version $__codename "$network" "$__arch")"
14881493

14891494
prefix_cmd "$SUBCOMMAND_TAB" $SCRIPTPATH/../../../scripts/docker/verify.sh \
14901495
-p "$artifact" \
14911496
-v $__version \
14921497
-c "$__codename" \
14931498
-s "$__docker_suffix_combined" \
1494-
-r "$__docker_repo" \
1499+
-r "$__repo" \
14951500
-a "$__arch"
14961501

14971502
echo ""
@@ -1525,15 +1530,15 @@ function verify(){
15251530

15261531
if [[ $__only_debians == 0 ]]; then
15271532

1528-
echo " 📋 Verifying: $artifact docker on $(calculate_docker_tag "$__docker_repo" $__artifact_full_name $__version $__codename $network "$__arch" )"
1533+
echo " 📋 Verifying: $artifact docker on $(calculate_docker_tag "$__docker_io" $__artifact_full_name $__version $__codename $network "$__arch" )"
15291534
echo ""
15301535

15311536
prefix_cmd "$SUBCOMMAND_TAB" $SCRIPTPATH/../../../scripts/docker/verify.sh \
15321537
-p "$artifact" \
15331538
-v $__version \
15341539
-c "$__codename" \
15351540
-s "$__docker_suffix_combined" \
1536-
-r "$__docker_repo" \
1541+
-r "$__repo" \
15371542
-a "$__arch"
15381543

15391544
echo ""
@@ -1565,14 +1570,14 @@ function verify(){
15651570
fi
15661571

15671572
if [[ $__only_debians == 0 ]]; then
1568-
echo " 📋 Verifying: $artifact docker on $(calculate_docker_tag "$__docker_repo" $__artifact_full_name $__version $__codename "$network" "$__arch" )"
1573+
echo " 📋 Verifying: $artifact docker on $(calculate_docker_tag "$__docker_io" $__artifact_full_name $__version $__codename "$network" "$__arch" )"
15691574
echo ""
15701575
prefix_cmd "$SUBCOMMAND_TAB" $SCRIPTPATH/../../../scripts/docker/verify.sh \
15711576
-p "$artifact" \
15721577
-v $__version \
15731578
-c "$__codename" \
15741579
-s "$__docker_suffix_combined" \
1575-
-r "$__docker_repo" \
1580+
-r "$__repo" \
15761581
-a "$__arch"
15771582

15781583
echo ""

0 commit comments

Comments
 (0)