Problem you have encountered:
I am currently unable to connect to an instance of cloud_sql_proxy from within a cloud build, one that was setup in an earlier executed step. I am using the gce-proxy docker image. When running the cloud_build_local command line tool I was able to successfully run through the entirety of the steps defined in my cloudbuild.json file. But when I try to run this through cloud builds directly, the step doesn’t seem to finish until after the cloud build fails, no matter what order I put things in or even if I put a generous sleep step in there.
What you expected to happen:
I expected to be able to connect to the localhost of the cloud build after a previous step was run, namely trying to connect to port 5432 after a cloud_sql_proxy step was run and accepting connections on port 5432.
Steps to reproduce:
I’m not sure what I can supply here without handing over sensitive information, but here is an output of one of the builds, and each one fails in the same way:
Starting Step #4 - "proxy"
Step #0: Already have image (with digest): gcr.io/cloud-builders/gsutil
Step #4 - "proxy": Pulling image: gcr.io/cloudsql-docker/gce-proxy
Step #4 - "proxy": Using default tag: latest
Step #4 - "proxy": latest: Pulling from cloudsql-docker/gce-proxy
Step #0: / [0 files][ 0.0 B/ 157.0 B]
/ [1 files][ 157.0 B/ 157.0 B]
Step #0: Operation completed over 1 objects/157.0 B.
Step #4 - "proxy": 10f5d9575767: Pull complete
Step #4 - "proxy": Digest: sha256:96689ad665bffc521fc9ac3cbcaa90f7d543a3fc6f1c84f81e4148a22ffa66e0
Step #4 - "proxy": Status: Downloaded newer image for gcr.io/cloudsql-docker/gce-proxy:latest
Finished Step #0
Starting Step #1
Step #1: Pulling image: ubuntu
Step #4 - "proxy": 2019/04/30 17:55:45 current FDs rlimit set to 1048576, wanted limit is 8500. Nothing to do here.
Step #4 - "proxy": 2019/04/30 17:55:45 Listening on 127.0.0.1:5432
Step #4 - "proxy": 2019/04/30 17:55:45 Ready for new connections
Step #1: Using default tag: latest
Step #1: latest: Pulling from library/ubuntu
Step #1: Digest: sha256:ab6cb8de3ad7bb33e2534677f865008535427390b117d7939193f8d1a6613e34
Step #1: Status: Downloaded newer image for ubuntu:latest
Finished Step #1
Starting Step #2
Step #2: Already have image (with digest): gcr.io/cloud-builders/npm
Finished Step #2
Starting Step #3 - "install"
Step #3 - "install": Already have image (with digest): gcr.io/cloud-builders/npm
Finished Step #3 - "install"
Starting Step #5
Step #5: Already have image (with digest): gcr.io/cloud-builders/npm
Step #5: Loaded configuration file "src/configs/database.js".
Step #5: ERROR: getaddrinfo ENOTFOUND host.docker.internal host.docker.internal:5432
Step #5: npm ERR! Exit status 1
Step #5: npm ERR! A complete log of this run can be found in:
Step #5: npm ERR! /builder/home/.npm/_logs/2019-04-30T17_57_54_048Z-debug.log
Finished Step #5
Finished Step #4 - "proxy"
ERROR
ERROR: build step 5 "gcr.io/cloud-builders/npm" failed: exit status 1
That line "Finished Step 4 - "proxy"" at the ends needs to happen sooner than step 5, but I can’t get it to finish any earlier than after the build has failed.
Other information (workarounds you have tried, documentation consulted, etc):
I have combed over the github issues page and the issues in the issue tracker and have found nothing that remedied the problem, I’ve found some information in stack overflow and those github issues that helped me get the local cloud build working, but nothing for the cloud build itself. We decided to give Google Cloud a try after being a primarily AWS focused company, and so far have been very pleased with the process. This however has been giving us quite the headache. I have played with changing the steps, making sure that the stepped is properly waited for, even adding some sleeps in there, and still nothing has worked.
Problem you have encountered:
I am currently unable to connect to an instance of cloud_sql_proxy from within a cloud build, one that was setup in an earlier executed step. I am using the gce-proxy docker image. When running the cloud_build_local command line tool I was able to successfully run through the entirety of the steps defined in my cloudbuild.json file. But when I try to run this through cloud builds directly, the step doesn’t seem to finish until after the cloud build fails, no matter what order I put things in or even if I put a generous sleep step in there.
What you expected to happen:
I expected to be able to connect to the localhost of the cloud build after a previous step was run, namely trying to connect to port 5432 after a cloud_sql_proxy step was run and accepting connections on port 5432.
Steps to reproduce:
I’m not sure what I can supply here without handing over sensitive information, but here is an output of one of the builds, and each one fails in the same way:
That line "Finished Step 4 - "proxy"" at the ends needs to happen sooner than step 5, but I can’t get it to finish any earlier than after the build has failed.
Other information (workarounds you have tried, documentation consulted, etc):
I have combed over the github issues page and the issues in the issue tracker and have found nothing that remedied the problem, I’ve found some information in stack overflow and those github issues that helped me get the local cloud build working, but nothing for the cloud build itself. We decided to give Google Cloud a try after being a primarily AWS focused company, and so far have been very pleased with the process. This however has been giving us quite the headache. I have played with changing the steps, making sure that the stepped is properly waited for, even adding some sleeps in there, and still nothing has worked.