From 43734d7c444de7bd57e226253f3ef54f5e2e572c Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 16:38:46 -0600 Subject: [PATCH 01/13] build and push on frouioui for testing Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_lite.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker_build_lite.yml b/.github/workflows/docker_build_lite.yml index 54c2bcb2419..280e52bdbc9 100644 --- a/.github/workflows/docker_build_lite.yml +++ b/.github/workflows/docker_build_lite.yml @@ -58,9 +58,9 @@ jobs: if: startsWith(github.ref, 'refs/tags/') run: | if [[ "${{ matrix.branch }}" == "latest" ]]; then - echo "DOCKER_TAG=vitess/lite:${TAG_NAME}" >> $GITHUB_ENV + echo "DOCKER_TAG=frouioui/lite:${TAG_NAME}" >> $GITHUB_ENV else - echo "DOCKER_TAG=vitess/lite:${TAG_NAME}-${{ matrix.branch }}" >> $GITHUB_ENV + echo "DOCKER_TAG=frouioui/lite:${TAG_NAME}-${{ matrix.branch }}" >> $GITHUB_ENV fi - name: Build and push on main From d27d4b0dab0693231c5ff5608a972b4783a02ffe Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 16:52:18 -0600 Subject: [PATCH 02/13] build and push on frouioui for testing Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_lite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker_build_lite.yml b/.github/workflows/docker_build_lite.yml index 280e52bdbc9..e55fc6219ad 100644 --- a/.github/workflows/docker_build_lite.yml +++ b/.github/workflows/docker_build_lite.yml @@ -48,7 +48,7 @@ jobs: context: . file: ${{ env.DOCKERFILE }} push: true - tags: vitess/lite:${{ matrix.branch }} + tags: frouioui/lite:${{ matrix.branch }} - name: Get the Git tag if: startsWith(github.ref, 'refs/tags/') From e3b20f9f9e297d882ea402955ee89176ec9b9970 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 17:33:13 -0600 Subject: [PATCH 03/13] remove all wip Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_lite.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker_build_lite.yml b/.github/workflows/docker_build_lite.yml index e55fc6219ad..54c2bcb2419 100644 --- a/.github/workflows/docker_build_lite.yml +++ b/.github/workflows/docker_build_lite.yml @@ -48,7 +48,7 @@ jobs: context: . file: ${{ env.DOCKERFILE }} push: true - tags: frouioui/lite:${{ matrix.branch }} + tags: vitess/lite:${{ matrix.branch }} - name: Get the Git tag if: startsWith(github.ref, 'refs/tags/') @@ -58,9 +58,9 @@ jobs: if: startsWith(github.ref, 'refs/tags/') run: | if [[ "${{ matrix.branch }}" == "latest" ]]; then - echo "DOCKER_TAG=frouioui/lite:${TAG_NAME}" >> $GITHUB_ENV + echo "DOCKER_TAG=vitess/lite:${TAG_NAME}" >> $GITHUB_ENV else - echo "DOCKER_TAG=frouioui/lite:${TAG_NAME}-${{ matrix.branch }}" >> $GITHUB_ENV + echo "DOCKER_TAG=vitess/lite:${TAG_NAME}-${{ matrix.branch }}" >> $GITHUB_ENV fi - name: Build and push on main From 3e36d13b0cad4b7dae743b3ba8024d0f9e0ba28a Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 17:43:36 -0600 Subject: [PATCH 04/13] add build base docker image workflow Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_base.yml | 73 +++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/docker_build_base.yml diff --git a/.github/workflows/docker_build_base.yml b/.github/workflows/docker_build_base.yml new file mode 100644 index 00000000000..e4cda66e736 --- /dev/null +++ b/.github/workflows/docker_build_base.yml @@ -0,0 +1,73 @@ +name: Docker Build Base +on: + push: + branches: + - main + tags: + - '*' + +concurrency: + group: format('{0}-{1}', ${{ github.ref }}, 'Docker Build Base') + cancel-in-progress: true + +permissions: read-all + +jobs: + build_and_push_base: + name: Build and push vitess/base Docker images + runs-on: gh-hosted-runners-16cores-1 + if: github.repository == 'vitessio/vitess' + + strategy: + fail-fast: true + matrix: + branch: [ latest, mysql57, percona57, percona80 ] + + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set Dockerfile path + run: | + if [[ "${{ matrix.branch }}" == "latest" ]]; then + echo "DOCKERFILE=./docker/base/Dockerfile" >> $GITHUB_ENV + else + echo "DOCKERFILE=./docker/base/Dockerfile.${{ matrix.branch }}" >> $GITHUB_ENV + fi + + - name: Build and push on main + if: github.ref == 'refs/heads/main' + uses: docker/build-push-action@v5 + with: + context: . + file: ${{ env.DOCKERFILE }} + push: true + tags: vitess/base:${{ matrix.branch }} + + - name: Get the Git tag + if: startsWith(github.ref, 'refs/tags/') + run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - name: Set Docker tag name + if: startsWith(github.ref, 'refs/tags/') + run: | + if [[ "${{ matrix.branch }}" == "latest" ]]; then + echo "DOCKER_TAG=vitess/base:${TAG_NAME}" >> $GITHUB_ENV + else + echo "DOCKER_TAG=vitess/base:${TAG_NAME}-${{ matrix.branch }}" >> $GITHUB_ENV + fi + + - name: Build and push on main + if: startsWith(github.ref, 'refs/tags/') + uses: docker/build-push-action@v5 + with: + context: . + file: ${{ env.DOCKERFILE }} + push: true + tags: ${{ env.DOCKER_TAG }} \ No newline at end of file From c854a79d5ae0b08bac136c73bbd21331f9ae9cd5 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 17:45:09 -0600 Subject: [PATCH 05/13] build and push to frouioui for testing purposes Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_base.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker_build_base.yml b/.github/workflows/docker_build_base.yml index e4cda66e736..d4b8452b88c 100644 --- a/.github/workflows/docker_build_base.yml +++ b/.github/workflows/docker_build_base.yml @@ -48,7 +48,7 @@ jobs: context: . file: ${{ env.DOCKERFILE }} push: true - tags: vitess/base:${{ matrix.branch }} + tags: frouioui/base:${{ matrix.branch }} - name: Get the Git tag if: startsWith(github.ref, 'refs/tags/') @@ -58,9 +58,9 @@ jobs: if: startsWith(github.ref, 'refs/tags/') run: | if [[ "${{ matrix.branch }}" == "latest" ]]; then - echo "DOCKER_TAG=vitess/base:${TAG_NAME}" >> $GITHUB_ENV + echo "DOCKER_TAG=frouioui/base:${TAG_NAME}" >> $GITHUB_ENV else - echo "DOCKER_TAG=vitess/base:${TAG_NAME}-${{ matrix.branch }}" >> $GITHUB_ENV + echo "DOCKER_TAG=frouioui/base:${TAG_NAME}-${{ matrix.branch }}" >> $GITHUB_ENV fi - name: Build and push on main From ddb040b19c6d1b553ad3d43db8bee803b9cdf404 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 17:49:10 -0600 Subject: [PATCH 06/13] run workflow on ubuntu for testing Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_base.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker_build_base.yml b/.github/workflows/docker_build_base.yml index d4b8452b88c..14b970d4fc2 100644 --- a/.github/workflows/docker_build_base.yml +++ b/.github/workflows/docker_build_base.yml @@ -15,7 +15,7 @@ permissions: read-all jobs: build_and_push_base: name: Build and push vitess/base Docker images - runs-on: gh-hosted-runners-16cores-1 + runs-on: ubuntu-latest if: github.repository == 'vitessio/vitess' strategy: From 3d72c8dd1be6c0ac951c907772faa2468b4dde2d Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 17:56:58 -0600 Subject: [PATCH 07/13] wip testing Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_base.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker_build_base.yml b/.github/workflows/docker_build_base.yml index 14b970d4fc2..68cf23b808b 100644 --- a/.github/workflows/docker_build_base.yml +++ b/.github/workflows/docker_build_base.yml @@ -16,7 +16,7 @@ jobs: build_and_push_base: name: Build and push vitess/base Docker images runs-on: ubuntu-latest - if: github.repository == 'vitessio/vitess' +# if: github.repository == 'vitessio/vitess' strategy: fail-fast: true From 1b31c113ab8b48b0955960acf172ba305d698530 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 18:17:54 -0600 Subject: [PATCH 08/13] fix typo and build only latest on tag for base Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_base.yml | 8 +++----- .github/workflows/docker_build_lite.yml | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker_build_base.yml b/.github/workflows/docker_build_base.yml index 68cf23b808b..386b0e84a77 100644 --- a/.github/workflows/docker_build_base.yml +++ b/.github/workflows/docker_build_base.yml @@ -55,16 +55,14 @@ jobs: run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - name: Set Docker tag name - if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') && matrix.branch == "latest" run: | if [[ "${{ matrix.branch }}" == "latest" ]]; then echo "DOCKER_TAG=frouioui/base:${TAG_NAME}" >> $GITHUB_ENV - else - echo "DOCKER_TAG=frouioui/base:${TAG_NAME}-${{ matrix.branch }}" >> $GITHUB_ENV fi - - name: Build and push on main - if: startsWith(github.ref, 'refs/tags/') + - name: Build and push on tags + if: startsWith(github.ref, 'refs/tags/') && matrix.branch == "latest" uses: docker/build-push-action@v5 with: context: . diff --git a/.github/workflows/docker_build_lite.yml b/.github/workflows/docker_build_lite.yml index 54c2bcb2419..7f355ddfd32 100644 --- a/.github/workflows/docker_build_lite.yml +++ b/.github/workflows/docker_build_lite.yml @@ -63,7 +63,7 @@ jobs: echo "DOCKER_TAG=vitess/lite:${TAG_NAME}-${{ matrix.branch }}" >> $GITHUB_ENV fi - - name: Build and push on main + - name: Build and push on tags if: startsWith(github.ref, 'refs/tags/') uses: docker/build-push-action@v5 with: From 857286dd9da8826bbe72e7809990522823510704 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 18:20:03 -0600 Subject: [PATCH 09/13] use simple quote instead of double Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_base.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker_build_base.yml b/.github/workflows/docker_build_base.yml index 386b0e84a77..ec917f8ff8f 100644 --- a/.github/workflows/docker_build_base.yml +++ b/.github/workflows/docker_build_base.yml @@ -55,14 +55,14 @@ jobs: run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - name: Set Docker tag name - if: startsWith(github.ref, 'refs/tags/') && matrix.branch == "latest" + if: startsWith(github.ref, 'refs/tags/') && matrix.branch == 'latest' run: | if [[ "${{ matrix.branch }}" == "latest" ]]; then echo "DOCKER_TAG=frouioui/base:${TAG_NAME}" >> $GITHUB_ENV fi - name: Build and push on tags - if: startsWith(github.ref, 'refs/tags/') && matrix.branch == "latest" + if: startsWith(github.ref, 'refs/tags/') && matrix.branch == 'latest' uses: docker/build-push-action@v5 with: context: . From 02a2d1a3fac03254c0c82755ac4bb92a4f601f07 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Tue, 17 Oct 2023 17:31:31 -0600 Subject: [PATCH 10/13] Build vitess component docker images Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_base.yml | 81 ++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker_build_base.yml b/.github/workflows/docker_build_base.yml index ec917f8ff8f..d77ab33d7df 100644 --- a/.github/workflows/docker_build_base.yml +++ b/.github/workflows/docker_build_base.yml @@ -15,7 +15,7 @@ permissions: read-all jobs: build_and_push_base: name: Build and push vitess/base Docker images - runs-on: ubuntu-latest + runs-on: ubuntu-latest # TODO: use larger runner when testing is done # if: github.repository == 'vitessio/vitess' strategy: @@ -68,4 +68,81 @@ jobs: context: . file: ${{ env.DOCKERFILE }} push: true - tags: ${{ env.DOCKER_TAG }} \ No newline at end of file + tags: ${{ env.DOCKER_TAG }} + + + build_and_push_components: + name: Build and push vitess components Docker images + runs-on: ubuntu-latest # TODO: use larger runner when testing is done + # if: github.repository == 'vitessio/vitess' + + strategy: + fail-fast: true + matrix: + debian: [ bullseye, bookworm ] + component: [ k8s, vtadmin, vtorc, vtgate, vttablet, mysqlctld, mysqlctl, vtctl, vtctlclient, vtctld, logrotate, logtail ] + + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + # Build and Push component image to tag "latest" if branch=main and debian=bookworm + - name: Build and push on main Bookworm (default) + if: github.ref == 'refs/heads/main' && matrix.debian == 'bookworm' + uses: docker/build-push-action@v5 + with: + context: docker/${{ matrix.component }} + push: true + tags: frouioui/${{ matrix.component }}:latest + + # Build and Push component image to tag "latest-bullseye" if branch=main and debian=bullseye + - name: Build and push on main Bullseye + if: github.ref == 'refs/heads/main' && matrix.debian == 'bullseye' + uses: docker/build-push-action@v5 + with: + context: docker/${{ matrix.component }} + push: true + tags: frouioui/${{ matrix.component }}:latest-bullseye + + ###### + # All code below only applies to new tags + ###### + + - name: Get the Git tag + if: startsWith(github.ref, 'refs/tags/') + run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + # We push git-tag-based images to three tags, i.e. for 'v19.0.0' we push to: + # vitess/${{ matrix.component }}:v19.0.0 + # vitess/${{ matrix.component }}:v19.0.0-bookworm + # vitess/${{ matrix.component }}:v19.0.0-bullseye + - name: Set Docker tag name + if: startsWith(github.ref, 'refs/tags/') + run: | + echo "DOCKER_TAG=frouioui/${{ matrix.component }}:${TAG_NAME}-${{ matrix.debian }}" >> $GITHUB_ENV + echo "DOCKER_TAG_DEFAULT_DEBIAN=frouioui/${{ matrix.component }}:${TAG_NAME}" >> $GITHUB_ENV + + # Build and Push component image to DOCKER_TAG, applies to both debian version + - name: Build and push on tags using Debian extension + if: startsWith(github.ref, 'refs/tags/') + uses: docker/build-push-action@v5 + with: + context: docker/${{ matrix.component }} + push: true + tags: ${{ env.DOCKER_TAG }} + + # Build and Push component image to DOCKER_TAG_DEFAULT_DEBIAN, only applies when building the default Debian version (bookworm) + # It is fine to build a second time here when "matrix.debian == 'bookworm'" as we have cached the first build already + - name: Build and push on tags without Debian extension + if: startsWith(github.ref, 'refs/tags/') && matrix.debian == 'bookworm' + uses: docker/build-push-action@v5 + with: + context: docker/${{ matrix.component }} + push: true + tags: ${{ env.DOCKER_TAG_DEFAULT_DEBIAN }} \ No newline at end of file From aabe3cf00f214a757243b13084e208c0fff1ee9c Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Tue, 17 Oct 2023 17:41:58 -0600 Subject: [PATCH 11/13] use proper docker context path Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_base.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker_build_base.yml b/.github/workflows/docker_build_base.yml index d77ab33d7df..8439841820d 100644 --- a/.github/workflows/docker_build_base.yml +++ b/.github/workflows/docker_build_base.yml @@ -72,6 +72,7 @@ jobs: build_and_push_components: + needs: build_and_push_base name: Build and push vitess components Docker images runs-on: ubuntu-latest # TODO: use larger runner when testing is done # if: github.repository == 'vitessio/vitess' @@ -92,12 +93,20 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set Docker context path + run: | + if [[ "${{ matrix.component }}" == "k8s" ]]; then + echo "DOCKER_CTX=./docker/k8s" >> $GITHUB_ENV + else + echo "DOCKER_CTX=./docker/k8s/${{ matrix.component }}" >> $GITHUB_ENV + fi + # Build and Push component image to tag "latest" if branch=main and debian=bookworm - name: Build and push on main Bookworm (default) if: github.ref == 'refs/heads/main' && matrix.debian == 'bookworm' uses: docker/build-push-action@v5 with: - context: docker/${{ matrix.component }} + context: ${{ env.DOCKER_CTX }} push: true tags: frouioui/${{ matrix.component }}:latest @@ -106,7 +115,7 @@ jobs: if: github.ref == 'refs/heads/main' && matrix.debian == 'bullseye' uses: docker/build-push-action@v5 with: - context: docker/${{ matrix.component }} + context: ${{ env.DOCKER_CTX }} push: true tags: frouioui/${{ matrix.component }}:latest-bullseye @@ -133,7 +142,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') uses: docker/build-push-action@v5 with: - context: docker/${{ matrix.component }} + context: ${{ env.DOCKER_CTX }} push: true tags: ${{ env.DOCKER_TAG }} @@ -143,6 +152,6 @@ jobs: if: startsWith(github.ref, 'refs/tags/') && matrix.debian == 'bookworm' uses: docker/build-push-action@v5 with: - context: docker/${{ matrix.component }} + context: ${{ env.DOCKER_CTX }} push: true tags: ${{ env.DOCKER_TAG_DEFAULT_DEBIAN }} \ No newline at end of file From 89a78f505daa5a3b5a9ddf79ce77920aa4d28cd9 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Tue, 17 Oct 2023 17:59:54 -0600 Subject: [PATCH 12/13] add one more job to build k8s between base and other components Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_base.yml | 140 +++++++++++++++++++++--- 1 file changed, 122 insertions(+), 18 deletions(-) diff --git a/.github/workflows/docker_build_base.yml b/.github/workflows/docker_build_base.yml index 8439841820d..85a3e7c6133 100644 --- a/.github/workflows/docker_build_base.yml +++ b/.github/workflows/docker_build_base.yml @@ -50,6 +50,10 @@ jobs: push: true tags: frouioui/base:${{ matrix.branch }} + ###### + # All code below only applies to new tags + ###### + - name: Get the Git tag if: startsWith(github.ref, 'refs/tags/') run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV @@ -70,9 +74,101 @@ jobs: push: true tags: ${{ env.DOCKER_TAG }} + build_and_push_k8s: + needs: build_and_push_base + name: Build and push vitess/k8s image + runs-on: ubuntu-latest # TODO: use larger runner when testing is done + # if: github.repository == 'vitessio/vitess' + + strategy: + fail-fast: true + matrix: + debian: [ bullseye, bookworm ] + + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set Docker context path + run: | + echo "DOCKER_CTX=./docker/k8s" >> $GITHUB_ENV + + - name: Build and push on main latest tag + if: github.ref == 'refs/heads/main' && matrix.debian == 'bookworm' + uses: docker/build-push-action@v5 + with: + context: ${{ env.DOCKER_CTX }} + push: true + tags: frouioui/k8s:latest + build-args: + VT_BASE_VER: latest + DEBIAN_VER: ${{ matrix.debian }}-slim + + - name: Build and push on main debian specific tag + if: github.ref == 'refs/heads/main' + uses: docker/build-push-action@v5 + with: + context: ${{ env.DOCKER_CTX }} + push: true + tags: frouioui/k8s:latest-${{ matrix.debian }} + build-args: + VT_BASE_VER: latest + DEBIAN_VER: ${{ matrix.debian }}-slim + + ###### + # All code below only applies to new tags + ###### + + - name: Get the Git tag + if: startsWith(github.ref, 'refs/tags/') + run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + # We push git-tag-based k8s image to three tags, i.e. for 'v19.0.0' we push to: + # + # vitess/k8s:v19.0.0 (DOCKER_TAG_DEFAULT_DEBIAN) + # vitess/k8s:v19.0.0-bookworm (DOCKER_TAG) + # vitess/k8s:v19.0.0-bullseye (DOCKER_TAG) + # + - name: Set Docker tag name + if: startsWith(github.ref, 'refs/tags/') + run: | + echo "DOCKER_TAG_DEFAULT_DEBIAN=frouioui/k8s:${TAG_NAME}" >> $GITHUB_ENV + echo "DOCKER_TAG=frouioui/k8s:${TAG_NAME}-${{ matrix.debian }}" >> $GITHUB_ENV + + # Build and Push component image to DOCKER_TAG, applies to both debian version + - name: Build and push on tags using Debian extension + if: startsWith(github.ref, 'refs/tags/') + uses: docker/build-push-action@v5 + with: + context: ${{ env.DOCKER_CTX }} + push: true + tags: ${{ env.DOCKER_TAG }} + build-args: + VT_BASE_VER: ${TAG_NAME} + DEBIAN_VER: ${{ matrix.debian }}-slim + + # Build and Push component image to DOCKER_TAG_DEFAULT_DEBIAN, only applies when building the default Debian version (bookworm) + # It is fine to build a second time here when "matrix.debian == 'bookworm'" as we have cached the first build already + - name: Build and push on tags without Debian extension + if: startsWith(github.ref, 'refs/tags/') && matrix.debian == 'bookworm' + uses: docker/build-push-action@v5 + with: + context: ${{ env.DOCKER_CTX }} + push: true + tags: ${{ env.DOCKER_TAG_DEFAULT_DEBIAN }} + build-args: + VT_BASE_VER: ${TAG_NAME} + DEBIAN_VER: ${{ matrix.debian }}-slim + build_and_push_components: - needs: build_and_push_base + needs: build_and_push_k8s name: Build and push vitess components Docker images runs-on: ubuntu-latest # TODO: use larger runner when testing is done # if: github.repository == 'vitessio/vitess' @@ -81,7 +177,7 @@ jobs: fail-fast: true matrix: debian: [ bullseye, bookworm ] - component: [ k8s, vtadmin, vtorc, vtgate, vttablet, mysqlctld, mysqlctl, vtctl, vtctlclient, vtctld, logrotate, logtail ] + component: [ vtadmin, vtorc, vtgate, vttablet, mysqlctld, mysqlctl, vtctl, vtctlclient, vtctld, logrotate, logtail ] steps: - name: Check out code @@ -95,29 +191,29 @@ jobs: - name: Set Docker context path run: | - if [[ "${{ matrix.component }}" == "k8s" ]]; then - echo "DOCKER_CTX=./docker/k8s" >> $GITHUB_ENV - else - echo "DOCKER_CTX=./docker/k8s/${{ matrix.component }}" >> $GITHUB_ENV - fi + echo "DOCKER_CTX=./docker/k8s/${{ matrix.component }}" >> $GITHUB_ENV - # Build and Push component image to tag "latest" if branch=main and debian=bookworm - - name: Build and push on main Bookworm (default) + - name: Build and push on main latest tag if: github.ref == 'refs/heads/main' && matrix.debian == 'bookworm' uses: docker/build-push-action@v5 with: context: ${{ env.DOCKER_CTX }} push: true tags: frouioui/${{ matrix.component }}:latest + build-args: + VT_BASE_VER: latest + DEBIAN_VER: ${{ matrix.debian }}-slim - # Build and Push component image to tag "latest-bullseye" if branch=main and debian=bullseye - - name: Build and push on main Bullseye - if: github.ref == 'refs/heads/main' && matrix.debian == 'bullseye' + - name: Build and push on main debian specific tag + if: github.ref == 'refs/heads/main' uses: docker/build-push-action@v5 with: context: ${{ env.DOCKER_CTX }} push: true - tags: frouioui/${{ matrix.component }}:latest-bullseye + tags: frouioui/${{ matrix.component }}:latest-${{ matrix.debian }} + build-args: + VT_BASE_VER: latest + DEBIAN_VER: ${{ matrix.debian }}-slim ###### # All code below only applies to new tags @@ -128,14 +224,16 @@ jobs: run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV # We push git-tag-based images to three tags, i.e. for 'v19.0.0' we push to: - # vitess/${{ matrix.component }}:v19.0.0 - # vitess/${{ matrix.component }}:v19.0.0-bookworm - # vitess/${{ matrix.component }}:v19.0.0-bullseye + # + # vitess/${{ matrix.component }}:v19.0.0 (DOCKER_TAG_DEFAULT_DEBIAN) + # vitess/${{ matrix.component }}:v19.0.0-bookworm (DOCKER_TAG) + # vitess/${{ matrix.component }}:v19.0.0-bullseye (DOCKER_TAG) + # - name: Set Docker tag name if: startsWith(github.ref, 'refs/tags/') run: | - echo "DOCKER_TAG=frouioui/${{ matrix.component }}:${TAG_NAME}-${{ matrix.debian }}" >> $GITHUB_ENV echo "DOCKER_TAG_DEFAULT_DEBIAN=frouioui/${{ matrix.component }}:${TAG_NAME}" >> $GITHUB_ENV + echo "DOCKER_TAG=frouioui/${{ matrix.component }}:${TAG_NAME}-${{ matrix.debian }}" >> $GITHUB_ENV # Build and Push component image to DOCKER_TAG, applies to both debian version - name: Build and push on tags using Debian extension @@ -145,6 +243,9 @@ jobs: context: ${{ env.DOCKER_CTX }} push: true tags: ${{ env.DOCKER_TAG }} + build-args: + VT_BASE_VER: ${TAG_NAME} + DEBIAN_VER: ${{ matrix.debian }}-slim # Build and Push component image to DOCKER_TAG_DEFAULT_DEBIAN, only applies when building the default Debian version (bookworm) # It is fine to build a second time here when "matrix.debian == 'bookworm'" as we have cached the first build already @@ -154,4 +255,7 @@ jobs: with: context: ${{ env.DOCKER_CTX }} push: true - tags: ${{ env.DOCKER_TAG_DEFAULT_DEBIAN }} \ No newline at end of file + tags: ${{ env.DOCKER_TAG_DEFAULT_DEBIAN }} + build-args: + VT_BASE_VER: ${TAG_NAME} + DEBIAN_VER: ${{ matrix.debian }}-slim \ No newline at end of file From 024b981065a038f9d88ecd6801dd45c2e7262add Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Tue, 17 Oct 2023 18:03:54 -0600 Subject: [PATCH 13/13] fix yaml syntax Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_base.yml | 32 ++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/docker_build_base.yml b/.github/workflows/docker_build_base.yml index 85a3e7c6133..5089636abf1 100644 --- a/.github/workflows/docker_build_base.yml +++ b/.github/workflows/docker_build_base.yml @@ -107,8 +107,8 @@ jobs: push: true tags: frouioui/k8s:latest build-args: - VT_BASE_VER: latest - DEBIAN_VER: ${{ matrix.debian }}-slim + - VT_BASE_VER=latest + - DEBIAN_VER=${{ matrix.debian }}-slim - name: Build and push on main debian specific tag if: github.ref == 'refs/heads/main' @@ -118,8 +118,8 @@ jobs: push: true tags: frouioui/k8s:latest-${{ matrix.debian }} build-args: - VT_BASE_VER: latest - DEBIAN_VER: ${{ matrix.debian }}-slim + - VT_BASE_VER=latest + - DEBIAN_VER=${{ matrix.debian }}-slim ###### # All code below only applies to new tags @@ -150,8 +150,8 @@ jobs: push: true tags: ${{ env.DOCKER_TAG }} build-args: - VT_BASE_VER: ${TAG_NAME} - DEBIAN_VER: ${{ matrix.debian }}-slim + - VT_BASE_VER=${TAG_NAME} + - DEBIAN_VER=${{ matrix.debian }}-slim # Build and Push component image to DOCKER_TAG_DEFAULT_DEBIAN, only applies when building the default Debian version (bookworm) # It is fine to build a second time here when "matrix.debian == 'bookworm'" as we have cached the first build already @@ -163,8 +163,8 @@ jobs: push: true tags: ${{ env.DOCKER_TAG_DEFAULT_DEBIAN }} build-args: - VT_BASE_VER: ${TAG_NAME} - DEBIAN_VER: ${{ matrix.debian }}-slim + - VT_BASE_VER=${TAG_NAME} + - DEBIAN_VER=${{ matrix.debian }}-slim build_and_push_components: @@ -201,8 +201,8 @@ jobs: push: true tags: frouioui/${{ matrix.component }}:latest build-args: - VT_BASE_VER: latest - DEBIAN_VER: ${{ matrix.debian }}-slim + - VT_BASE_VER=latest + - DEBIAN_VER=${{ matrix.debian }}-slim - name: Build and push on main debian specific tag if: github.ref == 'refs/heads/main' @@ -212,8 +212,8 @@ jobs: push: true tags: frouioui/${{ matrix.component }}:latest-${{ matrix.debian }} build-args: - VT_BASE_VER: latest - DEBIAN_VER: ${{ matrix.debian }}-slim + - VT_BASE_VER=latest + - DEBIAN_VER=${{ matrix.debian }}-slim ###### # All code below only applies to new tags @@ -244,8 +244,8 @@ jobs: push: true tags: ${{ env.DOCKER_TAG }} build-args: - VT_BASE_VER: ${TAG_NAME} - DEBIAN_VER: ${{ matrix.debian }}-slim + - VT_BASE_VER=${TAG_NAME} + - DEBIAN_VER=${{ matrix.debian }}-slim # Build and Push component image to DOCKER_TAG_DEFAULT_DEBIAN, only applies when building the default Debian version (bookworm) # It is fine to build a second time here when "matrix.debian == 'bookworm'" as we have cached the first build already @@ -257,5 +257,5 @@ jobs: push: true tags: ${{ env.DOCKER_TAG_DEFAULT_DEBIAN }} build-args: - VT_BASE_VER: ${TAG_NAME} - DEBIAN_VER: ${{ matrix.debian }}-slim \ No newline at end of file + - VT_BASE_VER=${TAG_NAME} + - DEBIAN_VER=${{ matrix.debian }}-slim \ No newline at end of file