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

GCB builder incorrectly assumes GCP project from supplied WorkerPool property for Cloud Build execution #9730

Closed
bogdannazarenko opened this issue Feb 21, 2025 · 0 comments · Fixed by #9725

Comments

@bogdannazarenko
Copy link
Contributor

bogdannazarenko commented Feb 21, 2025

Bug:
Given the following GoogleCloudBuild configuration:

- name: cloud-build
    build:
      googleCloudBuild:
        projectId: projectA
        region: us-east1
        workerPool: projects/projectB/locations/us-central1/workerPools/my-private-pool
        serviceAccount: projects/projectA/serviceAccounts/my-service-account@projectA.iam.gserviceaccount.com

current region definition:

configures the region to run the build. If WorkerPool is configured, the region will be deduced from the WorkerPool configuration. If neither WorkerPool nor Region is configured, the build will be run in global(non-regional). See Cloud Build locations.

When WorkerPool property is supplied to GoogleCloudBuild configuration, gcb Builder incorrectly assumes the destination project for Cloud Build is project from WorkerPool string. The gcb Builder needs to create build in projectA but it erroneously fetches the location as projects/projectB/locations/us-east1 and tries to create a build in projectB.

This is not how Cloud Build Worker Pool configuration is suppose to work. The Cloud Build execution should be in projectA which is then using a shared/private Cloud Build Private Pool from a different project (projectB). Common pattern in enterprise environments.

Solution:
Update code that fetches location from WorkerPool string to use supplied projectID instead of assuming project from WorkerPool string.

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

Successfully merging a pull request may close this issue.

1 participant