Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplatform build #17

Merged
merged 8 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 72 additions & 67 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:

jobs:

build-and-push-docker:
runs-on: ubuntu-latest
name: Docker images
name: Build Docker image
strategy:
fail-fast: true
matrix:
Expand All @@ -18,14 +19,18 @@ jobs:
steps:
- name: Extract version from tag
id: extract_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
run: echo "VERSION=0.2.4" >> $GITHUB_ENV
# run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

- name: Debug version
run: echo ${{ env.VERSION }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Docker Cache
uses: actions/cache@v3
Expand All @@ -36,7 +41,7 @@ jobs:
${{ runner.os }}-buildx-

- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand All @@ -48,7 +53,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: ./admission-controller/${{ matrix.from }}/
platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64/v8
file: ./admission-controller/${{ matrix.from }}/Dockerfile
tags: |
kubeshop/monokle-admission-controller-${{ matrix.from }}:latest
Expand All @@ -62,65 +67,65 @@ jobs:
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

build-and-push-helm:
runs-on: ubuntu-latest
name: Helm chart
needs: [build-and-push-docker]

steps:
- name: Extract version from tag
id: extract_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

- name: Debug version
run: echo ${{ env.VERSION }}

- name: Login Helm to DockerHub registry
run: |
helm registry login registry-1.docker.io -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin <<< "${{ secrets.DOCKERHUB_TOKEN }}"

- name: Checkout Repository
uses: actions/checkout@v2

# See https://docs.docker.com/docker-hub/oci-artifacts/#push-a-helm-chart
- name: Build and publish Helm chart
env:
VERSION: ${{ env.VERSION }}
run: |
echo "Building Helm chart with version: ${VERSION}"
helm package ./helm --version ${VERSION}
helm push monokle-admission-controller-${VERSION}.tgz oci://registry-1.docker.io/kubeshop

create-release:
runs-on: ubuntu-latest
name: GitHub release
needs: [build-and-push-docker, build-and-push-helm]

steps:
- name: Extract version from tag
id: extract_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

- name: Debug version
run: echo ${{ env.VERSION }}

- name: Checkout Repository
uses: actions/checkout@v2

- name: Build release artifacts
env:
VERSION: ${{ env.VERSION }}
run: |
helm package ./helm --version ${VERSION}
helm template ./helm --version ${VERSION} > install-standalone.yaml
helm template ./helm --version ${VERSION} --set automationToken=SAMPLE_TOKEN > install-cloud.yaml
mv monokle-admission-controller-${VERSION}.tgz helm.tgz

- name: Create release and upload artifacts
uses: ncipollo/release-action@v1
with:
name: "Release ${{ env.VERSION }}"
allowUpdates: true
artifacts: 'helm.tgz,install-cloud.yaml,install-standalone.yaml'
omitBody: true
token: ${{ secrets.CI_BOT_TOKEN }}
# build-and-push-helm:
# runs-on: ubuntu-latest
# name: Helm chart
# needs: [build-and-push-docker]

# steps:
# - name: Extract version from tag
# id: extract_version
# run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

# - name: Debug version
# run: echo ${{ env.VERSION }}

# - name: Login Helm to DockerHub registry
# run: |
# helm registry login registry-1.docker.io -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin <<< "${{ secrets.DOCKERHUB_TOKEN }}"

# - name: Checkout Repository
# uses: actions/checkout@v2

# # See https://docs.docker.com/docker-hub/oci-artifacts/#push-a-helm-chart
# - name: Build and publish Helm chart
# env:
# VERSION: ${{ env.VERSION }}
# run: |
# echo "Building Helm chart with version: ${VERSION}"
# helm package ./helm --version ${VERSION}
# helm push monokle-admission-controller-${VERSION}.tgz oci://registry-1.docker.io/kubeshop

# create-release:
# runs-on: ubuntu-latest
# name: GitHub release
# needs: [build-and-push-docker, build-and-push-helm]

# steps:
# - name: Extract version from tag
# id: extract_version
# run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

# - name: Debug version
# run: echo ${{ env.VERSION }}

# - name: Checkout Repository
# uses: actions/checkout@v2

# - name: Build release artifacts
# env:
# VERSION: ${{ env.VERSION }}
# run: |
# helm package ./helm --version ${VERSION}
# helm template ./helm --version ${VERSION} > install-standalone.yaml
# helm template ./helm --version ${VERSION} --set automationToken=SAMPLE_TOKEN > install-cloud.yaml
# mv monokle-admission-controller-${VERSION}.tgz helm.tgz

# - name: Create release and upload artifacts
# uses: ncipollo/release-action@v1
# with:
# name: "Release ${{ env.VERSION }}"
# allowUpdates: true
# artifacts: 'helm.tgz,install-cloud.yaml,install-standalone.yaml'
# omitBody: true
# token: ${{ secrets.CI_BOT_TOKEN }}
4 changes: 2 additions & 2 deletions admission-controller/init/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BUILD_IMAGE="node:20.8-alpine"
ARG PRODUCTION_IMAGE="node:20.8-alpine"
ARG BUILD_IMAGE="node:20.9-alpine3.18"
ARG PRODUCTION_IMAGE="node:20.9-alpine3.18"

#####################
# Compile container
Expand Down
4 changes: 2 additions & 2 deletions admission-controller/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BUILD_IMAGE="node:20.8-alpine"
ARG PRODUCTION_IMAGE="node:20.8-alpine"
ARG BUILD_IMAGE="node:20.9-alpine3.18"
ARG PRODUCTION_IMAGE="node:20.9-alpine3.18"

#####################
# Compile container
Expand Down
4 changes: 2 additions & 2 deletions admission-controller/synchronizer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BUILD_IMAGE="node:20.8-alpine"
ARG PRODUCTION_IMAGE="node:20.8-alpine"
ARG BUILD_IMAGE="node:20.9-alpine3.18"
ARG PRODUCTION_IMAGE="node:20.9-alpine3.18"

#####################
# Compile container
Expand Down
Loading