@supacloud/admin 0.7.5 → 0.7.6
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 +21 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25622,7 +25622,7 @@ SUPACLOUD_GITHUB_REPOSITORY="\${SUPACLOUD_GITHUB_REPOSITORY:-zuohuadong/supaclou
|
|
|
25622
25622
|
SUPACLOUD_RELEASES_API="\${SUPACLOUD_RELEASES_API:-https://api.github.com/repos/\${SUPACLOUD_GITHUB_REPOSITORY}/releases}"
|
|
25623
25623
|
SUPACLOUD_ATTESTATION_SIGNER_WORKFLOW="\${SUPACLOUD_ATTESTATION_SIGNER_WORKFLOW:-\${SUPACLOUD_GITHUB_REPOSITORY}/.github/workflows/release-please.yml}"
|
|
25624
25624
|
SUPACLOUD_GH_VERSION="\${SUPACLOUD_GH_VERSION:-2.96.0}"
|
|
25625
|
-
SUPACLOUD_GH_MIN_VERSION="\${SUPACLOUD_GH_MIN_VERSION:-2.
|
|
25625
|
+
SUPACLOUD_GH_MIN_VERSION="\${SUPACLOUD_GH_MIN_VERSION:-2.68.0}"
|
|
25626
25626
|
SUPACLOUD_GH_AMD64_SHA256="\${SUPACLOUD_GH_AMD64_SHA256:-83d5c2ccad5498f58bf6368acb1ab32588cf43ab3a4b1c301bf36328b1c8bd60}"
|
|
25627
25627
|
SUPACLOUD_GH_ARM64_SHA256="\${SUPACLOUD_GH_ARM64_SHA256:-06f86ec7103d41993b76cd78072f43595c34aaa56506d971d9860e67140bf909}"
|
|
25628
25628
|
|
|
@@ -25992,7 +25992,8 @@ supacloud_verify_attestation() (
|
|
|
25992
25992
|
if ! verification_output=$(gh attestation verify "$artifact_file" \\
|
|
25993
25993
|
--bundle "$bundle_file" \\
|
|
25994
25994
|
--repo "$SUPACLOUD_GITHUB_REPOSITORY" \\
|
|
25995
|
-
--signer-workflow "$SUPACLOUD_ATTESTATION_SIGNER_WORKFLOW"
|
|
25995
|
+
--signer-workflow "$SUPACLOUD_ATTESTATION_SIGNER_WORKFLOW" \\
|
|
25996
|
+
--source-ref "refs/heads/main" 2>&1); then
|
|
25996
25997
|
echo "GitHub artifact attestation verification failed: \${verification_output}" >&2
|
|
25997
25998
|
return 1
|
|
25998
25999
|
fi
|
|
@@ -26011,12 +26012,15 @@ supacloud_verify_attestation() (
|
|
|
26011
26012
|
)
|
|
26012
26013
|
|
|
26013
26014
|
supacloud_attestation_verifier_available() {
|
|
26014
|
-
local version
|
|
26015
|
+
local version help
|
|
26015
26016
|
command -v gh >/dev/null 2>&1 || return 1
|
|
26016
26017
|
version=$(supacloud_gh_version)
|
|
26017
26018
|
[[ -n "$version" ]] || return 1
|
|
26018
26019
|
supacloud_version_at_least "$version" "$SUPACLOUD_GH_MIN_VERSION" || return 1
|
|
26019
|
-
gh attestation verify --help 2>&1
|
|
26020
|
+
help=$(gh attestation verify --help 2>&1) || return 1
|
|
26021
|
+
grep -Eq -- '(^|[[:space:]])--bundle([=[:space:]]|$)' <<< "$help" || return 1
|
|
26022
|
+
grep -Eq -- '(^|[[:space:]])--signer-workflow([=[:space:]]|$)' <<< "$help" || return 1
|
|
26023
|
+
grep -Eq -- '(^|[[:space:]])--source-ref([=[:space:]]|$)' <<< "$help"
|
|
26020
26024
|
}
|
|
26021
26025
|
|
|
26022
26026
|
supacloud_download_release_asset() (
|
|
@@ -26171,6 +26175,12 @@ function componentPreflightCommands(request) {
|
|
|
26171
26175
|
`test "$EDGE_RUNTIME_MODE_VALUE" = external || { echo 'Edge Runtime component upgrade supports persisted external mode only' >&2; exit 1; }`
|
|
26172
26176
|
] : [];
|
|
26173
26177
|
}
|
|
26178
|
+
function signalSafeCleanupTraps(cleanupCommand) {
|
|
26179
|
+
return [
|
|
26180
|
+
`trap '${cleanupCommand}' EXIT`,
|
|
26181
|
+
`trap 'trap - EXIT HUP INT TERM; ${cleanupCommand}; exit 1' HUP INT TERM`
|
|
26182
|
+
];
|
|
26183
|
+
}
|
|
26174
26184
|
function buildRootUpgradeScript(request) {
|
|
26175
26185
|
const envAssignments = upgradeEnvAssignments(request);
|
|
26176
26186
|
return [
|
|
@@ -26179,12 +26189,12 @@ function buildRootUpgradeScript(request) {
|
|
|
26179
26189
|
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
|
26180
26190
|
"export PATH",
|
|
26181
26191
|
"unset SUPACLOUD_ALLOW_UNVERIFIED_RELEASE SUPACLOUD_GITHUB_REPOSITORY SUPACLOUD_RELEASES_API SUPACLOUD_ATTESTATION_SIGNER_WORKFLOW SUPACLOUD_GH_VERSION SUPACLOUD_GH_MIN_VERSION SUPACLOUD_GH_AMD64_SHA256 SUPACLOUD_GH_ARM64_SHA256 GH_PROXY",
|
|
26182
|
-
request.githubProxy ? `export SUPACLOUD_GITHUB_PROXY=${quoteEnvValue(request.githubProxy)}` : "unset SUPACLOUD_GITHUB_PROXY",
|
|
26192
|
+
request.githubProxy ? `export SUPACLOUD_GITHUB_PROXY=${quoteEnvValue(request.githubProxy)}` : "unset SUPACLOUD_GITHUB_PROXY SUPACLOUD_GITHUB_PROXIES",
|
|
26183
26193
|
'for tool in curl jq file sha256sum tar; do command -v "$tool" >/dev/null 2>&1 || { echo "Required upgrade tool is missing: $tool" >&2; exit 127; }; done',
|
|
26184
26194
|
"test -x /usr/local/bin/supacloud || { echo 'SupaCloud binary not found at /usr/local/bin/supacloud; run ssh install first.' >&2; exit 127; }",
|
|
26185
26195
|
...componentPreflightCommands(request),
|
|
26186
26196
|
"STAGED_MANAGEMENT=''",
|
|
26187
|
-
|
|
26197
|
+
...signalSafeCleanupTraps('test -z "$STAGED_MANAGEMENT" || rm -f "$STAGED_MANAGEMENT"'),
|
|
26188
26198
|
`source ${quoteEnvValue(request.helperPath)}`,
|
|
26189
26199
|
"if ! supacloud_attestation_verifier_available; then supacloud_install_pinned_gh /usr/local/bin/gh; fi",
|
|
26190
26200
|
"supacloud_attestation_verifier_available || { echo 'Pinned GitHub attestation verifier is unavailable' >&2; exit 1; }",
|
|
@@ -26195,7 +26205,11 @@ function buildRootUpgradeScript(request) {
|
|
|
26195
26205
|
}
|
|
26196
26206
|
function buildOfficialUpgradeCommand(request) {
|
|
26197
26207
|
const rootScript = buildRootUpgradeScript(request);
|
|
26198
|
-
return
|
|
26208
|
+
return [
|
|
26209
|
+
"set -e",
|
|
26210
|
+
...signalSafeCleanupTraps(`rm -f ${request.helperPath}`),
|
|
26211
|
+
'if [ "$(id -u)" -eq 0 ]; then ' + `bash -c ${quoteEnvValue(rootScript)}; ` + "else sudo -n true; " + `sudo -n bash -c ${quoteEnvValue(rootScript)}; fi`
|
|
26212
|
+
].join("; ");
|
|
26199
26213
|
}
|
|
26200
26214
|
async function removeRemoteUpgradeHelper(ssh, helperPath) {
|
|
26201
26215
|
const cleanup = await ssh.exec(`rm -f ${quoteEnvValue(helperPath)}`);
|