From 10087afc3fb0413daf93c51a9d1abae6fc3d0fe3 Mon Sep 17 00:00:00 2001 From: Spoffy Date: Mon, 1 Jul 2024 20:34:05 +0100 Subject: [PATCH 01/12] Makes EE be separately built and pushed --- .github/workflows/docker_latest.yml | 16 ++++++++++++---- buildtools/.grist-ee-version | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker_latest.yml b/.github/workflows/docker_latest.yml index 01abfd84e3..b4492bc624 100644 --- a/.github/workflows/docker_latest.yml +++ b/.github/workflows/docker_latest.yml @@ -32,10 +32,6 @@ jobs: repo: "grist-core" - name: "grist" repo: "grist-ee" - # For now, we build it twice, with `grist-ee` being a - # backwards-compatible synonym for `grist`. - - name: "grist-ee" - repo: "grist-ee" steps: - name: Check out the repo uses: actions/checkout@v2 @@ -109,6 +105,18 @@ jobs: cache-to: type=gha,mode=max build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }} + - name: Push Enterprise to Docker Hub + if: ${{ matrix.image.name == 'grist' }} + uses: docker/build-push-action@v2 + with: + context: . + file: ext/Dockerfile + platforms: linux/amd64,linux/arm64/v8 + push: true + tags: ${{ github.repository_owner }}/${{ matrix.image.name }}:experimental + cache-from: type=gha + cache-to: type=gha,mode=max + update_latest_branch: name: Update latest branch runs-on: ubuntu-latest diff --git a/buildtools/.grist-ee-version b/buildtools/.grist-ee-version index 2003b639c4..965065db5b 100644 --- a/buildtools/.grist-ee-version +++ b/buildtools/.grist-ee-version @@ -1 +1 @@ -0.9.2 +0.9.3 From 36cddc1d0ba44ffbc94db073862a36ad01576cba Mon Sep 17 00:00:00 2001 From: Spoffy Date: Tue, 2 Jul 2024 17:12:03 +0100 Subject: [PATCH 02/12] Adds parameterisation to docker_latest.yml to simplify testing --- .github/workflows/docker_latest.yml | 47 ++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker_latest.yml b/.github/workflows/docker_latest.yml index b4492bc624..2272a80edd 100644 --- a/.github/workflows/docker_latest.yml +++ b/.github/workflows/docker_latest.yml @@ -15,7 +15,31 @@ on: description: "Branch from which to create the latest Docker image (default: latest_candidate)" type: string required: true - default_value: latest_candidate + default: latest_candidate + run_tests: + description: "Should the tests be run before building the image?" + type: boolean + required: True + default: True + platforms: + description: "Platforms to build" + type: choice + required: True + options: + - linux/amd64 + - linux/arm64/v8 + - linux/amd64,linux/arm64/v8 + default: linux/amd64,linux/arm64/v8 + tag: + description: "Tag for the resulting images" + type: string + required: True + default: 'experimental' + +env: + PLATFORMS: ${{ inputs.platforms || 'linux/amd64,linux/arm64/v8' }} + TAG: ${{ inputs.tag || 'experimental' }} + DOCKER_HUB_OWNER: ${{ vars.docker_hub_owner || github.repository_owner }} jobs: push_to_registry: @@ -54,38 +78,45 @@ jobs: with: context: . load: true - tags: ${{ github.repository_owner }}/${{ matrix.image.name }}:experimental + tags: ${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ env.TAG }} cache-from: type=gha build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }} - name: Use Node.js ${{ matrix.node-version }} for testing + if: ${{ inputs.run_tests || inputs.run_tests == null }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - name: Set up Python ${{ matrix.python-version }} for testing - maybe not needed + if: ${{ inputs.run_tests || inputs.run_tests == null }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install Python packages + if: ${{ inputs.run_tests || inputs.run_tests == null }} run: | pip install virtualenv yarn run install:python - name: Install Node.js packages + if: ${{ inputs.run_tests || inputs.run_tests == null }} run: yarn install - name: Build Node.js code + if: ${{ inputs.run_tests || inputs.run_tests == null }} run: | rm -rf ext yarn run build:prod - name: Run tests - run: TEST_IMAGE=${{ github.repository_owner }}/${{ matrix.image.name }}:experimental VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:docker + if: ${{ inputs.run_tests || inputs.run_tests == null }} + run: TEST_IMAGE=${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ env.TAG }} VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:docker - name: Restore the ext/ directory - if: matrix.image.name != 'grist-oss' + if: ${{ matrix.image.name != 'grist-oss' && (inputs.run_tests || inputs.run_tests == null) }} + run: buildtools/checkout-ext-directory.sh ${{ matrix.image.repo }} - name: Log in to Docker Hub @@ -98,9 +129,9 @@ jobs: uses: docker/build-push-action@v2 with: context: . - platforms: linux/amd64,linux/arm64/v8 + platforms: ${{ env.PLATFORMS }} push: true - tags: ${{ github.repository_owner }}/${{ matrix.image.name }}:experimental + tags: ${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ TAG }} cache-from: type=gha cache-to: type=gha,mode=max build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }} @@ -111,9 +142,9 @@ jobs: with: context: . file: ext/Dockerfile - platforms: linux/amd64,linux/arm64/v8 + platforms: ${{ env.PLATFORMS }} push: true - tags: ${{ github.repository_owner }}/${{ matrix.image.name }}:experimental + tags: ${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ TAG }} cache-from: type=gha cache-to: type=gha,mode=max From ef37409aac0a2b71a018720e0988af624832f948 Mon Sep 17 00:00:00 2001 From: Spoffy Date: Tue, 2 Jul 2024 17:21:31 +0100 Subject: [PATCH 03/12] Fixes bad syntax in docker_latest.yml --- .github/workflows/docker_latest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker_latest.yml b/.github/workflows/docker_latest.yml index 2272a80edd..33a87dde2c 100644 --- a/.github/workflows/docker_latest.yml +++ b/.github/workflows/docker_latest.yml @@ -131,7 +131,7 @@ jobs: context: . platforms: ${{ env.PLATFORMS }} push: true - tags: ${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ TAG }} + tags: ${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ env.TAG }} cache-from: type=gha cache-to: type=gha,mode=max build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }} @@ -144,7 +144,7 @@ jobs: file: ext/Dockerfile platforms: ${{ env.PLATFORMS }} push: true - tags: ${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ TAG }} + tags: ${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ env.TAG }} cache-from: type=gha cache-to: type=gha,mode=max From 7aff4d4a812991ff6fbe24ab8d9f7a12d4f803b0 Mon Sep 17 00:00:00 2001 From: Spoffy Date: Tue, 2 Jul 2024 19:20:20 +0100 Subject: [PATCH 04/12] Negates run_tests --- .github/workflows/docker_latest.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/docker_latest.yml b/.github/workflows/docker_latest.yml index 33a87dde2c..b8adb04989 100644 --- a/.github/workflows/docker_latest.yml +++ b/.github/workflows/docker_latest.yml @@ -16,11 +16,11 @@ on: type: string required: true default: latest_candidate - run_tests: - description: "Should the tests be run before building the image?" + disable_tests: + description: "Should the tests be skipped?" type: boolean required: True - default: True + default: False platforms: description: "Platforms to build" type: choice @@ -58,7 +58,7 @@ jobs: repo: "grist-ee" steps: - name: Check out the repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: ${{ inputs.latest_branch }} @@ -83,40 +83,39 @@ jobs: build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }} - name: Use Node.js ${{ matrix.node-version }} for testing - if: ${{ inputs.run_tests || inputs.run_tests == null }} + if: ${{ !inputs.disable_tests }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - name: Set up Python ${{ matrix.python-version }} for testing - maybe not needed - if: ${{ inputs.run_tests || inputs.run_tests == null }} + if: ${{ !inputs.disable_tests }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install Python packages - if: ${{ inputs.run_tests || inputs.run_tests == null }} + if: ${{ !inputs.disable_tests }} run: | pip install virtualenv yarn run install:python - name: Install Node.js packages - if: ${{ inputs.run_tests || inputs.run_tests == null }} + if: ${{ !inputs.disable_tests }} run: yarn install - name: Build Node.js code - if: ${{ inputs.run_tests || inputs.run_tests == null }} + if: ${{ !inputs.disable_tests }} run: | rm -rf ext yarn run build:prod - name: Run tests - if: ${{ inputs.run_tests || inputs.run_tests == null }} + if: ${{ !inputs.disable_tests }} run: TEST_IMAGE=${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ env.TAG }} VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:docker - name: Restore the ext/ directory - if: ${{ matrix.image.name != 'grist-oss' && (inputs.run_tests || inputs.run_tests == null) }} - + if: ${{ matrix.image.name != 'grist-oss' && !inputs.disable_tests }} run: buildtools/checkout-ext-directory.sh ${{ matrix.image.repo }} - name: Log in to Docker Hub From a6fd2666c2c578e480acfcf6e20614911165e365 Mon Sep 17 00:00:00 2001 From: Spoffy Date: Tue, 2 Jul 2024 19:32:11 +0100 Subject: [PATCH 05/12] Fixes hub owner --- .github/workflows/docker_latest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker_latest.yml b/.github/workflows/docker_latest.yml index b8adb04989..dcab4982eb 100644 --- a/.github/workflows/docker_latest.yml +++ b/.github/workflows/docker_latest.yml @@ -39,7 +39,7 @@ on: env: PLATFORMS: ${{ inputs.platforms || 'linux/amd64,linux/arm64/v8' }} TAG: ${{ inputs.tag || 'experimental' }} - DOCKER_HUB_OWNER: ${{ vars.docker_hub_owner || github.repository_owner }} + DOCKER_HUB_OWNER: ${{ vars.DOCKER_HUB_OWNER || github.repository_owner }} jobs: push_to_registry: From 2687475ed04368334e597db71d0af4bc633dc565 Mon Sep 17 00:00:00 2001 From: Spoffy Date: Tue, 2 Jul 2024 19:37:34 +0100 Subject: [PATCH 06/12] Fixes default branch --- .github/workflows/docker_latest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker_latest.yml b/.github/workflows/docker_latest.yml index dcab4982eb..8f63fae1e5 100644 --- a/.github/workflows/docker_latest.yml +++ b/.github/workflows/docker_latest.yml @@ -15,7 +15,7 @@ on: description: "Branch from which to create the latest Docker image (default: latest_candidate)" type: string required: true - default: latest_candidate + default: ${{ github.repository_owner }}/${{github.ref_name}} disable_tests: description: "Should the tests be skipped?" type: boolean From 91858353c2a363cfd7839d84a45c14c1d0730787 Mon Sep 17 00:00:00 2001 From: Spoffy Date: Tue, 2 Jul 2024 19:40:41 +0100 Subject: [PATCH 07/12] Sets branch variable correctly --- .github/workflows/docker_latest.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker_latest.yml b/.github/workflows/docker_latest.yml index 8f63fae1e5..71bc7856b9 100644 --- a/.github/workflows/docker_latest.yml +++ b/.github/workflows/docker_latest.yml @@ -11,11 +11,11 @@ on: - cron: '41 5 * * *' workflow_dispatch: inputs: - latest_branch: + branch: description: "Branch from which to create the latest Docker image (default: latest_candidate)" type: string required: true - default: ${{ github.repository_owner }}/${{github.ref_name}} + default: latest_candidate disable_tests: description: "Should the tests be skipped?" type: boolean @@ -37,6 +37,7 @@ on: default: 'experimental' env: + BRANCH: ${{ github.repository_owner }}/${{ inputs.branch }} PLATFORMS: ${{ inputs.platforms || 'linux/amd64,linux/arm64/v8' }} TAG: ${{ inputs.tag || 'experimental' }} DOCKER_HUB_OWNER: ${{ vars.DOCKER_HUB_OWNER || github.repository_owner }} @@ -60,7 +61,7 @@ jobs: - name: Check out the repo uses: actions/checkout@v4 with: - ref: ${{ inputs.latest_branch }} + ref: ${{ env.BRANCH }} - name: Check out the ext/ directory if: matrix.image.name != 'grist-oss' From 1f5f2fb400dd52daf7f1b91ea145f92404f060e7 Mon Sep 17 00:00:00 2001 From: Spoffy Date: Tue, 2 Jul 2024 19:44:14 +0100 Subject: [PATCH 08/12] Alters branch again --- .github/workflows/docker_latest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker_latest.yml b/.github/workflows/docker_latest.yml index 71bc7856b9..4ca06a37aa 100644 --- a/.github/workflows/docker_latest.yml +++ b/.github/workflows/docker_latest.yml @@ -37,7 +37,7 @@ on: default: 'experimental' env: - BRANCH: ${{ github.repository_owner }}/${{ inputs.branch }} + BRANCH: ${{ inputs.branch || 'latest_candidate' }} PLATFORMS: ${{ inputs.platforms || 'linux/amd64,linux/arm64/v8' }} TAG: ${{ inputs.tag || 'experimental' }} DOCKER_HUB_OWNER: ${{ vars.DOCKER_HUB_OWNER || github.repository_owner }} From 7907dd91091e076ccb0497c0766be23e0dc68cec Mon Sep 17 00:00:00 2001 From: Spoffy Date: Tue, 2 Jul 2024 20:03:23 +0100 Subject: [PATCH 09/12] Fixes EE push --- .github/workflows/docker_latest.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker_latest.yml b/.github/workflows/docker_latest.yml index 4ca06a37aa..4583af17ae 100644 --- a/.github/workflows/docker_latest.yml +++ b/.github/workflows/docker_latest.yml @@ -141,10 +141,14 @@ jobs: uses: docker/build-push-action@v2 with: context: . + build-contexts: | + gristlabs/grist=docker-image://${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }} + build-args: | + BASE_VERSION=${{ env.TAG }} file: ext/Dockerfile platforms: ${{ env.PLATFORMS }} push: true - tags: ${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ env.TAG }} + tags: ${{ env.DOCKER_HUB_OWNER }}/grist-ee:${{ env.TAG }} cache-from: type=gha cache-to: type=gha,mode=max From 35eb511af5fb6949381d7f9d996e9afa1aca4646 Mon Sep 17 00:00:00 2001 From: Spoffy Date: Tue, 2 Jul 2024 20:21:52 +0100 Subject: [PATCH 10/12] Remove spare newline --- .github/workflows/docker_latest.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docker_latest.yml b/.github/workflows/docker_latest.yml index 4583af17ae..780dbf8620 100644 --- a/.github/workflows/docker_latest.yml +++ b/.github/workflows/docker_latest.yml @@ -67,7 +67,6 @@ jobs: if: matrix.image.name != 'grist-oss' run: buildtools/checkout-ext-directory.sh ${{ matrix.image.repo }} - - name: Set up QEMU uses: docker/setup-qemu-action@v1 From f07f020d15462e647bdc86962b056b7c3523c0ff Mon Sep 17 00:00:00 2001 From: Spoffy Date: Tue, 2 Jul 2024 20:31:01 +0100 Subject: [PATCH 11/12] Adds dump for build settings --- .github/workflows/docker_latest.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/docker_latest.yml b/.github/workflows/docker_latest.yml index 780dbf8620..f4daebf77e 100644 --- a/.github/workflows/docker_latest.yml +++ b/.github/workflows/docker_latest.yml @@ -58,6 +58,13 @@ jobs: - name: "grist" repo: "grist-ee" steps: + - name: Build settings + run: | + echo "Branch: $BRANCH" + echo "Platforms: $PLATFORMS" + echo "Docker Hub Owner: $DOCKER_HUB_OWNER" + echo "Tag: $TAG" + - name: Check out the repo uses: actions/checkout@v4 with: From dfbfa4f9388329eb96302c0f58fbbc4910fd5b9f Mon Sep 17 00:00:00 2001 From: Spoffy Date: Tue, 2 Jul 2024 20:55:42 +0100 Subject: [PATCH 12/12] Changes base image to be accurate on forks --- .github/workflows/docker_latest.yml | 3 +-- buildtools/.grist-ee-version | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker_latest.yml b/.github/workflows/docker_latest.yml index f4daebf77e..b3adb7ef98 100644 --- a/.github/workflows/docker_latest.yml +++ b/.github/workflows/docker_latest.yml @@ -147,9 +147,8 @@ jobs: uses: docker/build-push-action@v2 with: context: . - build-contexts: | - gristlabs/grist=docker-image://${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }} build-args: | + BASE_IMAGE=${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name}} BASE_VERSION=${{ env.TAG }} file: ext/Dockerfile platforms: ${{ env.PLATFORMS }} diff --git a/buildtools/.grist-ee-version b/buildtools/.grist-ee-version index 965065db5b..a602fc9e28 100644 --- a/buildtools/.grist-ee-version +++ b/buildtools/.grist-ee-version @@ -1 +1 @@ -0.9.3 +0.9.4