Skip to content

Commit 1d8b0b8

Browse files
authored
Merge pull request #1215 from damdo/add-cloudbuild-nightly
Add cloudbuild-nightly.yaml + release-staging-nightly target
2 parents 1a67ef3 + 4be91b5 commit 1d8b0b8

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,26 @@ RELEASE_ALIAS_TAG=$(PULL_BASE_REF)
445445
release-alias-tag: # Adds the tag to the last build tag.
446446
gcloud container images add-tag $(CONTROLLER_IMG):$(TAG) $(CONTROLLER_IMG):$(RELEASE_ALIAS_TAG)
447447

448+
.PHONY: release-staging-nightly
449+
release-staging-nightly:
450+
# Tags and pushes nightly container images to the staging bucket.
451+
# Invoked via cloudbuild-nightly.yaml by image-builder launched via the configured nightly periodic job.
452+
$(eval NEW_RELEASE_ALIAS_TAG := nightly_$(RELEASE_ALIAS_TAG)_$(shell date +'%Y%m%d'))
453+
echo $(NEW_RELEASE_ALIAS_TAG)
454+
$(MAKE) release-alias-tag TAG=$(RELEASE_ALIAS_TAG) RELEASE_ALIAS_TAG=$(NEW_RELEASE_ALIAS_TAG)
455+
$(MAKE) set-manifest-image MANIFEST_IMG=$(CONTROLLER_IMG) MANIFEST_TAG=$(NEW_RELEASE_ALIAS_TAG)
456+
$(MAKE) set-manifest-pull-policy PULL_POLICY=IfNotPresent
457+
$(MAKE) release-manifests
458+
$(MAKE) release-metadata
459+
$(MAKE) release-templates
460+
$(MAKE) upload-staging-artifacts RELEASE_ALIAS_TAG=$(NEW_RELEASE_ALIAS_TAG)
461+
462+
.PHONY: upload-staging-artifacts
463+
upload-staging-artifacts: ## Upload release artifacts to the staging bucket
464+
# Example manifest location: https://storage.googleapis.com/k8s-staging-cluster-api-aws/components/nightly_main_20240425/infrastructure-components.yaml
465+
# Please note that these files are deleted after a certain period, at the time of this writing 60 days after file creation.
466+
gsutil cp $(RELEASE_DIR)/* gs://$(BUCKET)/components/$(RELEASE_ALIAS_TAG)
467+
448468
.PHONY: release-notes
449469
release-notes: $(RELEASE_NOTES)
450470
$(RELEASE_NOTES)

cloudbuild-nightly.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# See https://cloud.google.com/cloud-build/docs/build-config
2+
timeout: 3600s
3+
options:
4+
substitution_option: ALLOW_LOOSE
5+
steps:
6+
- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20240210-29014a6e3a'
7+
entrypoint: make
8+
env:
9+
- DOCKER_CLI_EXPERIMENTAL=enabled
10+
- TAG=$_GIT_TAG
11+
- PULL_BASE_REF=$_PULL_BASE_REF
12+
args:
13+
- release-staging-nightly
14+
substitutions:
15+
# _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and
16+
# can be used as a substitution
17+
_GIT_TAG: '12345'
18+
_PULL_BASE_REF: 'dev'

cloudbuild.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ timeout: 3600s
33
options:
44
substitution_option: ALLOW_LOOSE
55
steps:
6-
- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20220609-2e4c91eb7e'
6+
- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20240210-29014a6e3a'
77
entrypoint: make
88
env:
99
- DOCKER_CLI_EXPERIMENTAL=enabled

0 commit comments

Comments
 (0)