From c57ca5923f83643853b3c33ffb771781093d7aad Mon Sep 17 00:00:00 2001 From: Alan Clucas Date: Mon, 20 May 2024 15:19:02 +0100 Subject: [PATCH] ci: optimise image building (#13027) Signed-off-by: Alan Clucas Co-authored-by: Anton Gilgur (cherry picked from commit ff646fec790a1f21a9c13d0cff46d539c985bc04) --- .github/workflows/ci-build.yaml | 64 +++++++++++---------------------- 1 file changed, 21 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 2687fb9a2c40..dd4a9116674e 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -123,11 +123,17 @@ jobs: if: github.ref == 'refs/heads/main' run: bash <(curl -s https://codecov.io/bash) - argoexec-image: - name: argoexec-image + argo-images: + name: argo-images # needs: [ lint ] runs-on: ubuntu-latest timeout-minutes: 10 + strategy: + fail-fast: false + matrix: + include: + - image: argoexec + - image: argocli steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 @@ -135,45 +141,21 @@ jobs: uses: docker/build-push-action@v5 with: context: . - tags: quay.io/argoproj/argoexec:latest - outputs: type=docker,dest=/tmp/argoexec_image.tar - target: argoexec - cache-from: type=gha - cache-to: type=gha,mode=max - - name: Upload - uses: actions/upload-artifact@v4 - with: - name: argoexec - path: /tmp/argoexec_image.tar - if-no-files-found: error - - argocli-image: - name: argocli-image - # needs: [ lint ] - runs-on: ubuntu-latest - timeout-minutes: 15 - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 - - name: Build and export - uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 - with: - context: . - tags: quay.io/argoproj/argocli:latest - outputs: type=docker,dest=/tmp/argocli_image.tar - target: argocli + tags: quay.io/argoproj/${{matrix.image}}:latest + outputs: type=docker,dest=/tmp/${{matrix.image}}_image.tar + target: ${{matrix.image}} cache-from: type=gha cache-to: type=gha,mode=max - name: Upload uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 with: - name: argocli - path: /tmp/argocli_image.tar + name: ${{matrix.image}}_image.tar + path: /tmp/${{matrix.image}}_image.tar if-no-files-found: error e2e-tests: name: E2E Tests - needs: [ changed-files, argoexec-image, argocli-image ] + needs: [ changed-files, argo-images ] if: ${{ needs.changed-files.outputs.e2e-tests == 'true' }} runs-on: ubuntu-latest timeout-minutes: 30 @@ -248,20 +230,16 @@ jobs: echo " user:" >> $KUBECONFIG echo " token: xxxxxx" >> $KUBECONFIG until kubectl cluster-info ; do sleep 10s ; done - - name: Download argoexec image - uses: actions/download-artifact@v4 - with: - name: argoexec - path: /tmp - - name: Load argoexec image - run: docker load < /tmp/argoexec_image.tar - - name: Download argocli image + - name: Download images uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 with: - name: argocli + pattern: '*_image.tar' path: /tmp - - name: Load argocli image - run: docker load < /tmp/argocli_image.tar + - name: Load images + run: | + set -eux + docker load < /tmp/argoexec_image.tar/argoexec_image.tar + docker load < /tmp/argocli_image.tar/argocli_image.tar - name: Set-up /etc/hosts run: | echo '127.0.0.1 dex' | sudo tee -a /etc/hosts