Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

invalid image name in cloud build when using domain-scoped project

I'm trying to build a container with GCP's Cloud Build. I'm using the simple template from the quickstart doc. I've done this before successfully.

However, this time I am using a project which is under an "organization". So the project ID is mycompany.com:projectX, rather than simply projectX.

I am unable to get the build to complete.

When I run:

gcloud builds submit --tag gcr.io/mycompany.com:project-id/helloworld

I get the following error:

(gcloud.builds.submit) INVALID_ARGUMENT: invalid build: invalid image name "gcr.io/mycompany.com:projectX/helloworld" 

I suspect that since the --tag flag calls docker build -t $TAG . under the hood and docker image names use : to specify versions, this format may be invalid.

Any ideas what I am supposed to do when working with organization projects? I cannot find relevant info in the Cloud Build or GCP IAM docs.

Some things I've tried:

  • using a cloudbuild.yaml config file with a $PROJECT_ID substitution to ensure I have the correct format
  • using the project number instead of the project ID (Using the project number in the image path is not supported. Project ID must be used instead)
  • omitting the organization name altogether, which is denied with Token exchange failed for project
  • checking my permissions - I have Cloud Build Editor and Cloud Run Invoker roles, where the former specifies that I can "create and cancel builds"
like image 839
David Scales Avatar asked Sep 22 '19 00:09

David Scales


1 Answers

You need to replace the ":" with a "/"

gcloud builds submit --tag gcr.io/mycompany.com/project-id/helloworld

More info can be found here: https://cloud.google.com/container-registry/docs/overview#domain-scoped_projects

like image 87
James Avatar answered Nov 10 '22 01:11

James