A canary tag now carries its kind as a prefix, canary.<UTC stamp>-v<stable>,
the same claim shape as a stable rc.N-v<stable>. It never matches v*, and it
is the canary's identity everywhere: GitHub prerelease, archive, stamped tag
and Docker image tag. The version it publishes stays <stable>+canary.<stamp>.
No installed canaries exist yet, so clients just switch to the new shape;
release tooling still reads the retired v<stable>+canary.<stamp> shape in
records published before (previous channel head, live macOS feed, pruning),
so the first new canary can replace them.
The tag message is now the canary's claim: the lanes it runs and whether a
red suite holds its publication. release.py --canary takes --only/--with/
--without (starting from every lane but the signed-package upgrade arms,
which a canary can never claim) and --require-green/--no-require-green
(default on; release refuses --no-require-green). Admission emits
require-green; publish-canary waits for acceptance when it is on, and
channel_releases custody re-requires acceptance (fail closed). The daily
scheduled canary passes --no-require-green; a manual dispatch defaults to
green. publish-canary needs the full desktop set the canary channel serves.
Tag-to-version derivation goes through one helper per language
(update_channel.release_version, msix-shared releaseVersion, desktop
releaseTagVersion, deb_version.py --release-version) instead of stripping a
leading v. Also fixes the Store-entrypoint test left stale by canary Store
packaging, and the canary git fixture's file:// remote on Windows.
[BearHuddleston: adapted to main 32dbc1dcda — preserved #154321 canary draft body cap and recovery tests, kept #148651 desktop_targets / omitted macos-intel, and updated #154545 test_linux_desktop_builds.py for canary.<stamp>-vX.Y.Z]
(cherry picked from commit c9e3831d3dad6965c7ddea3fa900a0ace0d45423)
58 lines
2.9 KiB
Python
58 lines
2.9 KiB
Python
"""App Installer descriptors bind explicit package facts to explicit feed URLs."""
|
|
import subprocess
|
|
import sys
|
|
import xml.etree.ElementTree as ET
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from scripts.bundles import release_artifacts as artifacts
|
|
from tests.scripts.test_release_r2 import r2_server
|
|
|
|
|
|
@pytest.mark.parametrize('variant', ['bundled', 'light'])
|
|
def test_canary_publication_verifies_native_identity_and_uploads_bundle_before_pointer(tmp_path, r2_server, variant):
|
|
import zipfile
|
|
|
|
tag, version = 'canary.20260902T000000Z-v1.2.4', '1.2.4.1440'
|
|
identity, publisher = f'Fixture.{variant}.Canary', 'CN=Fixture & Team'
|
|
bundle = tmp_path / 'app.msixbundle'
|
|
manifest = ET.Element('Bundle')
|
|
ET.SubElement(manifest, 'Identity', {'Name': identity, 'Publisher': publisher, 'Version': version})
|
|
with zipfile.ZipFile(bundle, 'w') as archive:
|
|
archive.writestr('AppxMetadata/AppxBundleManifest.xml', ET.tostring(manifest))
|
|
base = 'https://releases.example'
|
|
directory = f"releases/win32/{'light/' if variant == 'light' else ''}canary"
|
|
pointer = f'{directory}/canary.appinstaller'
|
|
args = ['publish-appinstaller', '--root', str(tmp_path), '--tag', tag, '--variant', variant,
|
|
'--bundle', str(bundle), '--identity', identity, '--publisher', publisher, '--version', version,
|
|
'--public-base', base]
|
|
artifacts.main(args)
|
|
assert r2_server.store[f'{directory}/{bundle.name}'][0] == bundle.read_bytes()
|
|
descriptor = ET.fromstring(r2_server.store[pointer][0])
|
|
assert descriptor.attrib == {'Uri': f'{base}/{pointer}', 'Version': version}
|
|
assert descriptor.find('{*}MainBundle').attrib == {
|
|
'Name': identity, 'Publisher': publisher, 'Version': version, 'Uri': f'{base}/{directory}/{bundle.name}',
|
|
}
|
|
requests = [(method, path.rsplit('/', 1)[-1]) for method, path, _ in r2_server.requests]
|
|
assert requests.index(('HEAD', bundle.name)) < requests.index(('PUT', 'canary.appinstaller'))
|
|
previous = r2_server.store[pointer]
|
|
for option, bad in [('--identity', 'Wrong'), ('--publisher', 'CN=Wrong'), ('--version', '9.9.9.0'),
|
|
('--tag', 'v1.2.4'), ('--tag', 'a' * 40), ('--variant', 'store')]:
|
|
invalid = list(args)
|
|
invalid[invalid.index(option) + 1] = bad
|
|
r2_server.requests.clear()
|
|
with pytest.raises((ValueError, SystemExit)):
|
|
artifacts.main(invalid)
|
|
assert not r2_server.requests
|
|
assert r2_server.store[pointer] == previous
|
|
|
|
# Fail a real immutable upload by occupying its name with different bytes.
|
|
r2_server.store[f'{directory}/{bundle.name}'] = (b'other bundle', 'application/msixbundle')
|
|
r2_server.requests.clear()
|
|
with pytest.raises(ValueError, match='checksum mismatch'):
|
|
artifacts.main(args)
|
|
assert not any(method == 'PUT' and path.endswith('canary.appinstaller')
|
|
for method, path, _ in r2_server.requests)
|
|
assert r2_server.store[pointer] == previous
|