Skip to content

Commit

Permalink
Fix docker manifest push (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwylde authored Sep 14, 2023
1 parent d7de168 commit 0938cd0
Showing 1 changed file with 15 additions and 85 deletions.
100 changes: 15 additions & 85 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,42 +46,40 @@ jobs:
steps:
# Get the repository's code
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v2.2.0
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Login to GHCR
uses: docker/login-action@v2.2.0
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta
id: arroyo-docker # you'll use this in the next step
uses: docker/metadata-action@v4.6.0
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ github.repository_owner }}/arroyo-${{ matrix.image_type }}
ghcr.io/arroyosystems/arroyo-${{ matrix.image_type }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr,prefix=${{ matrix.prom_arch }}-pr-
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha,prefix=${{ matrix.prom_arch }}-sha-
type=sha
flavor: |
latest=false
prefix=${{ matrix.prom_arch }}-
- name: Set env
run: echo "GIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v4.1.1
uses: docker/build-push-action@v2
with:
context: .
file: ${{ matrix.dockerfile }}
Expand All @@ -91,14 +89,11 @@ jobs:
PROTO_ARCH=${{ matrix.proto_arch }}
PROM_ARCH=${{ matrix.prom_arch }}
GIT_SHA=${{ env.GIT_SHA }}
push: true
cache-from: type=registry,ref=user/app:latest
cache-to: type=inline
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.arroyo-docker.outputs.tags }}
labels: ${{ steps.arroyo-docker.outputs.labels }}
manifest:
needs: build
if: ${{ github.event_name != 'pull_request' }}
strategy:
matrix:
image_type:
Expand All @@ -109,7 +104,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Login to GHCR
uses: docker/login-action@v2.20
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand All @@ -119,7 +114,7 @@ jobs:
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ github.repository_owner }}/arroyo-${{ matrix.image_type }}
ghcr.io/arroyosystems/arroyo-${{ matrix.image_type }}
tags: |
type=schedule
type=ref,event=branch
Expand All @@ -131,7 +126,7 @@ jobs:
- name: Create and push Docker manifest
run: |
TAG=${{ steps.arroyo-docker.outputs.version }}
IMAGE=ghcr.io/${{ github.repository_owner }}/arroyo-${{ matrix.image_type }}
IMAGE=ghcr.io/arroyosystems/arroyo-${{ matrix.image_type }}
docker manifest create ${IMAGE}:${TAG} ${IMAGE}:arm64-${TAG} ${IMAGE}:amd64-${TAG}
docker manifest annotate ${IMAGE}:${TAG} ${IMAGE}:arm64-${TAG} --arch arm64
docker manifest annotate ${IMAGE}:${TAG} ${IMAGE}:amd64-${TAG} --arch amd64
Expand All @@ -140,73 +135,8 @@ jobs:
if: github.ref == 'refs/heads/master'
run: |
TAG=${{ steps.arroyo-docker.outputs.version }}
IMAGE=ghcr.io/${{ github.repository_owner }}/arroyo-${{ matrix.image_type }}
IMAGE=ghcr.io/arroyosystems/arroyo-${{ matrix.image_type }}
docker manifest create ${IMAGE}:tip ${IMAGE}:arm64-${TAG} ${IMAGE}:amd64-${TAG}
docker manifest annotate ${IMAGE}:tip ${IMAGE}:arm64-${TAG} --arch arm64
docker manifest annotate ${IMAGE}:tip ${IMAGE}:amd64-${TAG} --arch amd64
docker manifest push ${IMAGE}:tip
helm:
strategy:
matrix:
config:
- {runner: 'buildjet-8vcpu-ubuntu-2204', arch: 'amd64'}
- {runner: 'buildjet-8vcpu-ubuntu-2204-arm', arch: 'arm64'}
needs: build
runs-on: ${{ matrix.config.runner }}
if: ${{ github.event_name == 'pull_request' }}
defaults:
run:
working-directory: k8s/arroyo

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v3.5
with:
version: v3.8.1

# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
# yamllint (https://github.com/adrienverge/yamllint) which require Python
# actions/setup-python doesn't yet support ARM
- if: ${{ !endsWith(matrix.config.runner, '-arm') }}
uses: actions/setup-python@v4
with:
python-version: "3.11"
- if: ${{ endsWith(matrix.config.runner, '-arm') }}
uses: deadsnakes/action@v2.1.1
with:
python-version: "3.11"

- name: Set up chart-testing
## 2.4.0 latest release doesn't work well with Arm
uses: helm/chart-testing-action@a629e844a9d081a827cf96486ef29f60afef87e4
with:
version: v3.9.0

- name: Lint chart
run: ct lint --all

- name: Create kind cluster
uses: helm/kind-action@v1.4.0

- uses: benjlevesque/short-sha@v2.2
id: short-sha
with:
length: 7

- name: Run chart-testing (install)
run: |
ct install --charts ./ --config ct.yaml \
--helm-extra-set-args="\
--set=api.image.repository=ghcr.io/${{ github.repository_owner }}/arroyo-services \
--set=api.image.tag=${{ matrix.config.arch }}-sha-${{ steps.short-sha.outputs.sha }} \
--set=compiler.image.repository=ghcr.io/${{ github.repository_owner }}/arroyo-compiler \
--set=compiler.image.tag=${{ matrix.config.arch }}-sha-${{ steps.short-sha.outputs.sha }} \
--set=controller.image.repository=ghcr.io/${{ github.repository_owner }}/arroyo-services \
--set=controller.image.tag=${{ matrix.config.arch }}-sha-${{ steps.short-sha.outputs.sha }} \
--set=worker.image.repository=ghcr.io/${{ github.repository_owner }}/arroyo-worker \
--set=worker.image.tag=${{ matrix.config.arch }}-sha-${{ steps.short-sha.outputs.sha }}"
docker manifest push ${IMAGE}:tip

0 comments on commit 0938cd0

Please sign in to comment.