Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/workflows/sandbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
push:
branches: [main]
paths:
- "packages/sandbox/bundle/**"
- "packages/sandbox/**"
- "packages/shared/src/sandbox-contract.ts"
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -138,7 +138,17 @@ jobs:

production-release:
name: Production release
if: github.event_name == 'workflow_dispatch' && inputs.run == 'production-release' && github.ref == 'refs/heads/main'
# A merge that touches the image or the bundle releases it. Without this the
# bundle moved on every merge while the image and the goldens only moved when
# someone remembered, so every new box booted an image older than the bundle
# it then fetched. host-service is deliberately not here: a box picks one up
# by hash from `bundle/assets.json`, so what reaches a box is the version
# bump in that file, which is already a `packages/sandbox/**` change.
if: |
github.ref == 'refs/heads/main' && (
github.event_name == 'push' ||
(github.event_name == 'workflow_dispatch' && inputs.run == 'production-release')
)
runs-on: ubuntu-latest
environment: production
timeout-minutes: 120
Expand Down
12 changes: 12 additions & 0 deletions packages/sandbox/bundle/rootfs/usr/local/bin/superset-boot
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ ensure_bundle() {
done
stamp "bundle.installed ${want:0:12} was ${have:0:12}"
}
self_hash() { sha256sum "$0" 2>/dev/null | cut -d' ' -f1; }
BOOT_HASH_BEFORE="$(self_hash)"

ensure_bundle || true
BUNDLE="${SUPERSET_BUNDLE_ROOT}/current"

Expand All @@ -97,6 +100,15 @@ BUNDLE="${SUPERSET_BUNDLE_ROOT}/current"
stamp "rootfs.start"; "$BUNDLE/setup" apply-rootfs >> "$SUPERSET_BOOT_LOG" 2>&1; stamp "rootfs.end"
# apply-rootfs may have replaced the contract; re-read it.
. /etc/superset/contract.sh
# It may also have replaced this script. The shell is running the copy the
# image baked, so without this a bundle's change to the boot script only
# takes effect on the boot after the one that installed it — which is how an
# older image's checkout raced a newer bundle's. Once per boot: the guard
# stops a bundle whose script never settles from spinning here.
if [ -z "${SUPERSET_BOOT_REEXEC:-}" ] && [ "$(self_hash)" != "$BOOT_HASH_BEFORE" ]; then
stamp "boot.reexec into the installed bundle's script"
SUPERSET_BOOT_REEXEC=1 exec "$0" "$@"
fi
stamp "assets.start"; "$BUNDLE/setup" sync-assets >> "$SUPERSET_BOOT_LOG" 2>&1 || stamp "assets.failed continuing"; stamp "assets.end"
stamp "steps.start"; "$BUNDLE/setup" run-steps >> "$SUPERSET_BOOT_LOG" 2>&1; stamp "steps.end"

Expand Down
Loading