@supacloud/admin 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +31 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27733,6 +27733,16 @@ function shellArray(name, entries) {
|
|
|
27733
27733
|
}
|
|
27734
27734
|
function finishUpgradeFunction() {
|
|
27735
27735
|
return [
|
|
27736
|
+
"emit_wrapper_failure_receipt() {",
|
|
27737
|
+
" local code=$1 target_phase=${2:-${UPGRADE_PHASE:-}} phase",
|
|
27738
|
+
` if [ -n "\${LOG:-}" ] && ! grep -q '^SUPACLOUD_UPGRADE_FAILURE=' "$LOG" 2>/dev/null; then`,
|
|
27739
|
+
' case "$target_phase" in',
|
|
27740
|
+
' bootstrap|filesystem_checks|transfer_verification|verifier_setup|runner_preflight|runner_upgrade|cleanup|status_publish) phase="$target_phase" ;;',
|
|
27741
|
+
' *) phase="unknown" ;;',
|
|
27742
|
+
" esac",
|
|
27743
|
+
` printf 'SUPACLOUD_UPGRADE_FAILURE={"causes":["exit_code=%s","phase=%s"],"schema":"supacloud.upgrade-failure.v1","summary":"Remote upgrade execution failed during %s (exit code %s)"}\\n' "$code" "$phase" "$phase" "$code" >> "$LOG" || true`,
|
|
27744
|
+
" fi",
|
|
27745
|
+
"}",
|
|
27736
27746
|
"finish_upgrade() {",
|
|
27737
27747
|
" local code=$?",
|
|
27738
27748
|
" trap '' HUP INT TERM",
|
|
@@ -27740,15 +27750,27 @@ function finishUpgradeFunction() {
|
|
|
27740
27750
|
" set +e",
|
|
27741
27751
|
' if [ "$code" -ne 0 ]; then',
|
|
27742
27752
|
' write_status "FAILED:${code}:TRANSACTION" || true',
|
|
27753
|
+
' emit_wrapper_failure_receipt "$code"',
|
|
27743
27754
|
' if ! rm -rf -- "$STAGE"; then write_status "FAILED:${code}:TRANSACTION_AND_CLEANUP" || true; fi',
|
|
27744
27755
|
' exit "$code"',
|
|
27745
27756
|
" fi",
|
|
27746
|
-
" write_status CLEANING
|
|
27757
|
+
" if ! write_status CLEANING; then",
|
|
27758
|
+
" echo 'Unable to publish cleanup state' >&2",
|
|
27759
|
+
" write_status 'FAILED:1:TRANSACTION' || true",
|
|
27760
|
+
" emit_wrapper_failure_receipt 1 status_publish",
|
|
27761
|
+
` if ! rm -rf -- "$STAGE"; then write_status 'FAILED:1:TRANSACTION_AND_CLEANUP' || true; fi`,
|
|
27762
|
+
" exit 1",
|
|
27763
|
+
" fi",
|
|
27747
27764
|
' if ! rm -rf -- "$STAGE"; then',
|
|
27748
27765
|
" write_status 'FAILED:1:CLEANUP_AFTER_TRANSACTION' || true",
|
|
27766
|
+
" emit_wrapper_failure_receipt 1 cleanup",
|
|
27767
|
+
" exit 1",
|
|
27768
|
+
" fi",
|
|
27769
|
+
" if ! write_status SUCCEEDED; then",
|
|
27770
|
+
" write_status 'FAILED:1:TRANSACTION' || true",
|
|
27771
|
+
" emit_wrapper_failure_receipt 1 status_publish",
|
|
27749
27772
|
" exit 1",
|
|
27750
27773
|
" fi",
|
|
27751
|
-
" write_status SUCCEEDED || exit 1",
|
|
27752
27774
|
" exit 0",
|
|
27753
27775
|
"}"
|
|
27754
27776
|
].join(`
|
|
@@ -27768,6 +27790,7 @@ function upgradeScriptSetup(paths) {
|
|
|
27768
27790
|
`BUNDLE=${quoteShell2(bundleDirectory)}`,
|
|
27769
27791
|
`MANAGEMENT_DIR=${quoteShell2(`${bundleDirectory}/management-api`)}`,
|
|
27770
27792
|
`EDGE_DIR=${quoteShell2(`${bundleDirectory}/edge-runtime`)}`,
|
|
27793
|
+
"UPGRADE_PHASE=bootstrap",
|
|
27771
27794
|
`write_status() { local next="\${STATUS}.next"; printf '%s\\n' "$1" > "$next"; chmod 600 "$next"; mv -f "$next" "$STATUS"; }`,
|
|
27772
27795
|
finishUpgradeFunction(),
|
|
27773
27796
|
"trap finish_upgrade EXIT",
|
|
@@ -27785,6 +27808,7 @@ function upgradeScriptFilesystemChecks(bundle) {
|
|
|
27785
27808
|
const componentFiles = expectedComponentFiles(bundle);
|
|
27786
27809
|
const stageEntries = ["bundle", "run.sh", ...bundle.verifierArchive ? ["verifier"] : []];
|
|
27787
27810
|
const checks = [
|
|
27811
|
+
"UPGRADE_PHASE=filesystem_checks",
|
|
27788
27812
|
shellArray("MANAGEMENT_FILES", componentFiles.management),
|
|
27789
27813
|
shellArray("EDGE_FILES", componentFiles.edge),
|
|
27790
27814
|
`assert_directory() { local path=$1; test -d "$path" && test ! -L "$path"; test "$(stat -c '%u:%g' "$path")" = '0:0'; test "$(stat -c '%a' "$path")" = '700'; }`,
|
|
@@ -27812,6 +27836,7 @@ function upgradeScriptFilesystemChecks(bundle) {
|
|
|
27812
27836
|
function upgradeScriptTransferVerification(bundle) {
|
|
27813
27837
|
const files = [...bundle.files, ...bundle.verifierArchive ? [bundle.verifierArchive] : []];
|
|
27814
27838
|
return [
|
|
27839
|
+
"UPGRADE_PHASE=transfer_verification",
|
|
27815
27840
|
`verify_transfer() { local relative=$1 expected_size=$2 expected_sha=$3; local path=$STAGE/$relative; test "$(stat -c '%s' "$path")" = "$expected_size"; test "$(sha256sum "$path" | awk '{print $1}')" = "$expected_sha"; }`,
|
|
27816
27841
|
...files.map((file) => `verify_transfer ${quoteShell2(file.relativePath)} ${file.size} ${quoteShell2(file.sha256)}`)
|
|
27817
27842
|
];
|
|
@@ -27824,6 +27849,7 @@ function upgradeScriptVerifier(paths, bundle, architecture) {
|
|
|
27824
27849
|
];
|
|
27825
27850
|
const capabilityFlags = STRICT_GITHUB_CAPABILITY_FLAGS.join(" ");
|
|
27826
27851
|
return [
|
|
27852
|
+
"UPGRADE_PHASE=verifier_setup",
|
|
27827
27853
|
...setup,
|
|
27828
27854
|
`GH_HELP=$(timeout 15s "$GH" attestation verify --help 2>&1) || { echo 'GitHub verifier capability check failed' >&2; exit 1; }`,
|
|
27829
27855
|
`for flag in ${capabilityFlags}; do printf '%s\\n' "$GH_HELP" | grep -Eq -- "(^|[[:space:]])${"$"}{flag}([=[:space:]]|$)" || { echo "GitHub verifier lacks $flag" >&2; exit 1; }; done`,
|
|
@@ -27851,6 +27877,7 @@ function upgradeScriptExecution(paths, bundle, request) {
|
|
|
27851
27877
|
const runner = `${paths.stage}/runner`;
|
|
27852
27878
|
const preflight = 'CONTROL_PLANE_PREFLIGHT_RECEIPT=$(env PATH="$VERIFIER_PATH:$PATH" "$RUNNER" --control-plane-upgrade-preflight)';
|
|
27853
27879
|
return [
|
|
27880
|
+
"UPGRADE_PHASE=runner_preflight",
|
|
27854
27881
|
`MANAGEMENT_VERSION=${quoteShell2(request.managementVersion)}`,
|
|
27855
27882
|
`RUNNER_ASSET=${quoteShell2(runnerAsset)}`,
|
|
27856
27883
|
`RUNNER=${quoteShell2(runner)}`,
|
|
@@ -27861,6 +27888,7 @@ function upgradeScriptExecution(paths, bundle, request) {
|
|
|
27861
27888
|
`timeout 5s "$RUNNER" --systemd-unit-helper-sha256 | grep -Eq 'SupaCloud systemd-unit helper SHA-256: [0-9a-f]{64}'`,
|
|
27862
27889
|
`timeout 5s "$RUNNER" --postgrest-launcher-sha256 | grep -Eq 'SupaCloud PostgREST launcher SHA-256: [0-9a-f]{64}'`,
|
|
27863
27890
|
preflight,
|
|
27891
|
+
"UPGRADE_PHASE=runner_upgrade",
|
|
27864
27892
|
`env PATH="$VERIFIER_PATH:$PATH" "$RUNNER" upgrade --yes --target-version ${quoteShell2(request.managementVersion)} --edge-runtime-version ${quoteShell2(request.edgeRuntimeVersion)} --asset-bundle-dir "$BUNDLE"`,
|
|
27865
27893
|
`printf '%s\\n' "$CONTROL_PLANE_PREFLIGHT_RECEIPT"`
|
|
27866
27894
|
];
|
|
@@ -32514,7 +32542,7 @@ Actions: list_releases, get_release, upload_release, activate_release`, {
|
|
|
32514
32542
|
// package.json
|
|
32515
32543
|
var package_default = {
|
|
32516
32544
|
name: "@supacloud/admin",
|
|
32517
|
-
version: "0.16.
|
|
32545
|
+
version: "0.16.1",
|
|
32518
32546
|
description: "Platform administration CLI for SupaCloud operators",
|
|
32519
32547
|
type: "module",
|
|
32520
32548
|
main: "./dist/index.js",
|