Skip to content

Commit cba227b

Browse files
authored
Merge pull request #614 from justinsb/tag_prefix_builds
push-images now honors component names in tags
2 parents 3eb1ca6 + 832bcda commit cba227b

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

tools/push-images

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,24 @@ export KO_DOCKER_REPO="${IMAGE_REPO}"
3131
if [[ -z "${IMAGE_TAG:-}" ]]; then
3232
IMAGE_TAG=$(git rev-parse --short HEAD)-$(date +%Y%m%dT%H%M%S)
3333
fi
34-
echo "IMAGE_TAG=${IMAGE_TAG}"
3534

36-
go run github.com/google/[email protected] build --tags=${IMAGE_TAG} --base-import-paths --push=true ./cmd/cloud-controller-manager/
37-
go run github.com/google/[email protected] build --tags=${IMAGE_TAG} --base-import-paths --push=true ./cmd/gcp-controller-manager/
35+
if [[ "$IMAGE_TAG" == *"/"* ]]; then
36+
COMPONENT=$(dirname "${IMAGE_TAG}")
37+
IMAGE_TAG=$(basename "${IMAGE_TAG}")
38+
echo "COMPONENT=${COMPONENT}, IMAGE_TAG=${IMAGE_TAG}"
39+
else
40+
COMPONENT=""
41+
echo "IMAGE_TAG=${IMAGE_TAG}"
42+
fi
43+
44+
if [[ "${COMPONENT:-ccm}" == "ccm" ]]; then
45+
go run github.com/google/[email protected] build --tags=${IMAGE_TAG} --base-import-paths --push=true ./cmd/cloud-controller-manager/
46+
else
47+
echo "Skipping CCM build, because component is ${COMPONENT}"
48+
fi
49+
50+
if [[ "${COMPONENT:-gcm}" == "gcm" ]]; then
51+
go run github.com/google/[email protected] build --tags=${IMAGE_TAG} --base-import-paths --push=true ./cmd/gcp-controller-manager/
52+
else
53+
echo "Skipping GCM build, because component is ${COMPONENT}"
54+
fi

0 commit comments

Comments
 (0)