diff --git a/Makefile b/Makefile index ee3bec678..3ed5ccf66 100644 --- a/Makefile +++ b/Makefile @@ -445,6 +445,26 @@ RELEASE_ALIAS_TAG=$(PULL_BASE_REF) release-alias-tag: # Adds the tag to the last build tag. gcloud container images add-tag $(CONTROLLER_IMG):$(TAG) $(CONTROLLER_IMG):$(RELEASE_ALIAS_TAG) +.PHONY: release-staging-nightly +release-staging-nightly: + # Tags and pushes nightly container images to the staging bucket. + # Invoked via cloudbuild-nightly.yaml by image-builder launched via the configured nightly periodic job. + $(eval NEW_RELEASE_ALIAS_TAG := nightly_$(RELEASE_ALIAS_TAG)_$(shell date +'%Y%m%d')) + echo $(NEW_RELEASE_ALIAS_TAG) + $(MAKE) release-alias-tag TAG=$(RELEASE_ALIAS_TAG) RELEASE_ALIAS_TAG=$(NEW_RELEASE_ALIAS_TAG) + $(MAKE) set-manifest-image MANIFEST_IMG=$(CONTROLLER_IMG) MANIFEST_TAG=$(NEW_RELEASE_ALIAS_TAG) + $(MAKE) set-manifest-pull-policy PULL_POLICY=IfNotPresent + $(MAKE) release-manifests + $(MAKE) release-metadata + $(MAKE) release-templates + $(MAKE) upload-staging-artifacts RELEASE_ALIAS_TAG=$(NEW_RELEASE_ALIAS_TAG) + +.PHONY: upload-staging-artifacts +upload-staging-artifacts: ## Upload release artifacts to the staging bucket + # Example manifest location: https://storage.googleapis.com/k8s-staging-cluster-api-aws/components/nightly_main_20240425/infrastructure-components.yaml + # Please note that these files are deleted after a certain period, at the time of this writing 60 days after file creation. + gsutil cp $(RELEASE_DIR)/* gs://$(BUCKET)/components/$(RELEASE_ALIAS_TAG) + .PHONY: release-notes release-notes: $(RELEASE_NOTES) $(RELEASE_NOTES) diff --git a/cloudbuild-nightly.yaml b/cloudbuild-nightly.yaml new file mode 100644 index 000000000..e121f06b3 --- /dev/null +++ b/cloudbuild-nightly.yaml @@ -0,0 +1,18 @@ +# See https://cloud.google.com/cloud-build/docs/build-config +timeout: 3600s +options: + substitution_option: ALLOW_LOOSE +steps: + - name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20240210-29014a6e3a' + entrypoint: make + env: + - DOCKER_CLI_EXPERIMENTAL=enabled + - TAG=$_GIT_TAG + - PULL_BASE_REF=$_PULL_BASE_REF + args: + - release-staging-nightly +substitutions: + # _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and + # can be used as a substitution + _GIT_TAG: '12345' + _PULL_BASE_REF: 'dev' diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 09e7b7ae0..4e4436d26 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -3,7 +3,7 @@ timeout: 3600s options: substitution_option: ALLOW_LOOSE steps: - - name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20220609-2e4c91eb7e' + - name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20240210-29014a6e3a' entrypoint: make env: - DOCKER_CLI_EXPERIMENTAL=enabled