mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 18:07:31 +00:00
fix(zitadel-image): refactor dockerfiles and gh action (#2027)
* early prototyp * fix some errors * remove docker image cache * add comment * add false * typo * test cache speed * upload artifact * remove tag * seperate after build step * debug * debug * debug * debug * debug * test gh * test * test * test * test * test golang * test go * test with release image * fix * use scratch to export * test * fix path * ref * typo * debug * test * debug * speed up docker * test * debug * debug * try scope * test cache * restore cache * reenable operator build * fix duplicate * fix buildpush version * test cache * improve caching * test release IF * only run console and zitadel without dispatch * test with reworked operator * testing without release step * lint yaml * fix if * improve wording * enable release step & only notify sentry on main * console from file system * update docker file paths * remove migration line * add statik for operator * console files using go 1.15 * fix console default path * improve code QL Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
25
.github/workflows/codeql-analysis.yml
vendored
25
.github/workflows/codeql-analysis.yml
vendored
@@ -2,57 +2,40 @@ name: "Code scanning - action"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, ]
|
||||
branches:
|
||||
- 'main'
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [main]
|
||||
branches:
|
||||
- 'main'
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
schedule:
|
||||
- cron: '0 12 * * 2'
|
||||
|
||||
jobs:
|
||||
CodeQL-Build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
fetch-depth: 2
|
||||
|
||||
# If this run was triggered by a pull request event, then checkout
|
||||
# the head of the pull request instead of the merge commit.
|
||||
- run: git checkout HEAD^2
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
with:
|
||||
languages: go, javascript
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
|
233
.github/workflows/zitadel-pr.yml
vendored
233
.github/workflows/zitadel-pr.yml
vendored
@@ -1,233 +0,0 @@
|
||||
name: ZITADEL PR
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- '**'
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
NODE_VERSION: '12'
|
||||
GO_VERSION: '1.15'
|
||||
OPERATOR_IMAGE_NAME: ${{ github.repository }}-operator
|
||||
CRDB_IMAGE_NAME: ${{ github.repository }}-crbackup
|
||||
ARTIFACTS_FOLDER: './artifacts'
|
||||
|
||||
jobs:
|
||||
refs:
|
||||
name: Prepare CI Vars
|
||||
runs-on: ubuntu-18.04
|
||||
outputs:
|
||||
sha_short: ${{ steps.refs.outputs.sha_short }}
|
||||
short_ref: ${{ steps.refs.outputs.short_ref }}
|
||||
version: ${{ steps.refs.outputs.version }}
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Semantic Release
|
||||
id: semantic
|
||||
uses: cycjimmy/semantic-release-action@v2
|
||||
with:
|
||||
dry_run: true
|
||||
semantic_version: 17.0.4
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Set outputs
|
||||
id: refs
|
||||
run: |
|
||||
export BRANCH=${GITHUB_REF#refs/*/}
|
||||
echo "branch: ${BRANCH}"
|
||||
|
||||
export BRANCHTRANSLATED=$(echo ${BRANCH} | tr '/' '_')
|
||||
echo "short_ref: ${BRANCHTRANSLATED}"
|
||||
|
||||
export VERSION=""
|
||||
if ${{ steps.semantic.outputs.new_release_published == 'true' }}; then
|
||||
export VERSION=${{ steps.semantic.outputs.new_release_version }}
|
||||
else
|
||||
export VERSION=${BRANCHTRANSLATED}
|
||||
fi
|
||||
echo "New semantic release: ${{ steps.semantic.outputs.new_release_published }}"
|
||||
echo "version: ${VERSION}"
|
||||
|
||||
echo "::set-output name=short_ref::${BRANCHTRANSLATED}"
|
||||
echo "::set-output name=sha_short::SHA-$(git rev-parse --short=12 HEAD)"
|
||||
echo "::set-output name=version::${VERSION}"
|
||||
|
||||
zitadel-image:
|
||||
name: Build ZITADEL
|
||||
needs: refs
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-zitadel-${{ hashFiles('**/go.sum', 'console/package-lock.json', 'build/dockerfile') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-zitadel-
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
registry: ${{ env.REGISTRY }}
|
||||
- run: ls -la
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./build/dockerfile
|
||||
platforms: linux/amd64
|
||||
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ needs.refs.outputs.sha_short }},${{ env.REGISTRY }}/${{ github.repository }}:${{ needs.refs.outputs.short_ref }}
|
||||
push: false
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./build/dockerfile
|
||||
platforms: linux/amd64
|
||||
tags: ${{ env.REGISTRY }}/${{ github.repository }}:coverage
|
||||
push: false
|
||||
cache-from: type=local,src=/tmp/.buildx-cache-new
|
||||
target: go-codecov
|
||||
outputs: type=local,dest=/tmp/zitadel
|
||||
- uses: codecov/codecov-action@v1
|
||||
with:
|
||||
files: /tmp/zitadel/profile.cov
|
||||
name: codecov-go
|
||||
-
|
||||
# Temp fix
|
||||
# https://github.com/docker/build-push-action/issues/252
|
||||
# https://github.com/moby/buildkit/issues/1896
|
||||
name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
operator-image:
|
||||
needs: refs
|
||||
runs-on: ubuntu-18.04
|
||||
name: Build ZITADEL Operator ${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
strategy:
|
||||
matrix:
|
||||
goos: [ 'linux', 'darwin', 'windows' ]
|
||||
goarch: [ 'amd64' ]
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ matrix.goos }}-${{ matrix.goarch }}-operator-image-${{ hashFiles('**/go.sum', 'build/operator/Dockerfile') }}
|
||||
restore-keys: |
|
||||
${{ matrix.goos }}-${{ matrix.goarch }}-operator-image-
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
registry: ${{ env.REGISTRY }}
|
||||
- uses: docker/build-push-action@v2
|
||||
name: onlybuild
|
||||
with:
|
||||
context: .
|
||||
file: ./build/operator/Dockerfile
|
||||
platforms: linux/amd64
|
||||
tags: ${{ env.REGISTRY }}/${{ env.OPERATOR_IMAGE_NAME }}:${{ needs.refs.outputs.sha_short }},${{ env.REGISTRY }}/${{ env.OPERATOR_IMAGE_NAME }}:${{ needs.refs.outputs.short_ref }}
|
||||
push: false
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
|
||||
outputs: type=local,dest=/tmp/operator
|
||||
build-args: |
|
||||
OS=${{ matrix.goos }}
|
||||
ARCH=${{ matrix.goarch }}
|
||||
VERSION=${{ needs.refs.outputs.version }}
|
||||
GITHUBOAUTHCLIENTID=${{ secrets.GITHUBOAUTHCLIENTID }}
|
||||
GITHUBOAUTHCLIENTSECRET=${{ secrets.GITHUBOAUTHCLIENTSECRET }}
|
||||
- shell: bash
|
||||
run: |
|
||||
mv /tmp/operator/zitadelctl /tmp/operator/zitadelctl-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: zitadelctl-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
path: /tmp/operator/zitadelctl-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
- uses: docker/build-push-action@v2
|
||||
if: ${{ matrix.goos == 'linux' && matrix.goarch == 'amd64' }}
|
||||
name: buildandpush
|
||||
with:
|
||||
context: .
|
||||
file: ./build/operator/Dockerfile
|
||||
platforms: linux/amd64
|
||||
tags: ${{ env.REGISTRY }}/${{ env.OPERATOR_IMAGE_NAME }}:${{ needs.refs.outputs.sha_short }},${{ env.REGISTRY }}/${{ env.OPERATOR_IMAGE_NAME }}:${{ needs.refs.outputs.short_ref }}
|
||||
push: false
|
||||
cache-from: type=local,src=/tmp/.buildx-cache-new
|
||||
build-args: |
|
||||
OS=${{ matrix.goos }}
|
||||
ARCH=${{ matrix.goarch }}
|
||||
VERSION=${{ needs.refs.outputs.version }}
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./build/operator/Dockerfile
|
||||
platforms: linux/amd64
|
||||
tags: ${{ env.REGISTRY }}/${{ github.repository }}:coverage
|
||||
push: false
|
||||
cache-from: type=local,src=/tmp/.buildx-cache-new
|
||||
target: go-codecov
|
||||
outputs: type=local,dest=/tmp/operator
|
||||
- uses: codecov/codecov-action@v1
|
||||
with:
|
||||
files: /tmp/operator/profile.cov
|
||||
name: codecov-go
|
||||
-
|
||||
# Temp fix
|
||||
# https://github.com/docker/build-push-action/issues/252
|
||||
# https://github.com/moby/buildkit/issues/1896
|
||||
name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
crdb-image:
|
||||
name: Build CockroachDB Image
|
||||
needs: refs
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-crdb-image-${{ hashFiles('build/cr-backup/Dockerfile') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-crdb-image-
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
registry: ${{ env.REGISTRY }}
|
||||
- uses: docker/build-push-action@v2
|
||||
name: buildandpush
|
||||
with:
|
||||
context: .
|
||||
file: ./build/cr-backup/Dockerfile
|
||||
platforms: linux/amd64
|
||||
tags: ${{ env.REGISTRY }}/${{ env.CRDB_IMAGE_NAME }}:${{ needs.refs.outputs.sha_short }},${{ env.REGISTRY }}/${{ env.CRDB_IMAGE_NAME }}:${{ needs.refs.outputs.short_ref }}
|
||||
push: false
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache
|
277
.github/workflows/zitadel.yml
vendored
277
.github/workflows/zitadel.yml
vendored
@@ -2,15 +2,13 @@ name: ZITADEL Release
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- '**'
|
||||
tags-ignore:
|
||||
- '**'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
NODE_VERSION: '12'
|
||||
GO_VERSION: '1.15'
|
||||
OPERATOR_IMAGE_NAME: ${{ github.repository }}-operator
|
||||
CRDB_IMAGE_NAME: ${{ github.repository }}-crbackup
|
||||
ARTIFACTS_FOLDER: './artifacts'
|
||||
@@ -56,65 +54,130 @@ jobs:
|
||||
echo "::set-output name=sha_short::SHA-$(git rev-parse --short=12 HEAD)"
|
||||
echo "::set-output name=version::${VERSION}"
|
||||
|
||||
zitadel-image:
|
||||
zitadel:
|
||||
name: Build ZITADEL
|
||||
needs: refs
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-zitadel-${{ hashFiles('**/go.sum', 'console/package-lock.json', 'build/dockerfile') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-zitadel-
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
## Workaround until https://github.com/docker/build-push-action/issues/252#issuecomment-804898823 is merged
|
||||
version: v0.6.0-rc1
|
||||
driver-opts: image=moby/buildkit:master
|
||||
buildkitd-flags: --debug
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./build/zitadel/Dockerfile
|
||||
platforms: linux/amd64
|
||||
cache-from: type=gha,scope=zitadel
|
||||
cache-to: type=gha,mode=max,scope=zitadel
|
||||
outputs: type=local,dest=/tmp/zitadel
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: zitadel
|
||||
path: /tmp/zitadel/
|
||||
|
||||
zitadel-codecov:
|
||||
name: Upload ZITADEL Codecov
|
||||
needs: [refs, zitadel]
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
## Workaround until https://github.com/docker/build-push-action/issues/252#issuecomment-804898823 is merged
|
||||
version: v0.6.0-rc1
|
||||
driver-opts: image=moby/buildkit:master
|
||||
buildkitd-flags: --debug
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./build/zitadel/Dockerfile
|
||||
platforms: linux/amd64
|
||||
target: go-codecov
|
||||
cache-from: type=gha,scope=zitadel
|
||||
outputs: type=local,dest=/tmp/zitadel
|
||||
- uses: codecov/codecov-action@v1
|
||||
with:
|
||||
name: zitadel-codecov
|
||||
files: /tmp/zitadel/profile.cov
|
||||
|
||||
zitadel-console:
|
||||
name: Build ZITADEL Console
|
||||
needs: refs
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
## Workaround until https://github.com/docker/build-push-action/issues/252#issuecomment-804898823 is merged
|
||||
version: v0.6.0-rc1
|
||||
driver-opts: image=moby/buildkit:master
|
||||
buildkitd-flags: --debug
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./build/console/Dockerfile
|
||||
platforms: linux/amd64
|
||||
cache-from: type=gha,scope=zitadel-console
|
||||
cache-to: type=gha,mode=max,scope=zitadel-console
|
||||
outputs: type=local,dest=/tmp/zitadel-console
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: zitadel-console
|
||||
path: /tmp/zitadel-console/
|
||||
|
||||
zitadel-image:
|
||||
name: Package ZITADEL Image
|
||||
needs: [refs, zitadel, zitadel-console]
|
||||
runs-on: ubuntu-18.04
|
||||
if: ${{ github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' }}
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: zitadel
|
||||
path: .download/zitadel
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: zitadel-console
|
||||
path: .download/zitadel/console
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
## Workaround until https://github.com/docker/build-push-action/issues/252#issuecomment-804898823 is merged
|
||||
version: v0.6.0-rc1
|
||||
driver-opts: image=moby/buildkit:master
|
||||
buildkitd-flags: --debug
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
registry: ${{ env.REGISTRY }}
|
||||
- run: ls -la
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./build/dockerfile
|
||||
file: ./build/Dockerfile
|
||||
platforms: linux/amd64
|
||||
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ needs.refs.outputs.sha_short }},${{ env.REGISTRY }}/${{ github.repository }}:${{ needs.refs.outputs.short_ref }}
|
||||
push: true
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./build/dockerfile
|
||||
platforms: linux/amd64
|
||||
tags: ${{ env.REGISTRY }}/${{ github.repository }}:coverage
|
||||
push: false
|
||||
cache-from: type=local,src=/tmp/.buildx-cache-new
|
||||
target: go-codecov
|
||||
outputs: type=local,dest=/tmp/zitadel
|
||||
- uses: codecov/codecov-action@v1
|
||||
with:
|
||||
files: /tmp/zitadel/profile.cov
|
||||
name: codecov-go
|
||||
-
|
||||
# Temp fix
|
||||
# https://github.com/docker/build-push-action/issues/252
|
||||
# https://github.com/moby/buildkit/issues/1896
|
||||
name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
cache-from: type=gha,scope=zitadel-image
|
||||
cache-to: type=gha,mode=max,scope=zitadel-image
|
||||
|
||||
operator-image:
|
||||
zitadel-operator:
|
||||
name: Build ZITADEL Operator ${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
needs: refs
|
||||
runs-on: ubuntu-18.04
|
||||
name: Build ZITADEL Operator ${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
strategy:
|
||||
matrix:
|
||||
goos: [ 'linux', 'darwin', 'windows' ]
|
||||
@@ -122,33 +185,22 @@ jobs:
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ matrix.goos }}-${{ matrix.goarch }}-operator-image-${{ hashFiles('**/go.sum', 'build/operator/Dockerfile') }}
|
||||
restore-keys: |
|
||||
${{ matrix.goos }}-${{ matrix.goarch }}-operator-image-
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
registry: ${{ env.REGISTRY }}
|
||||
## Workaround until https://github.com/docker/build-push-action/issues/252#issuecomment-804898823 is merged
|
||||
version: v0.6.0-rc1
|
||||
driver-opts: image=moby/buildkit:master
|
||||
buildkitd-flags: --debug
|
||||
- uses: docker/build-push-action@v2
|
||||
name: onlybuild
|
||||
with:
|
||||
context: .
|
||||
file: ./build/operator/Dockerfile
|
||||
platforms: linux/amd64
|
||||
tags: ${{ env.REGISTRY }}/${{ env.OPERATOR_IMAGE_NAME }}:${{ needs.refs.outputs.sha_short }},${{ env.REGISTRY }}/${{ env.OPERATOR_IMAGE_NAME }}:${{ needs.refs.outputs.short_ref }}
|
||||
push: false
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
|
||||
cache-from: type=gha,scope=${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
cache-to: type=gha,mode=max,scope=${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
outputs: type=local,dest=/tmp/operator
|
||||
build-args: |
|
||||
OS=${{ matrix.goos }}
|
||||
@@ -163,61 +215,97 @@ jobs:
|
||||
with:
|
||||
name: zitadelctl-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
path: /tmp/operator/zitadelctl-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
- uses: docker/build-push-action@v2
|
||||
if: ${{ matrix.goos == 'linux' && matrix.goarch == 'amd64' }}
|
||||
name: buildandpush
|
||||
|
||||
zitadel-operator-codecov:
|
||||
name: Upload ZITADEL Operator Codecov ${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
needs: [refs, zitadel-operator]
|
||||
runs-on: ubuntu-18.04
|
||||
strategy:
|
||||
matrix:
|
||||
goos: [ 'linux' ]
|
||||
goarch: [ 'amd64' ]
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
context: .
|
||||
file: ./build/operator/Dockerfile
|
||||
platforms: linux/amd64
|
||||
tags: ${{ env.REGISTRY }}/${{ env.OPERATOR_IMAGE_NAME }}:${{ needs.refs.outputs.sha_short }},${{ env.REGISTRY }}/${{ env.OPERATOR_IMAGE_NAME }}:${{ needs.refs.outputs.short_ref }}
|
||||
push: true
|
||||
cache-from: type=local,src=/tmp/.buildx-cache-new
|
||||
build-args: |
|
||||
OS=${{ matrix.goos }}
|
||||
ARCH=${{ matrix.goarch }}
|
||||
VERSION=${{ needs.refs.outputs.version }}
|
||||
## Workaround until https://github.com/docker/build-push-action/issues/252#issuecomment-804898823 is merged
|
||||
version: v0.6.0-rc1
|
||||
driver-opts: image=moby/buildkit:master
|
||||
buildkitd-flags: --debug
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./build/operator/Dockerfile
|
||||
platforms: linux/amd64
|
||||
tags: ${{ env.REGISTRY }}/${{ github.repository }}:coverage
|
||||
push: false
|
||||
cache-from: type=local,src=/tmp/.buildx-cache-new
|
||||
cache-from: type=gha,scope=${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
target: go-codecov
|
||||
outputs: type=local,dest=/tmp/operator
|
||||
- uses: codecov/codecov-action@v1
|
||||
with:
|
||||
files: /tmp/operator/profile.cov
|
||||
name: codecov-go
|
||||
-
|
||||
# Temp fix
|
||||
# https://github.com/docker/build-push-action/issues/252
|
||||
# https://github.com/moby/buildkit/issues/1896
|
||||
name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
crdb-image:
|
||||
name: Build CockroachDB Image
|
||||
needs: refs
|
||||
zitadel-operator-image:
|
||||
name: Package ZITADEL Operator Image ${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
needs: [refs, zitadel-operator]
|
||||
runs-on: ubuntu-18.04
|
||||
if: ${{ github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' }}
|
||||
strategy:
|
||||
matrix:
|
||||
goos: [ 'linux' ]
|
||||
goarch: [ 'amd64' ]
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-crdb-image-${{ hashFiles('build/cr-backup/Dockerfile') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-crdb-image-
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
## Workaround until https://github.com/docker/build-push-action/issues/252#issuecomment-804898823 is merged
|
||||
version: v0.6.0-rc1
|
||||
driver-opts: image=moby/buildkit:master
|
||||
buildkitd-flags: --debug
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
registry: ${{ env.REGISTRY }}
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./build/operator/Dockerfile
|
||||
platforms: linux/amd64
|
||||
tags: ${{ env.REGISTRY }}/${{ env.OPERATOR_IMAGE_NAME }}:${{ needs.refs.outputs.sha_short }},${{ env.REGISTRY }}/${{ env.OPERATOR_IMAGE_NAME }}:${{ needs.refs.outputs.short_ref }}
|
||||
push: true
|
||||
cache-from: type=gha,scope=${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
build-args: |
|
||||
OS=${{ matrix.goos }}
|
||||
ARCH=${{ matrix.goarch }}
|
||||
VERSION=${{ needs.refs.outputs.version }}
|
||||
|
||||
crdb-image:
|
||||
name: Package ZITADEL CockroachDB Image
|
||||
needs: refs
|
||||
runs-on: ubuntu-18.04
|
||||
if: ${{ github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' }}
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
## Workaround until https://github.com/docker/build-push-action/issues/252#issuecomment-804898823 is merged
|
||||
version: v0.6.0-rc1
|
||||
driver-opts: image=moby/buildkit:master
|
||||
buildkitd-flags: --debug
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
@@ -232,13 +320,14 @@ jobs:
|
||||
platforms: linux/amd64
|
||||
tags: ${{ env.REGISTRY }}/${{ env.CRDB_IMAGE_NAME }}:${{ needs.refs.outputs.sha_short }},${{ env.REGISTRY }}/${{ env.CRDB_IMAGE_NAME }}:${{ needs.refs.outputs.short_ref }}
|
||||
push: true
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache
|
||||
cache-from: type=gha,scope=zitadel-cockroachdb
|
||||
cache-to: type=gha,mode=max,scope=zitadel-cockroachdb
|
||||
|
||||
release:
|
||||
name: Semantic Release Images and Artifacts
|
||||
runs-on: ubuntu-18.04
|
||||
needs: [ refs, zitadel-image, operator-image, crdb-image ]
|
||||
needs: [ refs, zitadel-image, zitadel-operator-image, crdb-image ]
|
||||
if: ${{ github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' }}
|
||||
env:
|
||||
DOCKER_USERNAME: ${{ github.repository_owner }}
|
||||
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -335,8 +424,8 @@ jobs:
|
||||
prerelease: true
|
||||
draft: false
|
||||
allowUpdates: true
|
||||
- uses: actions/checkout@v2
|
||||
- name: Create Sentry release
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
uses: getsentry/action-release@v1
|
||||
env:
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
|
Reference in New Issue
Block a user