Merge pull request #6927 from Rory-Z/ci/push-multiarch-image-for-aws

ci(build_packages): push muilt arch image for aws ecr
This commit is contained in:
Zaiming (Stone) Shi 2022-02-14 12:26:56 +01:00 committed by GitHub
commit f1b10ec2b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 21 deletions

View File

@ -353,6 +353,15 @@ jobs:
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
otp:
- 24.1.5-3
registry:
- 'docker.io'
- 'public.ecr.aws'
exclude:
# we don't have an aws ecr repo for enterprise and edge yet
- profile: emqx-edge
registry: 'public.ecr.aws'
- profile: emqx-ee
registry: 'public.ecr.aws'
steps:
- uses: actions/download-artifact@v2
@ -366,10 +375,24 @@ jobs:
with:
image: tonistiigi/binfmt:latest
platforms: all
- uses: aws-actions/configure-aws-credentials@v1
if: matrix.registry == 'public.ecr.aws'
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Docker login for aws ecr
if: matrix.registry == 'public.ecr.aws'
run: aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
- uses: docker/login-action@v1
if: matrix.registry == 'docker.io'
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- uses: docker/metadata-action@v3
id: meta
with:
images: ${{ github.repository_owner }}/${{ matrix.profile }}
images: ${{ matrix.registry }}/${{ github.repository_owner }}/${{ matrix.profile }}
flavor: |
latest=${{ !github.event.release.prerelease }}
tags: |
@ -378,11 +401,6 @@ jobs:
type=match,pattern=[v|e](.*),group=1
labels:
org.opencontainers.image.otp.version=${{ matrix.otp }}
- uses: docker/login-action@v1
if: github.event_name == 'release'
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- uses: docker/build-push-action@v2
if: matrix.profile != 'emqx-ee'
with:
@ -413,20 +431,6 @@ jobs:
EMQX_NAME=${{ matrix.profile }}
file: source/deploy/docker/Dockerfile.enterprise
context: source
- uses: aws-actions/configure-aws-credentials@v1
if: github.event_name == 'release' && !github.event.release.prerelease && matrix.profile == 'emqx'
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Push image to aws ecr
if: github.event_name == 'release' && !github.event.release.prerelease && matrix.profile == 'emqx'
run: |
version=${GITHUB_REF##*/}
docker pull emqx/emqx:${version#v}
docker tag emqx/emqx:${version#v} public.ecr.aws/emqx/emqx:${version#v}
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
docker push public.ecr.aws/emqx/emqx:${version#v}
delete-artifact:
runs-on: ubuntu-20.04