Publish ARM v7/v8 multi-arch image

This commit is contained in:
stefanprodan 2020-09-20 12:11:24 +03:00
parent 1a236a5a29
commit a21a7af6de
1 changed files with 43 additions and 19 deletions

View File

@ -11,21 +11,27 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Setup Kustomize - name: Setup Kustomize
uses: fluxcd/pkg//actions/kustomize@master uses: fluxcd/pkg//actions/kustomize@master
- name: Get version - name: Prepare
id: get_version id: prep
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} run: |
VERSION=sha-${GITHUB_SHA::8}
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF/refs\/tags\//}
fi
echo ::set-output name=BUILD_DATE::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=VERSION::${VERSION}
- name: Generate release asset - name: Generate release asset
run: | run: |
mkdir -p config/release mkdir -p config/release
cp config/default/* config/release cp config/default/* config/release
cd config/release cd config/release
kustomize edit set image fluxcd/notification-controller=fluxcd/notification-controller:${{ steps.get_version.outputs.VERSION }} kustomize edit set image fluxcd/notification-controller=fluxcd/notification-controller:${{ steps.prep.outputs.VERSION }}
kustomize build . > notification-controller.yaml kustomize build . > notification-controller.yaml
- name: Set up QEMU - name: Setup QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v1
with: with:
platforms: all platforms: all
- name: Set up Docker Buildx - name: Setup Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
with: with:
@ -41,33 +47,50 @@ jobs:
with: with:
username: fluxcdbot username: fluxcdbot
password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }} password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }}
- name: Publish amd64 image - name: Publish AMD64 image
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
push: ${{ github.event_name != 'pull_request' }} push: true
builder: ${{ steps.buildx.outputs.name }} builder: ${{ steps.buildx.outputs.name }}
context: . context: .
file: ./Dockerfile file: ./Dockerfile
platforms: linux/amd64 platforms: linux/amd64
tags: ghcr.io/fluxcd/notification-controller:${{ steps.get_version.outputs.VERSION }},docker.io/fluxcd/notification-controller:${{ steps.get_version.outputs.VERSION }} tags: |
- name: Publish arm64 image ghcr.io/fluxcd/notification-controller:${{ steps.prep.outputs.VERSION }}
docker.io/fluxcd/notification-controller:${{ steps.prep.outputs.VERSION }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
- name: Publish ARM image
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
push: ${{ github.event_name != 'pull_request' }} push: true
builder: ${{ steps.buildx.outputs.name }} builder: ${{ steps.buildx.outputs.name }}
context: . context: .
file: ./Dockerfile file: ./Dockerfile
platforms: linux/arm64 platforms: linux/arm/v7,linux/arm64
tags: ghcr.io/fluxcd/notification-controller-arm64:${{ steps.get_version.outputs.VERSION }} tags: |
ghcr.io/fluxcd/notification-controller-arm64:${{ steps.prep.outputs.VERSION }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
- name: Check images - name: Check images
run: | run: |
docker buildx imagetools inspect docker.io/fluxcd/notification-controller:${{ steps.get_version.outputs.VERSION }} docker buildx imagetools inspect docker.io/fluxcd/notification-controller:${{ steps.prep.outputs.VERSION }}
docker buildx imagetools inspect ghcr.io/fluxcd/notification-controller:${{ steps.get_version.outputs.VERSION }} docker buildx imagetools inspect ghcr.io/fluxcd/notification-controller:${{ steps.prep.outputs.VERSION }}
docker buildx imagetools inspect ghcr.io/fluxcd/notification-controller-arm64:${{ steps.get_version.outputs.VERSION }} docker buildx imagetools inspect ghcr.io/fluxcd/notification-controller-arm64:${{ steps.prep.outputs.VERSION }}
docker pull docker.io/fluxcd/notification-controller:${{ steps.get_version.outputs.VERSION }} docker pull docker.io/fluxcd/notification-controller:${{ steps.prep.outputs.VERSION }}
docker pull ghcr.io/fluxcd/notification-controller:${{ steps.get_version.outputs.VERSION }} docker pull ghcr.io/fluxcd/notification-controller:${{ steps.prep.outputs.VERSION }}
docker pull ghcr.io/fluxcd/notification-controller-arm64:${{ steps.get_version.outputs.VERSION }}
- name: Create release - name: Create release
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
id: create_release id: create_release
uses: actions/create-release@latest uses: actions/create-release@latest
env: env:
@ -80,6 +103,7 @@ jobs:
body: | body: |
[CHANGELOG](https://github.com/fluxcd/notification-controller/blob/master/CHANGELOG.md) [CHANGELOG](https://github.com/fluxcd/notification-controller/blob/master/CHANGELOG.md)
- name: Upload artifacts - name: Upload artifacts
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
id: upload-release-asset id: upload-release-asset
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
env: env: