brigade icon indicating copy to clipboard operation
brigade copied to clipboard

CI/CD: Wait for Docker port to be open

Open krancour opened this issue 2 years ago • 6 comments

Our CI/CD processes (see .brigade/brigade.ts) build multi-arch Docker images using "Docker in Docker." The primary container for each job runs the Docker client while the Docker server runs in a sidecar.

Currently, the image build processes use a sleep before proceeding with a docker buildx ... This allows the sidecar a grace period to start before the build proceeds. Often this delays builds longer than necessary. Sometimes it leads to failures because resource demand in the cluster meant the Docker server in the sidecar was slow to start.

This issue suggests modifying the process to wait only as long as needed (up to some limit -- 90 seconds maybe) for port 2375 to actually start accepting requests.

Some very small amount of research will be required on how best to achieve, this, but it is easily accomplished with nc or even pure bash.

Note: Several other repos in the @brigadecore org would benefit from a similar change.

krancour avatar Apr 18 '22 16:04 krancour

Hello @krancour , I would like to give it a try.

karnatisrinivas avatar May 11 '22 19:05 karnatisrinivas

All yours.

krancour avatar May 11 '22 19:05 krancour

Hello Sir @krancour, Can I takeover this issue? I have bash scripting experience and I feel confident in putting together a working script.

CypherpunkSamurai avatar Sep 01 '22 19:09 CypherpunkSamurai

I've made a new draft commit on this issue, please review changes. https://github.com/CypherpunkSamurai/brigade/commit/345c8425aad1a15f493582a800f8df6e1f6289e7

CypherpunkSamurai avatar Sep 01 '22 19:09 CypherpunkSamurai

I'm no longer a maintainer for this project, but also, as an fyi, this project is currently being considered for archival.

https://github.com/cncf/toc/pull/915

krancour avatar Sep 01 '22 20:09 krancour

Ok Sir, No problem. I'm happy to have attempted to contribute :)

CypherpunkSamurai avatar Sep 01 '22 20:09 CypherpunkSamurai