Require complete release uploads by default
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
This commit is contained in:
@@ -11,6 +11,8 @@ Environment:
|
|||||||
GITEA_REPO owner/repo, default Palav/dosh
|
GITEA_REPO owner/repo, default Palav/dosh
|
||||||
GITEA_TOKEN Token with release write permission
|
GITEA_TOKEN Token with release write permission
|
||||||
GITEA_TITLE Release title, default TAG
|
GITEA_TITLE Release title, default TAG
|
||||||
|
DOSH_RELEASE_ALLOW_PARTIAL=1
|
||||||
|
Allow uploading an incomplete platform set. Default: refuse.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,6 +33,7 @@ repo="${GITEA_REPO:-Palav/dosh}"
|
|||||||
token="${GITEA_TOKEN:-}"
|
token="${GITEA_TOKEN:-}"
|
||||||
title="${GITEA_TITLE:-$tag}"
|
title="${GITEA_TITLE:-$tag}"
|
||||||
expected_version="${tag#v}"
|
expected_version="${tag#v}"
|
||||||
|
allow_partial="${DOSH_RELEASE_ALLOW_PARTIAL:-0}"
|
||||||
|
|
||||||
artifact_version() {
|
artifact_version() {
|
||||||
artifact="$1"
|
artifact="$1"
|
||||||
@@ -80,6 +83,42 @@ if [ "$#" -eq 0 ]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
require_complete_release_artifacts() {
|
||||||
|
[ "$allow_partial" = "1" ] && return 0
|
||||||
|
missing=0
|
||||||
|
for required in \
|
||||||
|
dosh-linux-x86_64.tar.gz \
|
||||||
|
dosh-macos-aarch64.tar.gz \
|
||||||
|
dosh-macos-x86_64.tar.gz \
|
||||||
|
dosh-windows-x86_64.zip; do
|
||||||
|
found=0
|
||||||
|
checksum_found=0
|
||||||
|
for artifact in "$@"; do
|
||||||
|
name="$(basename "$artifact")"
|
||||||
|
if [ "$name" = "$required" ]; then
|
||||||
|
found=1
|
||||||
|
fi
|
||||||
|
if [ "$name" = "$required.sha256" ]; then
|
||||||
|
checksum_found=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ "$found" -ne 1 ]; then
|
||||||
|
echo "missing required release artifact: $required" >&2
|
||||||
|
missing=1
|
||||||
|
fi
|
||||||
|
if [ "$checksum_found" -ne 1 ]; then
|
||||||
|
echo "missing required release checksum: $required.sha256" >&2
|
||||||
|
missing=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ "$missing" -ne 0 ]; then
|
||||||
|
echo "refusing partial release upload; set DOSH_RELEASE_ALLOW_PARTIAL=1 to override" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
require_complete_release_artifacts "$@"
|
||||||
|
|
||||||
api="$base/api/v1/repos/$repo"
|
api="$base/api/v1/repos/$repo"
|
||||||
auth_header="Authorization: token $token"
|
auth_header="Authorization: token $token"
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,25 @@ fn release_scripts_skip_stale_artifacts_when_auto_discovering() {
|
|||||||
assert!(publish.contains("actual=\"$(artifact_version \"$artifact\" || true)\""));
|
assert!(publish.contains("actual=\"$(artifact_version \"$artifact\" || true)\""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn release_upload_refuses_partial_platform_sets_by_default() {
|
||||||
|
let upload = include_str!("../scripts/upload-gitea-release.sh");
|
||||||
|
assert!(upload.contains("require_complete_release_artifacts \"$@\""));
|
||||||
|
assert!(upload.contains("DOSH_RELEASE_ALLOW_PARTIAL=1"));
|
||||||
|
assert!(upload.contains("refusing partial release upload"));
|
||||||
|
for name in [
|
||||||
|
"dosh-linux-x86_64.tar.gz",
|
||||||
|
"dosh-macos-aarch64.tar.gz",
|
||||||
|
"dosh-macos-x86_64.tar.gz",
|
||||||
|
"dosh-windows-x86_64.zip",
|
||||||
|
] {
|
||||||
|
assert!(
|
||||||
|
upload.contains(name),
|
||||||
|
"release upload completeness check must require {name}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn installers_skip_stale_latest_release_prebuilts() {
|
fn installers_skip_stale_latest_release_prebuilts() {
|
||||||
let install = include_str!("../install.sh");
|
let install = include_str!("../install.sh");
|
||||||
|
|||||||
Reference in New Issue
Block a user