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

Submit Build to Private Worker Pool #210

Open
joranE opened this issue Nov 28, 2023 · 5 comments
Open

Submit Build to Private Worker Pool #210

joranE opened this issue Nov 28, 2023 · 5 comments

Comments

@joranE
Copy link

joranE commented Nov 28, 2023

I apologize for asking here, but I've simply hit a wall trying to figure this out from Google's documentation.

I'm trying to submit a build using googleCloudRunner to a private worker pool. I'm doing this by passing the argument:

options = list("pool" = list("name" = "projects/{projectid}/locations/{region}/workerPools/{worker pool name}")))

to cr_build. I've checked an double checked that the service account submitting the build has the WorkerPool User role. But I just get a 404 workerpool not found error every time.

I feel like I've done all the steps in the Google documentation, but clearly I'm missing something. Again, I realize this isn't a problem with your package, I just feel out of other options at this point.

@joranE
Copy link
Author

joranE commented Nov 28, 2023

I figured it out, and it turns out I actually did ask in the right place, sort of. It turns out the cr_build() is submitting the request to an API endpoint that is incompatible with private worker pools. The breadcrumb I found eventually is a comment at the bottom here.

Instead of passing the request to this endpoint:

https://cloudbuild.googleapis.com/v1/projects/{projectId}/builds

...you have to pass it to this one:

https://cloudbuild.googleapis.com/v1/{parent=projects/*/locations/*}/builds

...and specify a location that matches the location of your private worker pool. I can trick cr_build() into using this second endpoint by passing projectId = "{projectId}/locations/{location}"

I am SO happy I figured this out. I'd be happy to work on a pull request to adjust cr_build() to accommodate private worker pools more transparently. It might take some alteration to the function signature, so if you have strong opinions on how to approach it I'll abide by whatever you suggest.

@MarkEdmondson1234
Copy link
Owner

I'm sorry I've not done this myself before so can't say for sure. The options looks correct - have you need to precreate a worker node pool for the jobs perhaps? (Kubernetes cluster I guess, but a managed one)

@MarkEdmondson1234
Copy link
Owner

Ah you figured it out, great :) yes a pull request would be much appreciated.

@joranE
Copy link
Author

joranE commented Nov 28, 2023

I'll explore possible changes, but looking at it with fresh eyes today, I think making the entire package work with builds on private worker pools might involve deeper changes than I originally thought. That base API endpoint URL is baked into functions all over the place. For instance, I had to go through quite a few more contortions to get cr_schedule_http() to utilize the right API endpoint to schedule a build that was built on a private worker pool. I'll think about it and see if I can come up with something relatively clean.

@MarkEdmondson1234
Copy link
Owner

A function to make the URL then find/replace the hardcoded strings maybe. I had a similar pattern for using beta versions of the API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants