Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Cloud Scheduler builds to use PubSub not HTTP #148

Open
MarkEdmondson1234 opened this issue Nov 25, 2021 · 6 comments
Open

Move Cloud Scheduler builds to use PubSub not HTTP #148

MarkEdmondson1234 opened this issue Nov 25, 2021 · 6 comments
Labels
enhancement New feature or request
Milestone

Comments

@MarkEdmondson1234
Copy link
Owner

MarkEdmondson1234 commented Nov 25, 2021

More reliable, better utility since you can have other subscriptions attached to the topic the scheduler hits, and less mucking around with authentication for the Cloud Scheduler (big plus)

#140

@MarkEdmondson1234 MarkEdmondson1234 added the enhancement New feature or request label Nov 25, 2021
@MarkEdmondson1234
Copy link
Owner Author

MarkEdmondson1234 commented Nov 25, 2021

Workflow will need to create the Cloud Build first, rather than having it in the API call directly so still a use case for the former I guess. But a deploy function would do following:

# create build object
cloudbuild <- system.file("cloudbuild/cloudbuild.yaml",
                           package = "googleCloudRunner")
the_build <- cr_build_make(cloudbuild)

# create pub/sub topic
library(googlePubsubR)
pubsub_auth()
topics_create("test-topic")

# create build trigger that will work from pub/subscription
pubsub_trigger <- cr_buildtrigger_pubsub("test-topic")
cr_buildtrigger(the_build, name = "pubsub-triggered", trigger = pubsub_trigger)

# create scheduler that calls the pub/sub topic
cr_schedule("cloud-build-pubsub", "15 5 * * *",
                      pubsubTarget = cr_build_schedule_pubsub("test-topic"))

@MarkEdmondson1234

This comment has been minimized.

@MarkEdmondson1234

This comment has been minimized.

@MarkEdmondson1234
Copy link
Owner Author

It all works ok now in new GCP project

@MarkEdmondson1234
Copy link
Owner Author

Turning the Cloud Build API off and on again on old projects looks to fix not being able to use PubSub triggers issue.

@MarkEdmondson1234 MarkEdmondson1234 added this to the CRAN 0.5.0 milestone Dec 3, 2021
@MarkEdmondson1234
Copy link
Owner Author

MarkEdmondson1234 commented Jan 20, 2022

For PubSub triggers I need to add the new property sourceToBuild otherwise there is nothing to build :)

https://cloud.google.com/build/docs/api/reference/rest/v1/projects.locations.triggers#gitreposource

MarkEdmondson1234 added a commit that referenced this issue Jan 20, 2022
MarkEdmondson1234 added a commit that referenced this issue Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant