Skip to content

Commit 6d0637e

Browse files
committed
un-hardcode gcr.io repo from various scripts
1 parent f0336e8 commit 6d0637e

File tree

13 files changed

+135
-84
lines changed

13 files changed

+135
-84
lines changed

buildkite/scripts/release/manager.sh

Lines changed: 61 additions & 66 deletions
Large diffs are not rendered by default.

buildkite/scripts/run-test-executive-local.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ fi
2525
cleanup
2626

2727
TEST_NAME="$1"
28+
DOCKER_REPO="$2"
29+
MINA_DOCKER_NAME="mina-daemon"
30+
MINA_ARCHIVE_DOCKER_NAME="mina-archive"
2831

29-
MINA_IMAGE="gcr.io/o1labs-192920/mina-daemon:$MINA_DOCKER_TAG-berkeley"
30-
ARCHIVE_IMAGE="gcr.io/o1labs-192920/mina-archive:$MINA_DOCKER_TAG-berkeley"
32+
33+
MINA_IMAGE="$DOCKER_REPO/$MINA_DOCKER_NAME:$MINA_DOCKER_TAG-berkeley"
34+
ARCHIVE_IMAGE="$DOCKER_REPO/$MINA_ARCHIVE_DOCKER_NAME:$MINA_DOCKER_TAG-berkeley"
3135

3236
if [[ "${TEST_NAME:0:15}" == "block-prod-prio" ]] && [[ "$RUN_OPT_TESTS" == "" ]]; then
3337
echo "Skipping $TEST_NAME"

buildkite/src/Command/DockerImage.dhall

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ let DockerLogin = ../Command/DockerLogin/Type.dhall
2020

2121
let DebianRepo = ../Constants/DebianRepo.dhall
2222

23+
let DockerRepo = ../Constants/DockerRepo.dhall
24+
2325
let DebianVersions = ../Constants/DebianVersions.dhall
2426

2527
let Network = ../Constants/Network.dhall
@@ -51,6 +53,7 @@ let ReleaseSpec =
5153
, build_flags : BuildFlags.Type
5254
, step_key_suffix : Text
5355
, docker_publish : DockerPublish.Type
56+
, docker_repo : DockerRepo.Type
5457
, verify : Bool
5558
, if_ : Optional B/If
5659
}
@@ -72,6 +75,7 @@ let ReleaseSpec =
7275
, docker_publish = DockerPublish.Type.Essential
7376
, no_cache = False
7477
, no_debian = False
78+
, docker_repo = DockerRepo.Type.Internal
7579
, step_key_suffix = "-docker-image"
7680
, verify = False
7781
, deb_suffix = None Text
@@ -166,6 +170,7 @@ let generateStep =
166170
++ debSuffix
167171
++ " --repo ${spec.repo}"
168172
++ " --platform ${Arch.platform spec.arch}"
173+
++ " --docker-registry ${DockerRepo.show spec.docker_repo}"
169174

170175
let releaseDockerCmd =
171176
if DockerPublish.shouldPublish
@@ -184,6 +189,8 @@ let generateStep =
184189
++ " --deb-build-flags ${BuildFlags.lowerName
185190
spec.build_flags}"
186191
++ " --platform ${Arch.platform spec.arch}"
192+
++ " --docker-registry ${DockerRepo.show
193+
spec.docker_repo}"
187194

188195
else " echo In order to ensure storage optimization, skipping publishing docker as this is not essential one or publishing is disabled . Docker publish setting is set to ${DockerPublish.show
189196
spec.docker_publish}."

buildkite/src/Command/Packages/Publish.dhall

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ let DebianVersions = ../../Constants/DebianVersions.dhall
2626

2727
let DebianRepo = ../../Constants/DebianRepo.dhall
2828

29+
let DockerRepo = ../../Constants/DockerRepo.dhall
30+
2931
let ContainerImages = ../../Constants/ContainerImages.dhall
3032

3133
let Command = ../Base.dhall
@@ -72,6 +74,7 @@ let Spec =
7274
, depends_on : List Command.TaggedKey.Type
7375
, branch : Text
7476
, architectures : List Architecture.Type
77+
, docker_repo : DockerRepo.Type
7578
, if_ : Optional Text
7679
}
7780
, default =
@@ -89,6 +92,7 @@ let Spec =
8992
, verify = True
9093
, branch = ""
9194
, architectures = [ Architecture.Type.Amd64, Architecture.Type.Arm64 ]
95+
, docker_repo = DockerRepo.Type.Internal
9296
, if_ = None Text
9397
}
9498
}
@@ -251,6 +255,8 @@ let publish
251255
++ "--target-version ${r.value} "
252256
++ "--codenames ${codenames} "
253257
++ "--only-dockers "
258+
++ "--docker-repo ${DockerRepo.show
259+
spec.docker_repo} "
254260
++ "--force-upload-debians "
255261
)
256262
]

buildkite/src/Command/Rosetta/Connectivity.dhall

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ let Dockers = ../../Constants/DockerVersions.dhall
2424

2525
let Profiles = ../../Constants/Profiles.dhall
2626

27+
let DockerRepo = ../../Constants/DockerRepo.dhall
28+
2729
let B/SoftFail = B.definitions/commandStep/properties/soft_fail/Type
2830

2931
let B/If = B.definitions/commandStep/properties/if/Type
@@ -37,6 +39,7 @@ let Spec =
3739
, timeout : Natural
3840
, profile : Profiles.Type
3941
, scope : List PipelineScope.Type
42+
, repo : DockerRepo.Type
4043
, if_ : B/If
4144
}
4245
, default =
@@ -47,6 +50,7 @@ let Spec =
4750
, timeout = 1000
4851
, profile = Profiles.Type.Devnet
4952
, scope = PipelineScope.Full
53+
, repo = DockerRepo.Type.Internal
5054
, if_ =
5155
"build.pull_request.base_branch != \"develop\" && build.branch != \"develop\""
5256
}
@@ -64,7 +68,8 @@ let command
6468
, "source ./buildkite/scripts/export-git-env-vars.sh"
6569
, "scripts/tests/rosetta-connectivity.sh --network ${Network.lowerName
6670
spec.network} --tag \\\${MINA_DOCKER_TAG} --timeout ${Natural/show
67-
spec.timeout} --run-compatibility-test develop --run-load-test "
71+
spec.timeout} --repo ${DockerRepo.show
72+
spec.repo} --run-compatibility-test develop --run-load-test "
6873
]
6974
]
7075
, label =

buildkite/src/Command/TestExecutive.dhall

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ let Size = ./Size.dhall
44

55
let Cmd = ../Lib/Cmds.dhall
66

7+
let DockerRepo = ../Constants/DockerRepo.dhall
8+
79
let SelectFiles = ../Lib/SelectFiles.dhall
810

911
in { executeLocal =
@@ -13,7 +15,8 @@ in { executeLocal =
1315
Command.Config::{
1416
, commands =
1517
[ Cmd.run
16-
"MINA_DEB_CODENAME=bullseye ; source ./buildkite/scripts/export-git-env-vars.sh && ./buildkite/scripts/run-test-executive-local.sh ${testName}"
18+
"MINA_DEB_CODENAME=bullseye ; source ./buildkite/scripts/export-git-env-vars.sh && ./buildkite/scripts/run-test-executive-local.sh ${testName} ${DockerRepo.show
19+
DockerRepo.Type.Internal}"
1720
]
1821
, artifact_paths =
1922
[ SelectFiles.exactly "." "${testName}.local.test.log" ]

dockerfiles/Dockerfile-mina-daemon-hardfork

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARG deb_version=latest
22
ARG deb_codename=bullseye
33
ARG network=mainnet
4-
ARG docker_repo="gcr.io/o1labs-192920"
4+
ARG docker_repo
55
ARG deb_release=unstable
66
ARG deb_legacy_version
77
ARG deb_repo="http://packages.o1test.net"

scripts/docker/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ while [[ "$#" -gt 0 ]]; do case $1 in
4747
-c|--cache-from) INPUT_CACHE="$2"; shift;;
4848
-r|--repo) MINA_REPO="$2"; shift;;
4949
-p|--platform) INPUT_PLATFORM="$2"; shift;;
50+
--docker-registry) export DOCKER_REGISTRY="$2"; shift;;
5051
--no-cache) NO_CACHE="--no-cache"; ;;
5152
--deb-codename) INPUT_CODENAME="$2"; shift;;
5253
--deb-release) INPUT_RELEASE="$2"; shift;;

scripts/docker/helper.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,18 @@ function get_platform_suffix() {
8989
esac
9090
}
9191

92+
function check_docker_registry() {
93+
if [[ -z "${DOCKER_REGISTRY:-}" ]]; then
94+
echo "ERROR: DOCKER_REGISTRY environment variable is not set" >&2
95+
exit 1
96+
fi
97+
}
9298

9399
function export_docker_tag() {
94100
export_suffixes
95-
96-
export DOCKER_REGISTRY="gcr.io/o1labs-192920"
101+
102+
check_docker_registry
103+
export DOCKER_REGISTRY="${DOCKER_REGISTRY}"
97104

98105
PLATFORM_SUFFIX="$(get_platform_suffix)"
99106
export TAG="${DOCKER_REGISTRY}/${SERVICE}:${VERSION}${BUILD_FLAG_SUFFIX}${PLATFORM_SUFFIX}"

scripts/docker/promote.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ set -eo pipefail
44

55
CLEAR='\033[0m'
66
RED='\033[0;31m'
7-
PUBLISH=0
8-
GCR_REPO=gcr.io/o1labs-192920
7+
REGISTRY=""
98
QUIET=""
109
ARCH=amd64
1110
while [[ "$#" -gt 0 ]]; do case $1 in
1211
-n|--name) NAME="$2"; shift;;
1312
-v|--version) VERSION="$2"; shift;;
1413
-t|--tag) TAG="$2"; shift;;
15-
-p|--publish) PUBLISH=1; ;;
14+
-r|--registry) REGISTRY="$2"; shift;;
15+
-p|--publish_registry) TARGET_REPO="$2"; shift;;
1616
-q|--quiet) QUIET="-q"; ;;
1717
-a|--arch) ARCH="$2"; shift;;
1818
*) echo "Unknown parameter passed: $1"; exit 1;;
@@ -26,9 +26,10 @@ function usage() {
2626
echo " -n, --name The Docker name (mina-devnet, mina-archive etc.)"
2727
echo " -v, --version The Docker version"
2828
echo " -t, --tag The Additional tag"
29-
echo " -p, --publish The Publish to docker.io flag. If defined script will publish docker do docker.io. Otherwise it will still resides in gcr.io"
29+
echo " -p, --publish The Publish to docker.io flag. If defined script will publish docker do docker.io. Otherwise it will still resides in source registry"
3030
echo " -q, --quiet The Quiet mode. If defined script will output limited logs"
3131
echo " -a, --arch The Architecture of docker (amd64, arm64)"
32+
echo " -r, --registry The Docker registry (e.g. gcr.io/o1labs-192920)"
3233
echo ""
3334
echo "Example: $0 --name mina-archive --version 2.0.0-rc1-48efea4 --tag devnet-latest-nightly-bullseye "
3435
exit 1
@@ -37,6 +38,7 @@ function usage() {
3738
if [[ -z "$NAME" ]]; then usage "Name is not set!"; fi;
3839
if [[ -z "$VERSION" ]]; then usage "Version is not set!"; fi;
3940
if [[ -z "$TAG" ]]; then usage "Tag is not set!"; fi;
41+
if [[ -z "$REGISTRY" ]]; then usage "Registry is not set!"; fi;
4042

4143
# Sanitize the tag to ensure it is compliant with Docker tag format
4244
TAG=$(echo "$TAG" | sed 's/[^a-zA-Z0-9_.-]/-/g')
@@ -47,16 +49,14 @@ case $ARCH in
4749
*) echo "❌ Unknown architecture passed: $ARCH"; exit 1 ;;
4850
esac
4951

50-
SOURCE_TAG="${GCR_REPO}/${NAME}:${VERSION}${DOCKER_ARCH_SUFFIX}"
52+
SOURCE_TAG="${REGISTRY}/${NAME}:${VERSION}${DOCKER_ARCH_SUFFIX}"
5153

5254
echo "📎 Adding new tag ($TAG) for docker ${SOURCE_TAG}"
5355
echo " 📥 pulling ${SOURCE_TAG}"
5456
docker pull $QUIET ${SOURCE_TAG}
5557

56-
if [[ $PUBLISH == 1 ]]; then
57-
TARGET_REPO=docker.io/minaprotocol
58-
else
59-
TARGET_REPO=$GCR_REPO
58+
if [[ -z "$TARGET_REPO" ]]; then
59+
TARGET_REPO=$REGISTRY
6060
fi
6161

6262
TARGET_TAG="${TARGET_REPO}/${NAME}:${TAG}${DOCKER_ARCH_SUFFIX}"

0 commit comments

Comments
 (0)