@@ -22,25 +22,50 @@ export PLATFORM
22
22
export SIDECAR_TAG=" ${SIDECAR_IMAGE} :${GIT_TAG} "
23
23
export CONTROLLER_TAG=" ${CONTROLLER_IMAGE} :${GIT_TAG} "
24
24
25
- # build in parallel
26
25
make build
27
26
28
- # add latest tag to just-built images
29
- gcloud container images add-tag " ${CONTROLLER_TAG} " " ${CONTROLLER_IMAGE} :latest"
30
- gcloud container images add-tag " ${SIDECAR_TAG} " " ${SIDECAR_IMAGE} :latest"
27
+ # PULL_BASE_REF is 'main' for non-tagged commits on the main branch
28
+ if [[ " ${PULL_BASE_REF} " == main ]]; then
29
+ echo " ! ! ! this is a main branch build ! ! !"
30
+ # 'main' tag follows the main branch head
31
+ gcloud container images add-tag " ${CONTROLLER_TAG} " " ${CONTROLLER_IMAGE} :main"
32
+ gcloud container images add-tag " ${SIDECAR_TAG} " " ${SIDECAR_IMAGE} :main"
33
+ # 'latest' tag follows 'main' for easy use by developers
34
+ gcloud container images add-tag " ${CONTROLLER_TAG} " " ${CONTROLLER_IMAGE} :latest"
35
+ gcloud container images add-tag " ${SIDECAR_TAG} " " ${SIDECAR_IMAGE} :latest"
36
+ fi
37
+
38
+ # PULL_BASE_REF is 'release-*' for non-tagged commits on release branches
39
+ if [[ " ${PULL_BASE_REF} " == release-* ]]; then
40
+ echo " ! ! ! this is a ${PULL_BASE_REF} release branch build ! ! !"
41
+ # 'release-*' tags that follow each release branch head
42
+ gcloud container images add-tag " ${CONTROLLER_TAG} " " ${CONTROLLER_IMAGE} :${PULL_BASE_REF} "
43
+ gcloud container images add-tag " ${SIDECAR_TAG} " " ${SIDECAR_IMAGE} :${PULL_BASE_REF} "
44
+ fi
31
45
32
- # PULL_BASE_REF is 'controller/TAG' for a controller release
46
+ # PULL_BASE_REF is 'controller/TAG' for a tagged controller release
33
47
if [[ " ${PULL_BASE_REF} " == controller/* ]]; then
34
48
echo " ! ! ! this is a tagged controller release ! ! !"
35
49
TAG=" ${PULL_BASE_REF# controller/* } "
36
50
gcloud container images add-tag " ${CONTROLLER_TAG} " " ${CONTROLLER_IMAGE} :${TAG} "
37
51
fi
38
52
39
- # PULL_BASE_REF is 'sidecar/TAG' for a controller release
53
+ # PULL_BASE_REF is 'sidecar/TAG' for a tagged sidecar release
40
54
if [[ " ${PULL_BASE_REF} " == sidecar/* ]]; then
41
55
echo " ! ! ! this is a tagged sidecar release ! ! !"
42
56
TAG=" ${PULL_BASE_REF# sidecar/* } "
43
57
gcloud container images add-tag " ${SIDECAR_TAG} " " ${SIDECAR_IMAGE} :${TAG} "
44
58
fi
45
59
46
- # else, PULL_BASE_REF is a branch name (e.g., master, release-0.2) or a tag (e.g., client/v0.2.0, proto/v0.2.0)
60
+ # PULL_BASE_REF is 'v0.y.z*' for tagged alpha releases where controller and sidecar are released simultaneously
61
+ # hand wave over complex matching logic by just looking for 'v0.' prefix
62
+ if [[ " ${PULL_BASE_REF} " == ' v0.' * ]]; then
63
+ echo " ! ! ! this is a tagged controller + sidecar release ! ! !"
64
+ TAG=" ${PULL_BASE_REF} "
65
+ gcloud container images add-tag " ${CONTROLLER_TAG} " " ${CONTROLLER_IMAGE} :${TAG} "
66
+ gcloud container images add-tag " ${SIDECAR_TAG} " " ${SIDECAR_IMAGE} :${TAG} "
67
+ fi
68
+
69
+ # else, PULL_BASE_REF is something that doesn't release image(s) to staging, like:
70
+ # - a random branch name (e.g., feature-xyz)
71
+ # - a version tag for a subdir with no image associated (e.g., client/v0.2.0, proto/v0.2.0)
0 commit comments