From 19ec72f3338a4dad8041e424adf181013a266ee9 Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Mon, 4 Nov 2024 00:10:00 +0300 Subject: [PATCH 01/14] ci(actions): try using docker/build-push-action no pushes yet ofc --- .github/workflows/build.yaml | 61 +++++++++++++++--------------------- 1 file changed, 25 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 24363f97..de237f0c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,13 +2,6 @@ name: Build images on: push: - # Publish `master` as Docker `latest` image. - branches: - - master - - # Publish `v1.2.3` tags as releases. - tags: - - v* env: BASE_IMAGE_NAME: openvk @@ -19,22 +12,15 @@ env: jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - arch: ['x86_64'] if: github.event_name == 'push' steps: - - uses: actions/checkout@v3 - with: - lfs: false - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + 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: Change repository string to lowercase id: repositorystring @@ -42,29 +28,32 @@ jobs: with: string: ${{ github.repository }} - - name: Log into registry - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + # - name: Log into registry + # run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - name: Build base image - run: | - IMAGE_ID=ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$BASE_IMAGE_NAME - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') - [ "$VERSION" == "master" ] && VERSION=latest - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - - docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_ID:$VERSION . --push -f install/automated/docker/openvk.Dockerfile --build-arg GITREPO=${{ steps.repositorystring.outputs.lowercase }} + uses: docker/build-push-action@v6 + with: + tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$BASE_IMAGE_NAME:test + platforms: linux/amd64,linux/arm64 + file: install/automated/docker/openvk.Dockerfile + build-args: | + GITREPO=${{ steps.repositorystring.outputs.lowercase }} - name: Build MariaDB primary image - run: | - IMAGE_NAME=ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$DB_IMAGE_NAME:$DB_VERSION-primary - - docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_NAME . --push -f install/automated/docker/mariadb-primary.Dockerfile --build-arg VERSION=$DB_VERSION + uses: docker/build-push-action@v6 + with: + tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$DB_IMAGE_NAME:$DB_VERSION-primary + platforms: linux/amd64,linux/arm64 + file: install/automated/docker/mariadb-primary.Dockerfile + build-args: | + VERSION=$DB_VERSION - name: Build MariaDB event image - run: | - IMAGE_NAME=ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$EVENT_IMAGE_NAME:$DB_VERSION-eventdb - - docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_NAME . --push -f install/automated/docker/mariadb-eventdb.Dockerfile --build-arg VERSION=$DB_VERSION \ No newline at end of file + uses: docker/build-push-action@v6 + with: + tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$DB_IMAGE_NAME:$DB_VERSION-eventdb + platforms: linux/amd64,linux/arm64 + file: install/automated/docker/mariadb-eventdb.Dockerfile + build-args: | + VERSION=$DB_VERSION From 52878a50f81cc52cf0bd15bbfeaa6c7b94a203d1 Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Mon, 4 Nov 2024 00:14:43 +0300 Subject: [PATCH 02/14] ci(actions): try using multilines to provide env vars --- .github/workflows/build.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index de237f0c..45d4d938 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -34,7 +34,8 @@ jobs: - name: Build base image uses: docker/build-push-action@v6 with: - tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$BASE_IMAGE_NAME:test + tags: | + ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$BASE_IMAGE_NAME:test platforms: linux/amd64,linux/arm64 file: install/automated/docker/openvk.Dockerfile build-args: | @@ -43,7 +44,8 @@ jobs: - name: Build MariaDB primary image uses: docker/build-push-action@v6 with: - tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$DB_IMAGE_NAME:$DB_VERSION-primary + tags: | + ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$DB_IMAGE_NAME:$DB_VERSION-primary platforms: linux/amd64,linux/arm64 file: install/automated/docker/mariadb-primary.Dockerfile build-args: | @@ -52,7 +54,8 @@ jobs: - name: Build MariaDB event image uses: docker/build-push-action@v6 with: - tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$DB_IMAGE_NAME:$DB_VERSION-eventdb + tags: | + ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$DB_IMAGE_NAME:$DB_VERSION-eventdb platforms: linux/amd64,linux/arm64 file: install/automated/docker/mariadb-eventdb.Dockerfile build-args: | From 612cccb7002a1e50e1ffac4c34a25606044ad893 Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Mon, 4 Nov 2024 00:16:47 +0300 Subject: [PATCH 03/14] ci(actions): use full form env vars providing --- .github/workflows/build.yaml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 45d4d938..7b482251 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -34,8 +34,7 @@ jobs: - name: Build base image uses: docker/build-push-action@v6 with: - tags: | - ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$BASE_IMAGE_NAME:test + tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.BASE_IMAGE_NAME}}:test platforms: linux/amd64,linux/arm64 file: install/automated/docker/openvk.Dockerfile build-args: | @@ -44,19 +43,17 @@ jobs: - name: Build MariaDB primary image uses: docker/build-push-action@v6 with: - tags: | - ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$DB_IMAGE_NAME:$DB_VERSION-primary + tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}}:${{env.DB_VERSION}}-primary platforms: linux/amd64,linux/arm64 file: install/automated/docker/mariadb-primary.Dockerfile build-args: | - VERSION=$DB_VERSION + VERSION=${{env.DB_VERSION}} - name: Build MariaDB event image uses: docker/build-push-action@v6 with: - tags: | - ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/$DB_IMAGE_NAME:$DB_VERSION-eventdb + tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}}:${{env.DB_VERSION}}-eventdb platforms: linux/amd64,linux/arm64 file: install/automated/docker/mariadb-eventdb.Dockerfile build-args: | - VERSION=$DB_VERSION + VERSION=${{env.DB_VERSION}} From 264287cef92b1b064946c04a0e83ed934f6372ac Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Mon, 4 Nov 2024 00:35:54 +0300 Subject: [PATCH 04/14] ci(actions): try load flag --- .github/workflows/build.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7b482251..53b154e8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -37,6 +37,7 @@ jobs: tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.BASE_IMAGE_NAME}}:test platforms: linux/amd64,linux/arm64 file: install/automated/docker/openvk.Dockerfile + load: true build-args: | GITREPO=${{ steps.repositorystring.outputs.lowercase }} @@ -46,6 +47,7 @@ jobs: tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}}:${{env.DB_VERSION}}-primary platforms: linux/amd64,linux/arm64 file: install/automated/docker/mariadb-primary.Dockerfile + load: true build-args: | VERSION=${{env.DB_VERSION}} @@ -55,5 +57,6 @@ jobs: tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}}:${{env.DB_VERSION}}-eventdb platforms: linux/amd64,linux/arm64 file: install/automated/docker/mariadb-eventdb.Dockerfile + load: true build-args: | VERSION=${{env.DB_VERSION}} From 4e8bbebe3da6fcb9d6237043e9e1aac0ec93f213 Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Mon, 4 Nov 2024 00:44:14 +0300 Subject: [PATCH 05/14] ci(actions): add uploading of built images as artifacts --- .github/workflows/build.yaml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 53b154e8..e190eafa 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -37,7 +37,7 @@ jobs: tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.BASE_IMAGE_NAME}}:test platforms: linux/amd64,linux/arm64 file: install/automated/docker/openvk.Dockerfile - load: true + outputs: type=docker,dest=/tmp/openvk.tar build-args: | GITREPO=${{ steps.repositorystring.outputs.lowercase }} @@ -47,7 +47,7 @@ jobs: tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}}:${{env.DB_VERSION}}-primary platforms: linux/amd64,linux/arm64 file: install/automated/docker/mariadb-primary.Dockerfile - load: true + outputs: type=docker,dest=/tmp/mariadb-primary.tar build-args: | VERSION=${{env.DB_VERSION}} @@ -57,6 +57,24 @@ jobs: tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}}:${{env.DB_VERSION}}-eventdb platforms: linux/amd64,linux/arm64 file: install/automated/docker/mariadb-eventdb.Dockerfile - load: true + outputs: type=docker,dest=/tmp/mariadb-eventdb.tar build-args: | VERSION=${{env.DB_VERSION}} + + - name: Upload base image as an artifact + uses: actions/upload-artifact@v4 + with: + name: openvk + path: /tmp/openvk.tar + + - name: Upload MariaDB primary as an artifact + uses: actions/upload-artifact@v4 + with: + name: mariadb-primary + path: /tmp/mariadb-primary.tar + + - name: Upload MariaDB event as an artifact + uses: actions/upload-artifact@v4 + with: + name: mariadb-eventdb + path: /tmp/mariadb-eventdb.tar \ No newline at end of file From 5b985a239a3101861dc25b55b963b3623ca48ee9 Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Mon, 4 Nov 2024 00:48:52 +0300 Subject: [PATCH 06/14] ci(actions): use oci export type --- .github/workflows/build.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e190eafa..5d018da5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -37,7 +37,7 @@ jobs: tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.BASE_IMAGE_NAME}}:test platforms: linux/amd64,linux/arm64 file: install/automated/docker/openvk.Dockerfile - outputs: type=docker,dest=/tmp/openvk.tar + outputs: type=oci,dest=/tmp/openvk.tar build-args: | GITREPO=${{ steps.repositorystring.outputs.lowercase }} @@ -47,7 +47,7 @@ jobs: tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}}:${{env.DB_VERSION}}-primary platforms: linux/amd64,linux/arm64 file: install/automated/docker/mariadb-primary.Dockerfile - outputs: type=docker,dest=/tmp/mariadb-primary.tar + outputs: type=oci,dest=/tmp/mariadb-primary.tar build-args: | VERSION=${{env.DB_VERSION}} @@ -57,7 +57,7 @@ jobs: tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}}:${{env.DB_VERSION}}-eventdb platforms: linux/amd64,linux/arm64 file: install/automated/docker/mariadb-eventdb.Dockerfile - outputs: type=docker,dest=/tmp/mariadb-eventdb.tar + outputs: type=oci,dest=/tmp/mariadb-eventdb.tar build-args: | VERSION=${{env.DB_VERSION}} From 084c1056b68d0a8578b37541fb1de0bfc4bdae04 Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Mon, 4 Nov 2024 12:52:38 +0300 Subject: [PATCH 07/14] ci(actions): try generating metadata with docker/metadata-action@v5 --- .github/workflows/build.yaml | 77 ++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5d018da5..f8c5455b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -28,53 +28,80 @@ jobs: with: string: ${{ github.repository }} + - name: Base image meta + id: basemeta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.BASE_IMAGE_NAME}} + tags: | + type=sha + type=ref,event=branch + type=ref,event=pr + type=ref,event=tag + type=raw,value=latest,enable={{is_default_branch}} + + - name: MariaDB primary meta + id: db-primarymeta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}} + tags: | + type=sha + type=ref,event=branch + type=ref,event=pr + type=ref,event=tag + type=raw,value=,enable={{is_default_branch}} + flavor: | + latest=auto + prefix=${{env.DB_VERSION}}-primary + + - name: MariaDB event meta + id: db-eventmeta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}} + tags: | + type=sha + type=ref,event=branch + type=ref,event=pr + type=ref,event=tag + type=raw,value=,enable={{is_default_branch}} + flavor: | + latest=auto + prefix=${{env.DB_VERSION}}-eventdb- + # - name: Log into registry # run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - name: Build base image uses: docker/build-push-action@v6 with: - tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.BASE_IMAGE_NAME}}:test platforms: linux/amd64,linux/arm64 file: install/automated/docker/openvk.Dockerfile - outputs: type=oci,dest=/tmp/openvk.tar + tags: ${{ steps.basemeta.outputs.tags }} + labels: ${{ steps.basemeta.outputs.labels }} build-args: | GITREPO=${{ steps.repositorystring.outputs.lowercase }} - name: Build MariaDB primary image uses: docker/build-push-action@v6 with: - tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}}:${{env.DB_VERSION}}-primary platforms: linux/amd64,linux/arm64 file: install/automated/docker/mariadb-primary.Dockerfile - outputs: type=oci,dest=/tmp/mariadb-primary.tar + tags: ${{ steps.db-primarymeta.outputs.tags }} + labels: ${{ steps.db-primarymeta.outputs.labels }} build-args: | VERSION=${{env.DB_VERSION}} - name: Build MariaDB event image uses: docker/build-push-action@v6 with: - tags: ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}}:${{env.DB_VERSION}}-eventdb platforms: linux/amd64,linux/arm64 file: install/automated/docker/mariadb-eventdb.Dockerfile - outputs: type=oci,dest=/tmp/mariadb-eventdb.tar + tags: ${{ steps.db-eventmeta.outputs.tags }} + labels: ${{ steps.db-eventmeta.outputs.labels }} build-args: | - VERSION=${{env.DB_VERSION}} - - - name: Upload base image as an artifact - uses: actions/upload-artifact@v4 - with: - name: openvk - path: /tmp/openvk.tar - - - name: Upload MariaDB primary as an artifact - uses: actions/upload-artifact@v4 - with: - name: mariadb-primary - path: /tmp/mariadb-primary.tar - - - name: Upload MariaDB event as an artifact - uses: actions/upload-artifact@v4 - with: - name: mariadb-eventdb - path: /tmp/mariadb-eventdb.tar \ No newline at end of file + VERSION=${{env.DB_VERSION}} \ No newline at end of file From 5d207a8cf80314666cd112e3ea08b803d73ef50a Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Mon, 4 Nov 2024 13:01:01 +0300 Subject: [PATCH 08/14] ci(actions): individual tagging policy fo db images --- .github/workflows/build.yaml | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f8c5455b..bb0f600c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -48,14 +48,11 @@ jobs: images: | ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}} tags: | - type=sha - type=ref,event=branch - type=ref,event=pr - type=ref,event=tag - type=raw,value=,enable={{is_default_branch}} - flavor: | - latest=auto - prefix=${{env.DB_VERSION}}-primary + type=sha,prefix=${{env.DB_VERSION}}-primary- + type=ref,event=branch,prefix=${{env.DB_VERSION}}-primary- + type=ref,event=pr,prefix=${{env.DB_VERSION}}-primary- + type=ref,event=tag,prefix=${{env.DB_VERSION}}-primary- + type=raw,value=${{env.DB_VERSION}}-primary,enable={{is_default_branch}} - name: MariaDB event meta id: db-eventmeta @@ -64,14 +61,11 @@ jobs: images: | ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}} tags: | - type=sha - type=ref,event=branch - type=ref,event=pr - type=ref,event=tag - type=raw,value=,enable={{is_default_branch}} - flavor: | - latest=auto - prefix=${{env.DB_VERSION}}-eventdb- + type=sha,prefix=${{env.DB_VERSION}}-eventdb- + type=ref,event=branch,prefix=${{env.DB_VERSION}}-eventdb- + type=ref,event=pr,prefix=${{env.DB_VERSION}}-eventdb- + type=ref,event=tag,prefix=${{env.DB_VERSION}}-eventdb- + type=raw,value=${{env.DB_VERSION}}-eventdb,enable={{is_default_branch}} # - name: Log into registry # run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin From eae80fe4778b05b76b67acd838521f2c95311d1c Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Mon, 4 Nov 2024 13:06:41 +0300 Subject: [PATCH 09/14] ci(actions): improve prefixes for db images --- .github/workflows/build.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index bb0f600c..7709e499 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -48,9 +48,9 @@ jobs: images: | ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}} tags: | - type=sha,prefix=${{env.DB_VERSION}}-primary- + type=sha,prefix=${{env.DB_VERSION}}-primary-sha- type=ref,event=branch,prefix=${{env.DB_VERSION}}-primary- - type=ref,event=pr,prefix=${{env.DB_VERSION}}-primary- + type=ref,event=pr,prefix=${{env.DB_VERSION}}-primary-pr- type=ref,event=tag,prefix=${{env.DB_VERSION}}-primary- type=raw,value=${{env.DB_VERSION}}-primary,enable={{is_default_branch}} @@ -61,9 +61,9 @@ jobs: images: | ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}} tags: | - type=sha,prefix=${{env.DB_VERSION}}-eventdb- + type=sha,prefix=${{env.DB_VERSION}}-eventdb-sha- type=ref,event=branch,prefix=${{env.DB_VERSION}}-eventdb- - type=ref,event=pr,prefix=${{env.DB_VERSION}}-eventdb- + type=ref,event=pr,prefix=${{env.DB_VERSION}}-eventdb-pr- type=ref,event=tag,prefix=${{env.DB_VERSION}}-eventdb- type=raw,value=${{env.DB_VERSION}}-eventdb,enable={{is_default_branch}} From 981ac4e0819f77e9536426a326326306f8e157b1 Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Mon, 4 Nov 2024 13:19:22 +0300 Subject: [PATCH 10/14] ci: use matrix for different platforms --- .github/workflows/build.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7709e499..fe463509 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,6 +11,10 @@ env: jobs: build: + strategy: + matrix: + platform: [amd64, arm64] + runs-on: ubuntu-latest if: github.event_name == 'push' @@ -73,7 +77,7 @@ jobs: - name: Build base image uses: docker/build-push-action@v6 with: - platforms: linux/amd64,linux/arm64 + platforms: linux/${{matrix.platform}} file: install/automated/docker/openvk.Dockerfile tags: ${{ steps.basemeta.outputs.tags }} labels: ${{ steps.basemeta.outputs.labels }} @@ -83,7 +87,7 @@ jobs: - name: Build MariaDB primary image uses: docker/build-push-action@v6 with: - platforms: linux/amd64,linux/arm64 + platforms: linux/${{matrix.platform}} file: install/automated/docker/mariadb-primary.Dockerfile tags: ${{ steps.db-primarymeta.outputs.tags }} labels: ${{ steps.db-primarymeta.outputs.labels }} @@ -93,7 +97,7 @@ jobs: - name: Build MariaDB event image uses: docker/build-push-action@v6 with: - platforms: linux/amd64,linux/arm64 + platforms: linux/${{matrix.platform}} file: install/automated/docker/mariadb-eventdb.Dockerfile tags: ${{ steps.db-eventmeta.outputs.tags }} labels: ${{ steps.db-eventmeta.outputs.labels }} From 26fdc03e621edb0b8ddabacef9e299a6727aa89a Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Mon, 4 Nov 2024 13:42:03 +0300 Subject: [PATCH 11/14] ci(actions): move DB images building to a different job --- .github/workflows/build.yaml | 49 +++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fe463509..e2209143 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -10,14 +10,14 @@ env: DB_VERSION: "10.9" jobs: - build: + buildbase: + name: Build base images strategy: matrix: platform: [amd64, arm64] runs-on: ubuntu-latest - if: github.event_name == 'push' steps: - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -45,6 +45,41 @@ jobs: type=ref,event=tag type=raw,value=latest,enable={{is_default_branch}} + # - name: Log into registry + # run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Build base image + uses: docker/build-push-action@v6 + with: + platforms: linux/${{matrix.platform}} + file: install/automated/docker/openvk.Dockerfile + tags: ${{ steps.basemeta.outputs.tags }} + labels: ${{ steps.basemeta.outputs.labels }} + build-args: | + GITREPO=${{ steps.repositorystring.outputs.lowercase }} + + builddb: + name: Build DB images + strategy: + matrix: + platform: [amd64, arm64] + + runs-on: ubuntu-latest + + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + + - name: Change repository string to lowercase + id: repositorystring + uses: Entepotenz/change-string-case-action-min-dependencies@v1.1.0 + with: + string: ${{ github.repository }} + - name: MariaDB primary meta id: db-primarymeta uses: docker/metadata-action@v5 @@ -73,16 +108,6 @@ jobs: # - name: Log into registry # run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - - name: Build base image - uses: docker/build-push-action@v6 - with: - platforms: linux/${{matrix.platform}} - file: install/automated/docker/openvk.Dockerfile - tags: ${{ steps.basemeta.outputs.tags }} - labels: ${{ steps.basemeta.outputs.labels }} - build-args: | - GITREPO=${{ steps.repositorystring.outputs.lowercase }} - name: Build MariaDB primary image uses: docker/build-push-action@v6 From ef37241236dc86b156d49b3ec3b5a72a7217a47f Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Mon, 4 Nov 2024 14:01:04 +0300 Subject: [PATCH 12/14] ci(actions): add labels to images --- .github/workflows/build.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e2209143..689cd088 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -38,6 +38,8 @@ jobs: with: images: | ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.BASE_IMAGE_NAME}} + labels: | + org.opencontainers.image.documentation=https://github.com/OpenVK/openvk/blob/master/install/automated/docker/Readme.md tags: | type=sha type=ref,event=branch @@ -57,7 +59,7 @@ jobs: labels: ${{ steps.basemeta.outputs.labels }} build-args: | GITREPO=${{ steps.repositorystring.outputs.lowercase }} - + builddb: name: Build DB images strategy: @@ -86,6 +88,10 @@ jobs: with: images: | ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}} + labels: | + org.opencontainers.image.title=OpenVK MariaDB (Primary) + org.opencontainers.image.description=OpenVK's image for MariaDB for primary database. + org.opencontainers.image.documentation=https://github.com/OpenVK/openvk/blob/master/install/automated/docker/Readme.md tags: | type=sha,prefix=${{env.DB_VERSION}}-primary-sha- type=ref,event=branch,prefix=${{env.DB_VERSION}}-primary- @@ -99,6 +105,10 @@ jobs: with: images: | ghcr.io/${{ steps.repositorystring.outputs.lowercase }}/${{env.DB_IMAGE_NAME}} + labels: | + org.opencontainers.image.title=OpenVK MariaDB (EventDB) + org.opencontainers.image.description=OpenVK's image for MariaDB for event database. + org.opencontainers.image.documentation=https://github.com/OpenVK/openvk/blob/master/install/automated/docker/Readme.md tags: | type=sha,prefix=${{env.DB_VERSION}}-eventdb-sha- type=ref,event=branch,prefix=${{env.DB_VERSION}}-eventdb- From b9e6878a0eeb76d4a1b787cc8fd9664141cb2ca1 Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Mon, 4 Nov 2024 14:15:47 +0300 Subject: [PATCH 13/14] ci(actions): add running on pull_requests --- .github/workflows/build.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 689cd088..9ca4fb2f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,7 +1,6 @@ name: Build images -on: - push: +on: [push, pull_request] env: BASE_IMAGE_NAME: openvk From 7fc51e422baf120a3c4e5ff922e1888305096d65 Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Mon, 4 Nov 2024 14:19:28 +0300 Subject: [PATCH 14/14] ci(actions): return pushing to registry --- .github/workflows/build.yaml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9ca4fb2f..638ba7cd 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -46,8 +46,9 @@ jobs: type=ref,event=tag type=raw,value=latest,enable={{is_default_branch}} - # - name: Log into registry - # run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Log into registry + if: github.event_name != 'pull_request' + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - name: Build base image uses: docker/build-push-action@v6 @@ -56,6 +57,7 @@ jobs: file: install/automated/docker/openvk.Dockerfile tags: ${{ steps.basemeta.outputs.tags }} labels: ${{ steps.basemeta.outputs.labels }} + push: ${{ github.event_name != 'pull_request' }} build-args: | GITREPO=${{ steps.repositorystring.outputs.lowercase }} @@ -115,12 +117,14 @@ jobs: type=ref,event=tag,prefix=${{env.DB_VERSION}}-eventdb- type=raw,value=${{env.DB_VERSION}}-eventdb,enable={{is_default_branch}} - # - name: Log into registry - # run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Log into registry + if: github.event_name != 'pull_request' + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - name: Build MariaDB primary image uses: docker/build-push-action@v6 with: + push: ${{ github.event_name != 'pull_request' }} platforms: linux/${{matrix.platform}} file: install/automated/docker/mariadb-primary.Dockerfile tags: ${{ steps.db-primarymeta.outputs.tags }} @@ -131,6 +135,7 @@ jobs: - name: Build MariaDB event image uses: docker/build-push-action@v6 with: + push: ${{ github.event_name != 'pull_request' }} platforms: linux/${{matrix.platform}} file: install/automated/docker/mariadb-eventdb.Dockerfile tags: ${{ steps.db-eventmeta.outputs.tags }}