From 43734d7c444de7bd57e226253f3ef54f5e2e572c Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 16:38:46 -0600 Subject: [PATCH 01/10] 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/10] 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/10] 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/10] 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/10] 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/10] 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/10] 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/10] 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/10] 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/10] 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