[go: nahoru, domu]

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

cloudbuild: workerpool not found #4432

Closed
alexdicianu opened this issue Jul 14, 2021 · 4 comments
Closed

cloudbuild: workerpool not found #4432

alexdicianu opened this issue Jul 14, 2021 · 4 comments
Labels
api: cloudbuild Issues related to the Cloud Build API. type: question Request for information or clarification. Not an issue.

Comments

@alexdicianu
Copy link

Client

Cloud Build

Environment

Docker, OSX, Kubernetes (all)

Go Environment

$ go version
go version go1.16.2 darwin/amd64

Code

Working example:

package main

import (
	"context"
	"fmt"

	cloudbuild "cloud.google.com/go/cloudbuild/apiv1/v2"
	"github.com/sirupsen/logrus"
	cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)

var log = logrus.WithField("component", "cloud-build-demo")

func initBuilder() (*cloudbuild.Client, error) {
	ctx := context.TODO()
	return cloudbuild.NewClient(ctx)
}

func main() {
	ctx := context.TODO()
	builder, err := initBuilder()
	if err != nil {
		log.WithError(err).Fatal("cannot instantiate builder")
	}
	cbr := &cloudbuildpb.CreateBuildRequest{
		ProjectId: "xxxxxxxxxxxxxxxxxx",
		Build: &cloudbuildpb.Build{
			Steps: []*cloudbuildpb.BuildStep{
				{
					Name:       "gcr.io/cloud-builders/curl",
					Entrypoint: "echo",
					Args:       []string{"hello", "world"},
				},
			},
			Options: &cloudbuildpb.BuildOptions{
				WorkerPool: "projects/xxxxxxxxxxxxxxxxxx/locations/us-central1/workerPools/xxxx",
			},
		},
	}
	op, err := builder.CreateBuild(ctx, cbr)
	if err != nil {
		log.WithError(err).Fatal("cannot create build")
	}
	metadata, err := op.Metadata()
	if err != nil {
		log.WithError(err).Error("cannot get metadata")
	}
	fmt.Printf("build metadata: %+v", metadata)
}

Expected behavior

The build is created and starts running.

Actual behavior

Error message received:

rpc error: code = NotFound desc = workerpool not found: \"projects/xxxxxxxxxxxxxxxxxx/locations/us-central1/workerPools/xxxx\"

Screenshots

n/a

Additional context

In trying out the new beta worker pool feature of Cloud Build, I tried creating a build targeted to run in the newly created worker pool. I am able to run that build using the gcloud builds submit command but when I try to do it programatically using the code above I'm getting the workerpool not found error. The credentials I'm using are the same in both cases.

@alexdicianu alexdicianu added the triage me I really want to be triaged. label Jul 14, 2021
@product-auto-label product-auto-label bot added the api: cloudbuild Issues related to the Cloud Build API. label Jul 14, 2021
@codyoss codyoss added type: question Request for information or clarification. Not an issue. and removed triage me I really want to be triaged. labels Jul 14, 2021
@codyoss
Copy link
Member
codyoss commented Jul 14, 2021

@alexdicianu Thanks for the detailed report. That error message makes me think something is wrong in the WorkerPool field. Are you able to list the resource to ensure you have the correct resource path?

gcloud alpha builds worker-pools list

Unfortunately I myself am not currently on the allowlist to test this feature. I would share this feedback/question with Cloud build team directly through their issue tracker.

@alexdicianu
Copy link
Author

@codyoss thanks for the quick answer. Yes, I am able to list the resource and the path is correct. I will post this question in Cloud Build's issue tracker as well but I was thinking the problem lies within the Go client somewhere since I am able to run a build in the selected worker pool using the command: gcloud builds submit

@alexdicianu
Copy link
Author

Also tracked under https://issuetracker.google.com/issues/193685195

@codyoss
Copy link
Member
codyoss commented Jul 15, 2021

Thank you! I will close this issue now then as it can be tracked on the Cloud Build issue tracker. cc'ed myself there as well.

@codyoss codyoss closed this as completed Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: cloudbuild Issues related to the Cloud Build API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

2 participants