From ea2cd87273c914ddf209316363067e813112e003 Mon Sep 17 00:00:00 2001 From: David Crespo Date: Mon, 4 Jul 2022 15:12:41 -0500 Subject: [PATCH 1/4] gzip .js, .map, and .css files inside the tarball --- .github/workflows/upload-assets.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/upload-assets.yaml b/.github/workflows/upload-assets.yaml index d3e81ab2cf..ead618692d 100644 --- a/.github/workflows/upload-assets.yaml +++ b/.github/workflows/upload-assets.yaml @@ -26,6 +26,8 @@ jobs: - run: yarn install - name: Build for Nexus run: SHA=${{ github.sha }} yarn build-for-nexus + - name: Gzip individual files (keep originals) + run: ls dist/assets/*.{js,css,map} | xargs gzip --keep - run: mkdir -p releases/console - name: Make .tar.gz run: tar czf releases/console/${{ github.sha }}.tar.gz --directory=dist . From 03f9680c7e6443f00005e7d39a495bb6004f03dd Mon Sep 17 00:00:00 2001 From: David Crespo Date: Mon, 4 Jul 2022 15:16:18 -0500 Subject: [PATCH 2/4] update nexus instructions with out/console-assets and prereqs script --- docs/serve-from-nexus.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/docs/serve-from-nexus.md b/docs/serve-from-nexus.md index 163f7ad239..15b938f099 100644 --- a/docs/serve-from-nexus.md +++ b/docs/serve-from-nexus.md @@ -1,17 +1,13 @@ # Serving the Console from Nexus -## Wait! You probably don't need to build anything +## Wait! You probably don't need to do anything -Assets from commits on `main` are available at `dl.oxide.computer/releases/console/.tar.gz`. The latest `main` is probably what you want and can always be found at https://dl.oxide.computer/releases/console/main.tar.gz in addition to the path with the SHA. +Assets from commits on `main` are available at `dl.oxide.computer/releases/console/.tar.gz`. A console version is pinned in Omicron in the file `tools/console_version`, and the prereqs script `./tools/install_prerequisites.sh` will download the tarball and extract it in the right place. -If you want to use a version of the console that's already merged into `main`, just download the tarball and extract the files into the directory configured as `console.static_dir` in the Nexus config (the default in the example config `nexus/static`). +If you want to use a different commit than the one that's pinned, just change the commmit hash and SHA256 in that file (get the SHA256 at `https://dl.oxide.computer/releases/console/.sha256.txt`) and re-run the script. Following the rest of the instructions is only necessary if you want to build the assets yourself, for example if you're making a change to the console and want to test it locally against Nexus. -### Choosing a Console version to download - -Most of the time you will want the latest commit on `main`. Look at [`OMICRON_VERSION`](/OMICRON_VERSION) to see what Omicron SHA that version of the console expects. Often it will work with a newer version of the API, but don't be surprised if it doesn't. - ## Dependencies - Node.js (tested on 14+, 16+ recommended) @@ -44,7 +40,7 @@ The only difference between this build and the one for local dev is that the lat The build output lands in the `dist` directory. Now all you need to do is make `console.static_dir` in the Nexus config point to a directory containing these files. -If you're using the example Nexus config, `static_dir` is set there to `nexus/static` (treated as relative to CWD), so that's a reasonable default location for the files. Another option is to point Nexus directly at `dist` so you don't even have to copy them. Nexus accepts both absolute and relative paths. +If you're using the example Nexus config, `static_dir` is set there to `out/console-assets` (treated as relative to CWD), so that's a reasonable default location for the files. Another option is to point Nexus directly at `dist` so you don't even have to copy them. Nexus accepts both absolute and relative paths. Whatever the directory is, the files need to be at top level, just like they are in `dist`: @@ -67,13 +63,13 @@ If I have `console` and `omicron` sitting next to each other in the same directo ```toml [console] -static_dir = "nexus/static" +static_dir = "out/console-assets" ``` I would run `yarn build-for-nexus` in `console` and then use the following command to copy the files over: ```bash -cp -R dist/ ../omicron/nexus/static +cp -R dist/ ../omicron/out/console-assets ``` The `/` after `dist` is there on purpose — if the target directory already exists, if I leave off the `/` it will copy `dist` into the target with its contents inside rather than the copying only the contents. From 11cc5143d36b6955c7152c534e15909b4b6b2277 Mon Sep 17 00:00:00 2001 From: David Crespo Date: Tue, 5 Jul 2022 10:10:30 -0500 Subject: [PATCH 3/4] run workflow on PR (will manually delete tarball) --- .github/workflows/upload-assets.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/upload-assets.yaml b/.github/workflows/upload-assets.yaml index ead618692d..996701c2e7 100644 --- a/.github/workflows/upload-assets.yaml +++ b/.github/workflows/upload-assets.yaml @@ -5,6 +5,7 @@ name: Upload assets to dl.oxide.computer on: push: branches: [main] + pull_request: jobs: build-and-upload: @@ -33,10 +34,6 @@ jobs: run: tar czf releases/console/${{ github.sha }}.tar.gz --directory=dist . - name: Write sha256sum to file run: sha256sum releases/console/${{ github.sha }}.tar.gz | awk '{print $1}' > releases/console/${{ github.sha }}.sha256.txt - - name: Copy files to main.* - run: | - cp releases/console/${{ github.sha }}.tar.gz releases/console/main.tar.gz - cp releases/console/${{ github.sha }}.sha256.txt releases/console/main.sha256.txt - name: Upload files to GCP bucket id: upload-files uses: google-github-actions/upload-cloud-storage@v0.9.0 From e74a304c264590f25341b2c76463d947cb3d135b Mon Sep 17 00:00:00 2001 From: David Crespo Date: Tue, 5 Jul 2022 10:15:55 -0500 Subject: [PATCH 4/4] don't run on PRs but keep the bit where we got rid of main.tar.gz --- .github/workflows/upload-assets.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/upload-assets.yaml b/.github/workflows/upload-assets.yaml index 996701c2e7..ccada273ad 100644 --- a/.github/workflows/upload-assets.yaml +++ b/.github/workflows/upload-assets.yaml @@ -5,7 +5,6 @@ name: Upload assets to dl.oxide.computer on: push: branches: [main] - pull_request: jobs: build-and-upload: