Skip to content

Commit ab81780

Browse files
committed
Cloudbuild: let us not override 1.1.0-gcm.1 and 1.1 over and over
Signed-off-by: Maël Valais <[email protected]>
1 parent 8e380f8 commit ab81780

File tree

2 files changed

+34
-13
lines changed

2 files changed

+34
-13
lines changed

cloudbuild.yaml

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ substitutions:
2424
# for the "hardcoded" word in the below steps.
2525
_CLUSTER_NAME: smoke-test
2626
_CLUSTER_LOCATION: europe-west2-b
27+
_APP_VERSION: "0.1.0-build"
28+
_APP_MINOR_VERSION: "0.1"
2729
steps:
2830
- id: build-smoke-test
2931
name: gcr.io/cloud-builders/docker
@@ -32,15 +34,15 @@ steps:
3234
- -f
3335
- "smoke-test.Dockerfile"
3436
- --tag
35-
- gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/smoke-test:build-$BUILD_ID
37+
- gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/smoke-test:${_APP_VERSION}
3638
- "."
3739
waitFor: ["-"]
3840

3941
- id: push-smoke-test
4042
name: gcr.io/cloud-builders/docker
4143
args:
4244
- push
43-
- gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/smoke-test:build-$BUILD_ID
45+
- gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/smoke-test:${_APP_VERSION}
4446
waitFor:
4547
- build-smoke-test
4648

@@ -56,7 +58,7 @@ steps:
5658
- -exc
5759
- |
5860
cat data-test/schema.yaml \
59-
| IMAGE=gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/smoke-test:build-$BUILD_ID envsubst \
61+
| IMAGE=gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/smoke-test:build-${nvsubst \
6062
| tee /dev/stderr > /tmp/schema.yaml && mv /tmp/schema.yaml data-test/schema.yaml
6163
waitFor:
6264
- "-"
@@ -66,20 +68,38 @@ steps:
6668
args:
6769
- build
6870
- --tag
69-
- gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/deployer:build-$BUILD_ID
71+
- gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/deployer:${_APP_VERSION}
7072
- "."
7173
waitFor: ["set-data-test-schema-default-values"]
7274

75+
- id: retag-deployer
76+
name: gcr.io/cloud-builders/docker
77+
args:
78+
- tag
79+
- gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/deployer:${_APP_VERSION}
80+
- gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/deployer:${_APP_MINOR_VERSION}
81+
waitFor: ["set-data-test-schema-default-values"]
82+
7383
- id: push-deployer
7484
name: gcr.io/cloud-builders/docker
7585
args:
7686
- push
77-
- gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/deployer:build-$BUILD_ID
87+
- gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/deployer:${_APP_VERSION}
7888
waitFor:
7989
- build-deployer
8090

81-
# The tag deployer:1.1 (for example) is the actual "important" image
82-
# since it is the one that will be used in the Marketplace UI.
91+
# Althouth the application version is, for example, "1.1.0-gcm.1", we
92+
# still push a "minor version" tag "1.1". This "minor version" tag is the
93+
# actual important image since it is the one that will be used in the
94+
# Marketplace UI.
95+
- id: push-retagged-deployer
96+
name: gcr.io/cloud-builders/docker
97+
args:
98+
- push
99+
- gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/deployer:${_APP_VERSION}
100+
waitFor:
101+
- retag-deployer
102+
83103
#
84104
# We do not retag and push the deployer:1.1 as part of this cloudbuild
85105
# since this cloudbuild is meant for building the
@@ -196,7 +216,7 @@ steps:
196216
- ./mpdev
197217
- verify
198218
- --wait_timeout=99999999
199-
- --deployer=gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/deployer:build-$BUILD_ID
219+
- --deployer=gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/deployer:${_APP_VERSION}
200220
waitFor:
201221
- check-cloud-marketplace-tools
202222
- push-deployer
@@ -212,10 +232,11 @@ steps:
212232
- ./mpdev
213233
- publish
214234
- --gcs_repo=gs://$PROJECT_ID
215-
- --deployer_image=gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/deployer:build-$BUILD_ID
235+
- --deployer_image=gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/deployer:${_APP_VERSION}
216236
waitFor:
217237
- verify
218238

219239
images:
220-
- gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/deployer:build-$BUILD_ID
221-
- gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/smoke-test:build-$BUILD_ID
240+
- gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/deployer:${_APP_VERSION}
241+
- gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/deployer:${_APP_MINOR_VERSION}
242+
- gcr.io/$PROJECT_ID/jetstack-secure-for-cert-manager/smoke-test:${_APP_VERSION}

docs/TESTING-DEPLOYER.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ using the version set in `_APP_VERSION`, e.g., `1.1.0-gcm.1`.
136136

137137
```sh
138138
gcloud builds submit --project jetstack-public --timeout 1800s --config cloudbuild.yaml \
139-
--substitutions _CLUSTER_NAME=smoke-test,_CLUSTER_LOCATION=europe-west2-b
139+
--substitutions _CLUSTER_NAME=smoke-test,_CLUSTER_LOCATION=europe-west2-b,_APP_MINOR_VERSION=1.1,_APP_VERSION=1.1.0-gcm.1
140140
```
141141

142-
Three images are pushed to the "staging" registry
142+
Three images are pushed to the "staging" registry:
143143

144144
```sh
145145
gcr.io/jetstack-public/jetstack-secure-for-cert-manager/deployer:1.1

0 commit comments

Comments
 (0)