diff --git a/.github/workflows/build-publish-rh-image.yml b/.github/workflows/build-publish-rh-image.yml index e36473f2aa..dcb223b534 100644 --- a/.github/workflows/build-publish-rh-image.yml +++ b/.github/workflows/build-publish-rh-image.yml @@ -63,6 +63,7 @@ jobs: push: true build-args: | features=ee_rhel + WM_BUILD_VERSION=${{ github.sha }} secrets: | rh_username=${{ secrets.RH_USERNAME }} rh_password=${{ secrets.RH_PASSWORD }} diff --git a/.github/workflows/build-publish-rh8-image.yml b/.github/workflows/build-publish-rh8-image.yml index b7a7196077..7c820eb290 100644 --- a/.github/workflows/build-publish-rh8-image.yml +++ b/.github/workflows/build-publish-rh8-image.yml @@ -65,6 +65,7 @@ jobs: push: true build-args: | features=ee_rhel + WM_BUILD_VERSION=${{ github.sha }} secrets: | rh_username=${{ secrets.RH_USERNAME }} rh_password=${{ secrets.RH_PASSWORD }} @@ -82,6 +83,7 @@ jobs: push: true build-args: | features=ee_rhel + WM_BUILD_VERSION=${{ github.sha }} secrets: | rh_username=${{ secrets.RH_USERNAME }} rh_password=${{ secrets.RH_PASSWORD }} diff --git a/.github/workflows/docker-image-rpi4.yml b/.github/workflows/docker-image-rpi4.yml index 4a7fc2a874..fa5f4ba3fe 100644 --- a/.github/workflows/docker-image-rpi4.yml +++ b/.github/workflows/docker-image-rpi4.yml @@ -68,6 +68,7 @@ jobs: push: true build-args: | features=ce_rpi + WM_BUILD_VERSION=${{ github.sha }} tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:dev ${{ steps.meta-public.outputs.tags }} diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index bdc53a6f22..433f3a86b3 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -93,6 +93,7 @@ jobs: push: true build-args: | features=ce + WM_BUILD_VERSION=${{ github.sha }} tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.DEV_SHA }} ${{ steps.meta-public.outputs.tags }} @@ -155,6 +156,7 @@ jobs: push: true build-args: | features=ee + WM_BUILD_VERSION=${{ github.sha }} tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ee:${{ env.DEV_SHA }} ${{ steps.meta-ee-public.outputs.tags }} @@ -254,6 +256,7 @@ jobs: target: debuginfo build-args: | features=ee + WM_BUILD_VERSION=${{ github.sha }} outputs: type=local,dest=./debuginfo - name: Rename debug file with corresponding architecture diff --git a/Dockerfile b/Dockerfile index 83bf4c8513..b0b429803e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -79,6 +79,8 @@ COPY /python-client/docs/ /frontend/static/pydocs/ RUN npm run generate-backend-client ENV NODE_OPTIONS "--max-old-space-size=8192" ARG VITE_BASE_URL "" +# Must be declared for the build-arg to reach the bundle. See frontend/svelte.config.js. +ARG WM_BUILD_VERSION="" # Read more about macro in docker/dev.nu # -- MACRO-SPREAD-WASM-PARSER-DEV-ONLY -- # RUN npm run build diff --git a/docker/RHEL8/Dockerfile b/docker/RHEL8/Dockerfile index 57b74b75af..1af03cc5f4 100644 --- a/docker/RHEL8/Dockerfile +++ b/docker/RHEL8/Dockerfile @@ -41,6 +41,8 @@ COPY /python-client/docs/ /frontend/static/pydocs/ RUN npm run generate-backend-client ENV NODE_OPTIONS "--max-old-space-size=8192" +# Must be declared for the build-arg to reach the bundle. See frontend/svelte.config.js. +ARG WM_BUILD_VERSION="" RUN npm run build diff --git a/docker/RHEL9/Dockerfile b/docker/RHEL9/Dockerfile index 21816ba8a5..9ab5c78318 100644 --- a/docker/RHEL9/Dockerfile +++ b/docker/RHEL9/Dockerfile @@ -41,6 +41,8 @@ COPY /python-client/docs/ /frontend/static/pydocs/ RUN npm run generate-backend-client ENV NODE_OPTIONS "--max-old-space-size=8192" +# Must be declared for the build-arg to reach the bundle. See frontend/svelte.config.js. +ARG WM_BUILD_VERSION="" RUN npm run build diff --git a/frontend/svelte.config.js b/frontend/svelte.config.js index 4b318efcd5..1752fed97c 100644 --- a/frontend/svelte.config.js +++ b/frontend/svelte.config.js @@ -1,6 +1,12 @@ import preprocess from 'svelte-preprocess' import adapter from '@sveltejs/adapter-static' import { preprocessMeltUI, sequence } from '@melt-ui/pp' +import { readFileSync } from 'fs' +import { fileURLToPath } from 'url' + +const pkg = JSON.parse( + readFileSync(fileURLToPath(new URL('package.json', import.meta.url)), 'utf8') +) /** @type {import('@sveltejs/kit').Config} */ const config = { @@ -23,6 +29,11 @@ const config = { assets: 'build', fallback: '200.html' }), + // Same for every build of one revision (SvelteKit's Date.now() default is not, so + // the per-architecture images disagreed on content-hashed asset filenames and + // mixed-arch clusters 404ed on each other's chunks), and different between + // revisions (SvelteKit only full-page reloads on a missing chunk if this changed). + version: { name: process.env.WM_BUILD_VERSION || pkg.version }, prerender: { entries: [] }, paths: { base: process.env.VITE_BASE_URL ?? ''