From cb6d64c2b9f35b77e277c700d31f6f972c714e07 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Tue, 10 Oct 2023 19:38:14 -0600 Subject: [PATCH 01/11] Build and push lite image to dockerhub from GitHub actions Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_lite.yml | 48 +++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/docker_build_lite.yml diff --git a/.github/workflows/docker_build_lite.yml b/.github/workflows/docker_build_lite.yml new file mode 100644 index 00000000000..3abc92a13b3 --- /dev/null +++ b/.github/workflows/docker_build_lite.yml @@ -0,0 +1,48 @@ +name: Docker Build Lite +on: + push: + branches: + - main + tags: + - '*' + +concurrency: + group: format('{0}-{1}', ${{ github.ref }}, 'Docker Build Lite') + cancel-in-progress: true + +permissions: read-all + +jobs: + build_and_push: + name: Build and push vitess/lite Docker images + runs-on: gh-hosted-runners-16cores-1 + if: github.repository == 'vitessio/vitess' + + strategy: + fail-fast: true + matrix: + branch: [ latest, mysql57, mysql80, percona57, percona80 ] + + steps: + - name: Check out code + uses: actions/checkout@v3 + with: + ref: ${{ matrix.branch }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + +# - name: Build and push +# uses: docker/build-push-action@v5 +# with: +# push: true +# tags: vitess/lite:$$matrix \ No newline at end of file From c76211e049b1df24d365a6cdcfd43a1f37dffd46 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Wed, 11 Oct 2023 18:10:33 -0600 Subject: [PATCH 02/11] Build and push lite image Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_lite.yml | 28 ++++++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker_build_lite.yml b/.github/workflows/docker_build_lite.yml index 3abc92a13b3..c3834dd8fe1 100644 --- a/.github/workflows/docker_build_lite.yml +++ b/.github/workflows/docker_build_lite.yml @@ -15,7 +15,7 @@ permissions: read-all jobs: build_and_push: name: Build and push vitess/lite Docker images - runs-on: gh-hosted-runners-16cores-1 + runs-on: ubuntu-latest # TODO: replace by larger runners if: github.repository == 'vitessio/vitess' strategy: @@ -26,8 +26,6 @@ jobs: steps: - name: Check out code uses: actions/checkout@v3 - with: - ref: ${{ matrix.branch }} - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -41,8 +39,22 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} -# - name: Build and push -# uses: docker/build-push-action@v5 -# with: -# push: true -# tags: vitess/lite:$$matrix \ No newline at end of file + - name: Build and push on main + if: github.ref == 'refs/heads/main' + uses: docker/build-push-action@v5 + with: + file: ${{ (matrix.branch == 'latest') && './docker/lite/Dockerfile' || './docker/lite/Dockerfile.' + matrix.branch }} + push: true + tags: vitess/lite:${{ matrix.branch }} + + - name: Get the tag name + if: startsWith(github.ref, 'refs/tags/') + run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - name: Build and push on main + if: startsWith(github.ref, 'refs/tags/') + uses: docker/build-push-action@v5 + with: + file: ${{ (matrix.branch == 'latest') && './docker/lite/Dockerfile' || './docker/lite/Dockerfile.' + matrix.branch }} + push: true + tags: ${{ (matrix.branch == 'latest') && 'vitess/lite:' + env.TAG_NAME || 'vitess/lite:' + env.TAG_NAME + '-' + matrix.branch }} \ No newline at end of file From 54946012d91821d4bed38176dcf08fadc5c5c6d0 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Wed, 11 Oct 2023 18:15:26 -0600 Subject: [PATCH 03/11] Fix conditional syntax 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 c3834dd8fe1..6f661f0746c 100644 --- a/.github/workflows/docker_build_lite.yml +++ b/.github/workflows/docker_build_lite.yml @@ -43,7 +43,7 @@ jobs: if: github.ref == 'refs/heads/main' uses: docker/build-push-action@v5 with: - file: ${{ (matrix.branch == 'latest') && './docker/lite/Dockerfile' || './docker/lite/Dockerfile.' + matrix.branch }} + file: ${{ (matrix.branch == 'latest') && './docker/lite/Dockerfile' || './docker/lite/Dockerfile.' matrix.branch }} push: true tags: vitess/lite:${{ matrix.branch }} @@ -55,6 +55,6 @@ jobs: if: startsWith(github.ref, 'refs/tags/') uses: docker/build-push-action@v5 with: - file: ${{ (matrix.branch == 'latest') && './docker/lite/Dockerfile' || './docker/lite/Dockerfile.' + matrix.branch }} + file: ${{ (matrix.branch == 'latest') && './docker/lite/Dockerfile' || './docker/lite/Dockerfile.' matrix.branch }} push: true - tags: ${{ (matrix.branch == 'latest') && 'vitess/lite:' + env.TAG_NAME || 'vitess/lite:' + env.TAG_NAME + '-' + matrix.branch }} \ No newline at end of file + tags: ${{ (matrix.branch == 'latest' && 'vitess/lite:' env.TAG_NAME) || ('vitess/lite:' env.TAG_NAME '-' matrix.branch) }} \ No newline at end of file From ed7b51b5aec31a17026ca3f4d5636e9214318a3d Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Wed, 11 Oct 2023 18:28:49 -0600 Subject: [PATCH 04/11] remove conditional and set Dockerfile + Docker Tag ahead of time Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_lite.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker_build_lite.yml b/.github/workflows/docker_build_lite.yml index 6f661f0746c..afef29c5a88 100644 --- a/.github/workflows/docker_build_lite.yml +++ b/.github/workflows/docker_build_lite.yml @@ -39,22 +39,39 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set Dockerfile path + run: | + if [[ "${{ matrix.branch }}" == "latest" ]]; then + echo "DOCKERFILE=./docker/lite/Dockerfile" >> $GITHUB_ENV + else + echo "DOCKERFILE=./docker/lite/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: - file: ${{ (matrix.branch == 'latest') && './docker/lite/Dockerfile' || './docker/lite/Dockerfile.' matrix.branch }} + file: ${{ env.DOCKERFILE }} push: true tags: vitess/lite:${{ matrix.branch }} - - name: Get the tag name + - 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/lite:${TAG_NAME}" >> $GITHUB_ENV + else + echo "DOCKER_TAG=vitess/lite:${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: - file: ${{ (matrix.branch == 'latest') && './docker/lite/Dockerfile' || './docker/lite/Dockerfile.' matrix.branch }} + file: ${{ env.DOCKERFILE }} push: true - tags: ${{ (matrix.branch == 'latest' && 'vitess/lite:' env.TAG_NAME) || ('vitess/lite:' env.TAG_NAME '-' matrix.branch) }} \ No newline at end of file + tags: ${{ env.DOCKER_TAG }} \ No newline at end of file From 7445bf92bf056be6fdc8c3ca04a94373f04ebb1b Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 14:50:13 -0600 Subject: [PATCH 05/11] wip allow the workflow to run on any repository for test purposes 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 afef29c5a88..ffaff1532dd 100644 --- a/.github/workflows/docker_build_lite.yml +++ b/.github/workflows/docker_build_lite.yml @@ -16,7 +16,7 @@ jobs: build_and_push: name: Build and push vitess/lite Docker images runs-on: ubuntu-latest # TODO: replace by larger runners - if: github.repository == 'vitessio/vitess' + #TODO: uncomment: if: github.repository == 'vitessio/vitess' strategy: fail-fast: true From c84167f52d031be6fca0baf4733dc5bad07b6500 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 15:08:16 -0600 Subject: [PATCH 06/11] Remove unwanted double git checkout Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_lite.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/docker_build_lite.yml b/.github/workflows/docker_build_lite.yml index ffaff1532dd..ced2dd26fb0 100644 --- a/.github/workflows/docker_build_lite.yml +++ b/.github/workflows/docker_build_lite.yml @@ -24,9 +24,6 @@ jobs: branch: [ latest, mysql57, mysql80, percona57, percona80 ] steps: - - name: Check out code - uses: actions/checkout@v3 - - name: Set up QEMU uses: docker/setup-qemu-action@v3 From 6fe4e6192a5b993c2d243d12b83ab6bbee51b8f0 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 15:26:31 -0600 Subject: [PATCH 07/11] remove unrequired steps in workflow Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_lite.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/docker_build_lite.yml b/.github/workflows/docker_build_lite.yml index ced2dd26fb0..3ee1733f909 100644 --- a/.github/workflows/docker_build_lite.yml +++ b/.github/workflows/docker_build_lite.yml @@ -24,12 +24,6 @@ jobs: branch: [ latest, mysql57, mysql80, percona57, percona80 ] steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: From 62efe558c30d64e260c97a00995dbe2ad4a5893b Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 15:33:23 -0600 Subject: [PATCH 08/11] checkout and use proper context Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_lite.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/docker_build_lite.yml b/.github/workflows/docker_build_lite.yml index 3ee1733f909..e8b75c4610d 100644 --- a/.github/workflows/docker_build_lite.yml +++ b/.github/workflows/docker_build_lite.yml @@ -24,6 +24,9 @@ jobs: branch: [ latest, mysql57, mysql80, percona57, percona80 ] steps: + - name: Check out code + uses: actions/checkout@v3 + - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -42,6 +45,7 @@ jobs: if: github.ref == 'refs/heads/main' uses: docker/build-push-action@v5 with: + context: . file: ${{ env.DOCKERFILE }} push: true tags: vitess/lite:${{ matrix.branch }} @@ -63,6 +67,7 @@ jobs: 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 fb0ead1b296beb4261e90c13edfc1a7ed2c036be Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 16:38:46 -0600 Subject: [PATCH 09/11] 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 e8b75c4610d..ea332a87b92 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 9c758aef519115a2bd7516e363ae320dd929c69d Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 16:52:18 -0600 Subject: [PATCH 10/11] 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 ea332a87b92..4d066107736 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 bbde6f89ed8e37d0b1b72af163223bc86b0d7b9a Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 12 Oct 2023 17:33:13 -0600 Subject: [PATCH 11/11] remove all wip Signed-off-by: Florent Poinsard --- .github/workflows/docker_build_lite.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker_build_lite.yml b/.github/workflows/docker_build_lite.yml index 4d066107736..54c2bcb2419 100644 --- a/.github/workflows/docker_build_lite.yml +++ b/.github/workflows/docker_build_lite.yml @@ -15,8 +15,8 @@ permissions: read-all jobs: build_and_push: name: Build and push vitess/lite Docker images - runs-on: ubuntu-latest # TODO: replace by larger runners - #TODO: uncomment: if: github.repository == 'vitessio/vitess' + runs-on: gh-hosted-runners-16cores-1 + if: github.repository == 'vitessio/vitess' strategy: fail-fast: true @@ -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