Skip to content

Commit 62c70e1

Browse files
authored
Add params to publish-gen-image.sh
This change makes it convenient to publish a copy of crd-model-gen to a private container registry. Refactor client-java-contrib/publish-gen-image.sh to accept parameters via environment variables. At the same time, refactor scripts/publish-crd-model-gen-image.sh to remove duplicated logic. This also serves as an example of how to invoke publish-gen-image.sh. In case there are existing workflows that depend on these two scripts, I have not renamed either of them, and they have the same behavior when no environment variables are provided.
1 parent 9c88b12 commit 62c70e1

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#!/usr/bin/env bash
22

3-
GEN_IMAGE_NAME=docker.pkg.github.com/kubernetes-client/java/crd-model-gen
4-
GEN_IMAGE_VERSION=v2.0.0
3+
# User-overridable variables
4+
IMAGE_REPOSITORY=${IMAGE_REPOSITORY:-docker.pkg.github.com}
5+
IMAGE_NAME=${IMAGE_NAME:-kubernetes-client/java/crd-model-gen}
6+
IMAGE_VERSION=${IMAGE_VERSION:-v1.0.0}
57

6-
docker build -t ${GEN_IMAGE_NAME}:${GEN_IMAGE_VERSION} .
7-
docker push ${GEN_IMAGE_NAME}:${GEN_IMAGE_VERSION}
8+
IMAGE=${IMAGE_REPOSITORY}/${IMAGE_NAME}:${IMAGE_VERSION}
9+
BUILD_DIR="$(dirname $0)"
10+
docker build -t ${IMAGE} ${BUILD_DIR}
11+
docker push ${IMAGE}
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
#!/bin/bash
22

3-
IMAGE_REPOSITORY=docker.pkg.github.com
4-
IMAGE_NAME=kubernetes-client/java/crd-model-gen
5-
IMAGE_VERSION=v1.0.0
6-
IMAGE=${IMAGE_REPOSITORY}/${IMAGE_NAME}:${IMAGE_VERSION}
3+
export IMAGE_REPOSITORY=docker.pkg.github.com
4+
export IMAGE_NAME=kubernetes-client/java/crd-model-gen
5+
export IMAGE_VERSION=v1.0.0
76

8-
docker build -t ${IMAGE} client-java-contrib/
9-
10-
docker push ${IMAGE}
7+
bash "$(dirname $0)/../client-java-contrib/publish-gen-image.sh"

0 commit comments

Comments
 (0)