Skip to content

Commit

Permalink
chore(build): re-add #4127 and steps to verify image pull (#4219)
Browse files Browse the repository at this point in the history
  • Loading branch information
lippertmarkus committed Oct 5, 2020
1 parent b17b569 commit 0879067
Showing 1 changed file with 148 additions and 8 deletions.
156 changes: 148 additions & 8 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,73 @@ defaults:
shell: bash

jobs:
build-linux:
name: Build & Push Linux Docker Images
build-linux-amd64:
name: Build & push linux/amd64
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/amd64, linux/arm64]
platform: [linux/amd64]
target: [workflow-controller, argocli, argoexec]
steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: crazy-max/ghaction-docker-buildx@v3
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-${{ matrix.platform }}-${{ matrix.target }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.platform }}-${{ matrix.target }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERIO_USERNAME }}
password: ${{ secrets.DOCKERIO_PASSWORD }}

- name: Docker Buildx
env:
DOCKERIO_ORG: ${{ secrets.DOCKERIO_ORG }}
PLATFORM: ${{ matrix.platform }}
TARGET: ${{ matrix.target }}
run: |
tag=$(basename $GITHUB_REF)
if [ $tag = "master" ]; then
tag="latest"
fi
tag_suffix=$(echo $PLATFORM | sed -r "s/\//-/g")
image_name="${DOCKERIO_ORG}/${TARGET}:${tag}-${tag_suffix}"
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--output "type=image,push=true" \
--platform="${PLATFORM}" \
--target $TARGET \
--tag $image_name .
build-linux-arm64:
name: Build & push linux/arm64
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/arm64]
target: [workflow-controller, argocli, argoexec]
steps:
- uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
Expand Down Expand Up @@ -63,7 +118,7 @@ jobs:
--tag $image_name .
build-windows:
name: Build & Push Windows Docker Images
name: Build & push windows
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
Expand All @@ -90,10 +145,41 @@ jobs:
docker push $image_name
done
push-linux-amd64-images:
name: Push manifest with linux/amd64
runs-on: ubuntu-latest
needs: [build-linux-amd64]
steps:
- uses: actions/checkout@v2
- name: Docker Login
uses: Azure/docker-login@v1
with:
username: ${{ secrets.DOCKERIO_USERNAME }}
password: ${{ secrets.DOCKERIO_PASSWORD }}
- name: Push Multiarch Image
env:
DOCKERIO_ORG: ${{ secrets.DOCKERIO_ORG }}
run: |
echo $(jq -c '. + { "experimental": "enabled" }' ${DOCKER_CONFIG}/config.json) > ${DOCKER_CONFIG}/config.json
docker_org=$DOCKERIO_ORG
tag=$(basename $GITHUB_REF)
if [ $tag = "master" ]; then
tag="latest"
fi
targets="workflow-controller argoexec argocli"
for target in $targets; do
image_name="${docker_org}/${target}:${tag}"
docker manifest create $image_name ${image_name}-linux-amd64
docker manifest push $image_name
done
push-images:
name: Push Multiplatform Images
name: Push manifest with all images
runs-on: ubuntu-latest
needs: [build-linux, build-windows]
needs: [build-linux-arm64, build-windows, push-linux-amd64-images]
steps:
- uses: actions/checkout@v2
- name: Docker Login
Expand Down Expand Up @@ -125,4 +211,58 @@ jobs:
fi
docker manifest push $image_name
done
done
test-images-linux-amd64:
name: Try pulling linux/amd64
runs-on: ubuntu-latest
needs: [push-images]
strategy:
matrix:
platform: [linux/amd64]
target: [workflow-controller, argocli, argoexec]
steps:
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERIO_USERNAME }}
password: ${{ secrets.DOCKERIO_PASSWORD }}

- name: Docker Buildx
env:
DOCKERIO_ORG: ${{ secrets.DOCKERIO_ORG }}
PLATFORM: ${{ matrix.platform }}
TARGET: ${{ matrix.target }}
run: |
tag=$(basename $GITHUB_REF)
if [ $tag = "master" ]; then
tag="latest"
fi
image_name="${DOCKERIO_ORG}/${TARGET}:${tag}"
docker pull $image_name
test-images-windows:
name: Try pulling windows
runs-on: windows-2019
needs: [push-images]
steps:
- name: Docker Login
uses: Azure/docker-login@v1
with:
username: ${{ secrets.DOCKERIO_USERNAME }}
password: ${{ secrets.DOCKERIO_PASSWORD }}
- name: Try pulling
env:
DOCKERIO_ORG: ${{ secrets.DOCKERIO_ORG }}
run: |
docker_org=$DOCKERIO_ORG
tag=$(basename $GITHUB_REF)
if [ $tag = "master" ]; then
tag="latest"
fi
targets="argoexec"
for target in $targets; do
image_name="${docker_org}/${target}:${tag}"
docker pull $image_name
done

0 comments on commit 0879067

Please sign in to comment.