This commit is contained in:
@@ -43,6 +43,8 @@ RELEASE_AUTH_HEADER_FILE=
|
||||
TARGET_VERSION=
|
||||
REQUEST_ID=
|
||||
REQUEST_ACTION=
|
||||
RELEASE_NOTES=
|
||||
RELEASE_PUBLISHED_AT=
|
||||
TERMINAL_STATUS_WRITTEN=false
|
||||
DOWNLOAD_PID=
|
||||
DOWNLOAD_PGID=
|
||||
@@ -297,6 +299,8 @@ status() {
|
||||
previous_message=
|
||||
previous_request_id=
|
||||
previous_action=
|
||||
previous_release_notes=
|
||||
previous_published_at=
|
||||
if [ -f "$STATUS_FILE" ] && [ ! -L "$STATUS_FILE" ]; then
|
||||
previous_state=$(jq -r '.state // empty' "$STATUS_FILE" 2>/dev/null || true)
|
||||
previous_message=$(jq -r '.message // empty' "$STATUS_FILE" 2>/dev/null || true)
|
||||
@@ -304,6 +308,10 @@ status() {
|
||||
"$STATUS_FILE" 2>/dev/null || true)
|
||||
previous_action=$(jq -r '.action // empty | strings | ascii_upcase \
|
||||
| select(. == "DOWNLOAD" or . == "INSTALL")' "$STATUS_FILE" 2>/dev/null || true)
|
||||
previous_release_notes=$(jq -r '(.releaseNotes // "") | strings | .[0:4000]' \
|
||||
"$STATUS_FILE" 2>/dev/null || true)
|
||||
previous_published_at=$(jq -r '(.publishedAt // "") | strings | .[0:128]' \
|
||||
"$STATUS_FILE" 2>/dev/null || true)
|
||||
fi
|
||||
status_request_id=
|
||||
status_action=
|
||||
@@ -315,6 +323,8 @@ status() {
|
||||
fi
|
||||
[ -n "$status_request_id" ] || status_request_id=${REQUEST_ID:-$previous_request_id}
|
||||
[ -n "$status_action" ] || status_action=${REQUEST_ACTION:-$previous_action}
|
||||
status_release_notes=${RELEASE_NOTES:-$previous_release_notes}
|
||||
status_published_at=${RELEASE_PUBLISHED_AT:-$previous_published_at}
|
||||
tmp="$STATUS_FILE.tmp.$$"
|
||||
jq -n \
|
||||
--arg state "$state" \
|
||||
@@ -327,11 +337,15 @@ status() {
|
||||
--arg restartExpectedSeconds "$restart_expected_seconds" \
|
||||
--arg requestId "$status_request_id" \
|
||||
--arg action "$status_action" \
|
||||
--arg releaseNotes "$status_release_notes" \
|
||||
--arg publishedAt "$status_published_at" \
|
||||
--arg updatedAt "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
||||
'{state:$state,message:$message,updatedAt:$updatedAt}
|
||||
+ (if ($version | length) > 0 then {targetVersion:$version} else {} end)
|
||||
+ (if ($requestId | length) > 0 then {requestId:$requestId} else {} end)
|
||||
+ (if ($action == "DOWNLOAD" or $action == "INSTALL") then {action:$action} else {} end)
|
||||
+ (if ($releaseNotes | length) > 0 then {releaseNotes:$releaseNotes} else {} end)
|
||||
+ (if ($publishedAt | length) > 0 then {publishedAt:$publishedAt} else {} end)
|
||||
+ (if ($downloadedBytes | test("^[0-9]+$")) then {downloadedBytes:($downloadedBytes | tonumber)} else {} end)
|
||||
+ (if ($totalBytes | test("^[0-9]+$")) then {totalBytes:($totalBytes | tonumber)} else {} end)
|
||||
+ (if ($bytesPerSecond | test("^[0-9]+$")) then {bytesPerSecond:($bytesPerSecond | tonumber)} else {} end)
|
||||
@@ -1119,6 +1133,10 @@ EXPECTED_SHA=$(jq -er '.sha256 | strings | ascii_downcase | select(test("^[0-9a-
|
||||
"$WORK_DIR/release-manifest.json") || fail "Release SHA-256 is invalid"
|
||||
EXPECTED_SIZE=$(jq -er '(.artifactSizeBytes // 0) | numbers | floor | select(. >= 0)' \
|
||||
"$WORK_DIR/release-manifest.json") || fail "Release artifact size is invalid"
|
||||
RELEASE_NOTES=$(jq -r '(.releaseNotes // "") | strings | .[0:4000]' \
|
||||
"$WORK_DIR/release-manifest.json") || fail "Release notes are invalid"
|
||||
RELEASE_PUBLISHED_AT=$(jq -r '(.publishedAt // "") | strings | .[0:128]' \
|
||||
"$WORK_DIR/release-manifest.json") || fail "Release publish time is invalid"
|
||||
|
||||
CURRENT_VERSION=$(cat "$APP_ROOT/current/VERSION" 2>/dev/null || true)
|
||||
if [ "$CURRENT_VERSION" = "$TARGET_VERSION" ]; then
|
||||
|
||||
Reference in New Issue
Block a user