diff mbox series

[v2,3/5] Add loop over docker info

Message ID 20230522174153.46801-4-cconte@redhat.com
State New
Headers show
Series [v2,1/5] Remove redundant CI variables | expand

Commit Message

Camilla Conte May 22, 2023, 5:41 p.m. UTC
Wait for docker info to return successfuly to ensure that
the docker server (daemon) started.
This is needed for jobs running on Kubernetes.
See https://wiki.qemu.org/Testing/CI/KubernetesRunners.

Signed-off-by: Camilla Conte <cconte@redhat.com>
---
 .gitlab-ci.d/container-template.yml | 2 +-
 .gitlab-ci.d/opensbi.yml            | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Daniel P. Berrangé May 23, 2023, 8:33 a.m. UTC | #1
On Mon, May 22, 2023 at 06:41:52PM +0100, Camilla Conte wrote:
> Wait for docker info to return successfuly to ensure that
> the docker server (daemon) started.
> This is needed for jobs running on Kubernetes.
> See https://wiki.qemu.org/Testing/CI/KubernetesRunners.
> 
> Signed-off-by: Camilla Conte <cconte@redhat.com>
> ---
>  .gitlab-ci.d/container-template.yml | 2 +-
>  .gitlab-ci.d/opensbi.yml            | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
Richard Henderson May 23, 2023, 1:06 p.m. UTC | #2
On 5/22/23 10:41, Camilla Conte wrote:
> +    - until docker info; do sleep 1; done

How long are you expecting this to have to wait?
Less than 5 seconds?


r~
Camilla Conte May 23, 2023, 1:26 p.m. UTC | #3
On Tue, May 23, 2023 at 2:06 PM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 5/22/23 10:41, Camilla Conte wrote:
> > +    - until docker info; do sleep 1; done
>
> How long are you expecting this to have to wait?
> Less than 5 seconds?

I remember seeing jobs where it took longer than five seconds, but I
can't find them at the moment.
I guess you wish the "until" loop to fail sooner, rather than having
to wait for the whole job timing out.
What about setting a five seconds timeout for the loop and raise it
later if we see
jobs failing?

>
>
> r~
>
diff mbox series

Patch

diff --git a/.gitlab-ci.d/container-template.yml b/.gitlab-ci.d/container-template.yml
index 11569dd900..9ac4a0ee25 100644
--- a/.gitlab-ci.d/container-template.yml
+++ b/.gitlab-ci.d/container-template.yml
@@ -8,8 +8,8 @@ 
     - export TAG="$CI_REGISTRY_IMAGE/qemu/$NAME:latest"
     - export COMMON_TAG="$CI_REGISTRY/qemu-project/qemu/qemu/$NAME:latest"
     - apk add python3
-    - docker info
     - docker login $CI_REGISTRY -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
+    - until docker info; do sleep 1; done
   script:
     - echo "TAG:$TAG"
     - echo "COMMON_TAG:$COMMON_TAG"
diff --git a/.gitlab-ci.d/opensbi.yml b/.gitlab-ci.d/opensbi.yml
index 13070575b6..2e9d51764e 100644
--- a/.gitlab-ci.d/opensbi.yml
+++ b/.gitlab-ci.d/opensbi.yml
@@ -50,6 +50,7 @@  docker-opensbi:
     IMAGE_TAG: $CI_REGISTRY_IMAGE:opensbi-cross-build
   before_script:
     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+    - until docker info; do sleep 1; done
   script:
     - docker pull $IMAGE_TAG || true
     - docker build --cache-from $IMAGE_TAG --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA