Skip to content

Require only build container to start in Kubernetes

What does this MR do?

Fixes #38035 (closed), #38038 (closed)

Why was this MR needed?

  • In !4883 (diffs) we started using podutils.IsPodReady rather than just checking for the Pod phase
  • In !4984 (diffs) we extracted the function into our codebase. I did not question it because it was part of an already approved MR.

This has the unfortunate side effect that it requires all the containers in the pod to be running. However, it's perfectly valid to have a service that has terminated. In such scenarios the build would hang waiting for the service container to be running, which would never happen.

What's the best way to test this MR?

Build a service that would exit in 10 seconds:

FROM alpine

RUN apk update && apk add bash

CMD ["bash", "-c", "counter=1; while [ $counter -le 10 ]; do echo $counter; ((counter++)); sleep 1; done"]

Push it:

docker build -t ttl.sh/counter-service:12h .
docker push ttl.sh/counter-service:12h

Use it:

hi:
  image: ubuntu:latest
  services:
    - name: ttl.sh/counter-service:12h
  script:
    - counter=1; while [ $counter -le 600 ]; do echo $counter; ((counter++)); sleep 1; done
  tags:
    - k8s-local

As soon as the service exits the next step of the build will hang.

What are the relevant issue numbers?

Closes #38035 (closed), #38038 (closed)

Edited by Georgi N. Georgiev

Merge request reports

Loading