1

I have an instance in Google Cloud Memorystore. I want to connect to it from builds that I run in Google Cloud Build.

I created the following configuration file for Cloud Build:

steps: - name: 'gcr.io/cloud-builders/docker' args: - run - redis - redis-cli - -h - 10.1.2.3 - PUBLISH - cloud-build-1 - msg1 

(I've changed the IP address, but that's an unimportant detail.)

I ran that configuration file using the following command:

gcloud builds submit --no-source --config cloudbuild.yaml 

The build failed. The output of the command included:

Could not connect to Redis at 10.1.2.3:6379: Connection timed out 

(Again, I have changed the IP address.)

How can I get this redis-cli command to work?

1 Answer 1

1

The operation you are trying to perform is not currently possible. You see, in order to connect to your Memorystore instance a VM or Kubernetes Cluster has to be in the same GCP project, region and VPC network. When you use Cloud Build you are using a VM in which you can't select the region nor network.

Doing some research about this, I could find that Google Engineering team has been working on what is currently known as Worker pools. This product [1] is currently in alfa state and it's not recommended for implementation on production environments as it could change without notice.

Using the cloud shell you could create a machine on certain network to gain access to your resources such as memorystore. You could also specify the region, disk size or machine type of your cloud build worker.

[1] https://cloud.google.com/sdk/gcloud/reference/alpha/builds/worker-pools/create

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.