Skip to content

Commit

Permalink
Merge pull request #119 from fluxcd/arm-v7
Browse files Browse the repository at this point in the history
Publish ARM v7/v8 multi-arch image to GHCR
  • Loading branch information
stefanprodan authored Sep 21, 2020
2 parents e9e9719 + b178534 commit 3e83c96
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 26 deletions.
73 changes: 48 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,20 @@ jobs:
- uses: actions/checkout@v2
- name: Setup Kustomize
uses: fluxcd/pkg/actions/kustomize@master
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Generate release asset
- name: Prepare
id: prep
run: |
mkdir -p config/release
cp config/default/* config/release
cd config/release
kustomize edit set image fluxcd/kustomize-controller=fluxcd/kustomize-controller:${{ steps.get_version.outputs.VERSION }}
kustomize build . > kustomize-controller.yaml
- name: Set up QEMU
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: Setup QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Set up Docker Buildx
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
Expand All @@ -41,35 +40,58 @@ jobs:
with:
username: fluxcdbot
password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }}
- name: Publish amd64 image
- name: Publish AMD64 image
uses: docker/build-push-action@v2
with:
push: ${{ github.event_name != 'pull_request' }}
push: true
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
platforms: linux/amd64
tags: |
ghcr.io/fluxcd/kustomize-controller:${{ steps.get_version.outputs.VERSION }}
docker.io/fluxcd/kustomize-controller:${{ steps.get_version.outputs.VERSION }}
- name: Publish arm64 image
ghcr.io/fluxcd/kustomize-controller:${{ steps.prep.outputs.VERSION }}
docker.io/fluxcd/kustomize-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
with:
push: ${{ github.event_name != 'pull_request' }}
push: true
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
platforms: linux/arm64
tags: ghcr.io/fluxcd/kustomize-controller-arm64:${{ steps.get_version.outputs.VERSION }}
platforms: linux/arm/v7,linux/arm64
tags: |
ghcr.io/fluxcd/kustomize-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
run: |
docker buildx imagetools inspect docker.io/fluxcd/kustomize-controller:${{ steps.get_version.outputs.VERSION }}
docker buildx imagetools inspect ghcr.io/fluxcd/kustomize-controller:${{ steps.get_version.outputs.VERSION }}
docker buildx imagetools inspect ghcr.io/fluxcd/kustomize-controller-arm64:${{ steps.get_version.outputs.VERSION }}
docker pull docker.io/fluxcd/kustomize-controller:${{ steps.get_version.outputs.VERSION }}
docker pull ghcr.io/fluxcd/kustomize-controller:${{ steps.get_version.outputs.VERSION }}
docker pull ghcr.io/fluxcd/kustomize-controller-arm64:${{ steps.get_version.outputs.VERSION }}
docker buildx imagetools inspect docker.io/fluxcd/kustomize-controller:${{ steps.prep.outputs.VERSION }}
docker buildx imagetools inspect ghcr.io/fluxcd/kustomize-controller:${{ steps.prep.outputs.VERSION }}
docker buildx imagetools inspect ghcr.io/fluxcd/kustomize-controller-arm64:${{ steps.prep.outputs.VERSION }}
docker pull docker.io/fluxcd/kustomize-controller:${{ steps.prep.outputs.VERSION }}
docker pull ghcr.io/fluxcd/kustomize-controller:${{ steps.prep.outputs.VERSION }}
- name: Generate release asset
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
run: |
mkdir -p config/release
cp config/default/* config/release
cd config/release
kustomize edit set image fluxcd/kustomize-controller=fluxcd/kustomize-controller:${{ steps.prep.outputs.VERSION }}
kustomize build . > kustomize-controller.yaml
- name: Create release
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
id: create_release
uses: actions/create-release@latest
env:
Expand All @@ -82,6 +104,7 @@ jobs:
body: |
[CHANGELOG](https://github.com/fluxcd/kustomize-controller/blob/master/CHANGELOG.md)
- name: Upload artifacts
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ WORKDIR /workspace

RUN apk add --no-cache ca-certificates curl

RUN arch=${TARGETPLATFORM:-linux/amd64} && kubectl_ver=1.19.0 && \
RUN kubectl_ver=1.19.2 && \
arch=${TARGETPLATFORM:-linux/amd64} && \
if [ "$TARGETPLATFORM" == "linux/arm/v7" ]; then arch="linux/arm"; fi && \
curl -sL https://storage.googleapis.com/kubernetes-release/release/v${kubectl_ver}/bin/${arch}/kubectl \
-o /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl

Expand Down

0 comments on commit 3e83c96

Please sign in to comment.