brigadecore / brigade

Event-driven scripting for Kubernetes
https://brigade.sh/
Apache License 2.0
2.4k stars 247 forks source link

CI/CD: Wait for Docker port to be open #1932

Open krancour opened 2 years ago

krancour commented 2 years ago

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.

karnatisrinivas commented 2 years ago

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

krancour commented 2 years ago

All yours.

CypherpunkSamurai commented 1 year ago

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

CypherpunkSamurai commented 1 year ago

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

krancour commented 1 year ago

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

CypherpunkSamurai commented 1 year ago

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