From c4e266e3ecea5b22e736045375434f9adc8f495e Mon Sep 17 00:00:00 2001 From: Sergii Kabashniuk Date: Thu, 21 May 2020 15:15:17 +0200 Subject: [PATCH] New buildx + matrix build (#23) * New buildx + matrix build Upgrade of builds to v0.4.1 Upgrade of ghaction-docker-buildx to 1.6.1 matrix build for linux/amd64, linux/s390x platform in ci and pr checks matrix build with cache for pr checks 5 retries for ci and pr check Signed-off-by: Sergii Kabashniuk --- .github/workflows/ci.yaml | 16 ++++++++++++---- .github/workflows/pr.yaml | 25 +++++++++++++++++++++---- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cfd5725..99291b4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,6 +15,10 @@ on: jobs: docker-build: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + platform: [linux/amd64, linux/s390x] env: IMAGE_FULL: quay.io/eclipse/che-workspace-loader:next CACHE_IMAGE_FULL: docker.io/cheincubator/che-workspace-loader:cache @@ -22,16 +26,20 @@ jobs: - uses: actions/checkout@v2 name: Checkout che-workspace-loader source code - name: Docker Buildx - uses: crazy-max/ghaction-docker-buildx@v1.4.0 + uses: crazy-max/ghaction-docker-buildx@v1.6.1 with: - version: v0.3.1 + buildx-version: v0.4.1 - name: "Docker prepare" run: docker image prune -a -f - name: "Docker Quay.io Login" run: docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" quay.io - name: "Docker docker.io Login" run: docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" -p "${{ secrets.DOCKERHUB_PASSWORD }}" docker.io - - name: "Docker build" - run: docker buildx build --platform linux/amd64,linux/s390x --cache-from="type=registry,ref=${CACHE_IMAGE_FULL}" --cache-to="type=registry,ref=${CACHE_IMAGE_FULL},mode=max" -t ${IMAGE_FULL} -f apache.Dockerfile --push . + - name: "Docker build with cache" + uses: nick-invision/retry@v1 + with: + timeout_minutes: 20 + max_attempts: 5 + command: docker buildx build --platform ${{ matrix.platform}} --cache-from="type=registry,ref=${CACHE_IMAGE_FULL}" --cache-to="type=registry,ref=${CACHE_IMAGE_FULL},mode=max" -t ${IMAGE_FULL} -f apache.Dockerfile --push . - name: "Docker Logout" run: docker logout diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 924faab..dd866f1 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -15,6 +15,11 @@ on: jobs: docker-build: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + platform: [linux/amd64, linux/s390x] + layerscaching: [true, false] env: IMAGE_FULL: quay.io/eclipse/che-workspace-loader:next CACHE_IMAGE_FULL: docker.io/cheincubator/che-workspace-loader:cache @@ -22,10 +27,22 @@ jobs: - uses: actions/checkout@v2 name: Checkout che-workspace-loader source code - name: Docker Buildx - uses: crazy-max/ghaction-docker-buildx@v1.4.0 + uses: crazy-max/ghaction-docker-buildx@v1.6.1 with: - version: v0.3.1 + buildx-version: v0.4.1 - name: "Docker prepare" run: docker image prune -a -f - - name: "Docker build" - run: docker buildx build --platform linux/amd64,linux/s390x --cache-from="type=registry,ref=${CACHE_IMAGE_FULL}" -t ${IMAGE_FULL} -f apache.Dockerfile . + - name: "Docker build without cache" + if: ${{ matrix.layerscaching == false}} + uses: nick-invision/retry@v1 + with: + timeout_minutes: 10 + max_attempts: 5 + command: docker buildx build --platform ${{ matrix.platform}} -t ${IMAGE_FULL} -f apache.Dockerfile . + - name: "Docker build with cache" + if: ${{ matrix.layerscaching == true}} + uses: nick-invision/retry@v1 + with: + timeout_minutes: 10 + max_attempts: 5 + command: docker buildx build --platform ${{ matrix.platform}} --cache-from="type=registry,ref=${CACHE_IMAGE_FULL}" -t ${IMAGE_FULL} -f apache.Dockerfile .