deploy: add daily schedule for gotip playground
Create a scheduled trigger to deploy the gotip playground every
America/New_York morning. I attempted to create and manage the trigger
with gcloud alpha builds triggers create scheduled, however I had to create the
schedule portion manually in the web interface.
There's probably a way to manage it with configuration in the CLI, but I
added documentation to the Makefile on how to update it manually in the
meantime.
Create command:
gcloud alpha builds triggers create scheduled --project=golang-org \
--schedule="15 11 * * *" \
--time-zone="America/New_York" \
--build-config=deploy/deploy_gotip.json \
--repo-type="CLOUD_SOURCE_REPOSITORIES" \
--revision="refs/heads/master" \
--repo-uri="https://source.developers.google.com/p/golang-org/r/playground" \
--name "playground-deploy-gotip-playground" \
--description="Deploy gotip playground daily"
For golang/go#48517
Change-Id: I9d58e5a81ae4d590e6492c07cc71806864838c81
Reviewed-on: https://go-review.googlesource.com/c/playground/+/366634
Trust: Alexander Rakoczy <alex@golang.org>
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
diff --git a/Makefile b/Makefile
index 4dedfd6..e9700f2 100644
--- a/Makefile
+++ b/Makefile
@@ -23,10 +23,23 @@
# directory)
test: test_go
+define GOTIP_MESSAGE
+Note: deploy/gotip_schedule.yaml must be manually managed with gcloud.
+Example:
+ gcloud scheduler jobs update http \
+ projects/golang-org/locations/us-central1/jobs/playground-deploy-gotip-playground-schedule \
+ --schedule="0 10 * * *" --time-zone="America/New_York"
+endef
+export GOTIP_MESSAGE
+
push-cloudbuild-triggers:
gcloud beta builds triggers import --project golang-org --source deploy/go_trigger.yaml
gcloud beta builds triggers import --project golang-org --source deploy/playground_trigger.yaml
+ gcloud alpha builds triggers import --project golang-org --source deploy/gotip_scheduled_trigger.yaml
+ @echo "$$GOTIP_MESSAGE"
pull-cloudbuild-triggers:
gcloud beta builds triggers export --project golang-org playground-redeploy-go-release --destination deploy/go_trigger.yaml
gcloud beta builds triggers export --project golang-org playground-redeploy-playground --destination deploy/playground_trigger.yaml
+ gcloud alpha builds triggers export --project golang-org playground-deploy-gotip-playground --destination deploy/gotip_scheduled_trigger.yaml
+ gcloud scheduler --project=golang-org jobs describe --format=yaml playground-deploy-gotip-playground-schedule > deploy/gotip_schedule.yaml
diff --git a/deploy/gotip_schedule.yaml b/deploy/gotip_schedule.yaml
new file mode 100644
index 0000000..27eeddd
--- /dev/null
+++ b/deploy/gotip_schedule.yaml
@@ -0,0 +1,19 @@
+attemptDeadline: 180s
+description: Deploy gotip playground daily
+httpTarget:
+ body: eyJicmFuY2hOYW1lIjoibWFzdGVyIn0=
+ headers:
+ Content-Type: application/octet-stream
+ User-Agent: Google-Cloud-Scheduler
+ httpMethod: POST
+ oauthToken:
+ scope: https://www.googleapis.com/auth/cloud-platform
+ serviceAccountEmail: cloud-build-trigger-scheduler@golang-org.iam.gserviceaccount.com
+ uri: https://cloudbuild.googleapis.com/v1/projects/golang-org/triggers/b30b6980-4b88-4c10-91d4-5705c793fa1b:run
+lastAttemptTime: '2021-11-23T16:22:00.122806Z'
+name: projects/golang-org/locations/us-central1/jobs/playground-deploy-gotip-playground-schedule
+schedule: 0 10 * * *
+scheduleTime: '2021-11-24T15:00:00Z'
+state: ENABLED
+timeZone: America/New_York
+userUpdateTime: '2021-11-23T16:27:07Z'
diff --git a/deploy/gotip_scheduled_trigger.yaml b/deploy/gotip_scheduled_trigger.yaml
new file mode 100644
index 0000000..748e40d
--- /dev/null
+++ b/deploy/gotip_scheduled_trigger.yaml
@@ -0,0 +1,13 @@
+createTime: '2021-11-23T16:11:02.136351538Z'
+description: Deploy gotip playground daily
+gitFileSource:
+ path: deploy/deploy_gotip.json
+ repoType: CLOUD_SOURCE_REPOSITORIES
+ revision: refs/heads/master
+ uri: https://source.developers.google.com/p/golang-org/r/playground
+id: b30b6980-4b88-4c10-91d4-5705c793fa1b
+name: playground-deploy-gotip-playground
+sourceToBuild:
+ ref: refs/heads/master
+ repoType: CLOUD_SOURCE_REPOSITORIES
+ uri: https://source.developers.google.com/p/golang-org/r/playground