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
21 changes: 18 additions & 3 deletions .github/scripts/verify-published-packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def metadata(package_bytes):
repository.get("commit") if repository is not None else None)


def verify(directory, commit, timeout):
def packed_metadata(directory, commit, expected_version):
packages = sorted(directory.glob("*.nupkg"))
if not packages:
raise ValueError("No packages to verify")
Expand All @@ -31,9 +31,18 @@ def verify(directory, commit, timeout):
package_id, version, source_commit = identity
if not re.fullmatch(r"ManagedCode\.Storage(?:\.[A-Za-z0-9_.-]+)?", package_id):
raise ValueError(f"Unexpected package identity: {package_id}")
if version != expected_version:
raise ValueError(f"{package_id}: packed version {version} does not match the release version {expected_version}")
if source_commit != commit:
raise ValueError(f"{package_id}: packed repository commit does not match the release commit")
if package_id in pending:
raise ValueError(f"{package_id}: duplicate packed artifact")
pending[package_id] = identity
return pending


def verify(pending, commit, timeout):
package_count = len(pending)
deadline = time.monotonic() + timeout
while pending:
for package_id, identity in list(pending.items()):
Expand All @@ -56,13 +65,19 @@ def verify(directory, commit, timeout):
if time.monotonic() >= deadline:
raise TimeoutError("Packages unavailable before the publication deadline: " + ", ".join(pending))
time.sleep(min(20, max(0, deadline - time.monotonic())))
print(f"Verified all {len(packages)} published packages", flush=True)
print(f"Verified all {package_count} published packages", flush=True)


if __name__ == "__main__":
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("directory", type=Path)
parser.add_argument("commit")
parser.add_argument("version")
parser.add_argument("--packed-only", action="store_true")
parser.add_argument("--timeout-seconds", type=int, default=600)
arguments = parser.parse_args()
verify(arguments.directory, arguments.commit, arguments.timeout_seconds)
packages = packed_metadata(arguments.directory, arguments.commit, arguments.version)
if arguments.packed_only:
print(f"Verified all {len(packages)} packed artifacts for release {arguments.version}", flush=True)
else:
verify(packages, arguments.commit, arguments.timeout_seconds)
9 changes: 8 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ jobs:
- name: Pack NuGet packages
run: dotnet pack ManagedCode.Storage.slnx --configuration Release --no-build -p:IncludeSymbols=false -p:SymbolPackageFormat=snupkg --output ./artifacts

- name: Verify every packed artifact
env:
RELEASE_VERSION: ${{ steps.version.outputs.version }}
run: python3 .github/scripts/verify-published-packages.py ./artifacts "$GITHUB_SHA" "$RELEASE_VERSION" --packed-only

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -162,7 +167,9 @@ jobs:
fi

- name: Verify every package on the public feed
run: python3 .github/scripts/verify-published-packages.py ./artifacts "${{ github.sha }}"
env:
RELEASE_VERSION: ${{ needs.build.outputs.version }}
run: python3 .github/scripts/verify-published-packages.py ./artifacts "$GITHUB_SHA" "$RELEASE_VERSION"

create-release:
name: Create GitHub Release and Tag
Expand Down
1 change: 0 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
<PackageProjectUrl>https://github.com/managedcode/Storage</PackageProjectUrl>
<Product>Managed Code - Storage</Product>
<Version>10.1.16</Version>
<PackageVersion>10.1.15</PackageVersion>

</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion docs/Development/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ The HTTP tests run the library's `StorageControllerBase` against Kestrel and the

Regression tests also cover offset and EOF handling in VFS reads, directory statistics, deletion-cache invalidation, failed synchronous/asynchronous write commits, canceled container creation, native SFTP upload cancellation, password/private-key SFTP round trips, and existing files without extensions. Actual InputFile browser uploads verify byte integrity through both memory/disk branches and controller/storage helpers, configured limits above 500 KB, and disposal of the upload-owned temporary files. Azure SDK stream creation and option callbacks retain container identity and credential references; Google Drive default options retain the shared-drive flag. `LocalFile` preserves the path of an existing extensionless file; generated extensionless paths retain their temporary-file naming policy.

The release workflow validates every published `.nupkg` against its packed identity, version and repository commit on the public NuGet feed before creating the GitHub release. A successful push command alone is not a publication receipt.
Set the release version once in `Directory.Build.props`. NuGet packing inherits that version from `Version`. The release workflow checks each packed artifact against the expected version and commit before publication, then verifies every published package against the packed identity on the public NuGet feed before creating the GitHub release.

### Container versions and service qualification

Expand Down
Loading