alibuild 2.0.1__tar.gz → 2.0.2__tar.gz
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.
- {alibuild-2.0.1 → alibuild-2.0.2}/PKG-INFO +1 -1
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild.egg-info/PKG-INFO +1 -1
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/_version.py +3 -3
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/reconstruct.py +48 -6
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/sync_reapi.py +12 -6
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_reconstruct.py +60 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_sync_reapi.py +45 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/.claude/skills/s3-conditional-writes/SKILL.md +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/.claude/skills/support-architecture/SKILL.md +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/.flake8 +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/.github/dependabot.yml +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/.github/workflows/documentation.yml +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/.github/workflows/homebrew.yml +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/.github/workflows/pr-check.yml +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/.github/workflows/release.yml +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/.gitignore +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/.pylintrc +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/ANALYTICS.md +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/DESIGN.md +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/LICENSE.md +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/PACKAGING.md +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/README.rst +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/REMOTE_STORE_CAS_AC.md +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alfaBuild +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/aliBuild +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/aliDeps +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/aliDoctor +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild.egg-info/SOURCES.txt +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild.egg-info/dependency_links.txt +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild.egg-info/requires.txt +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild.egg-info/top_level.txt +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/__init__.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/analytics.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/args.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/build.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/build_template.sh +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/clean.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/cmd.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/completion.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/completions/__init__.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/completions/bash.sh +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/completions/zsh.sh +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/deps.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/doctor.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/git.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/init.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/install.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/keyring.json +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/log.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/migrate.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/sandbox.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/scm.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/signing.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/sl.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/source.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/sync.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/templating_plugin.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/utilities.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alibuild_helpers/workarea.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/alienv +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/codecov.yml +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/debian/changelog +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/debian/compat +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/debian/control +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/debian/copyright +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/debian/files +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/debian/rules +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/docs/SUPPORT +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/docs/docs/alice_logo.png +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/docs/docs/deps.png +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/docs/docs/index.md +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/docs/docs/quick.md +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/docs/docs/reference.md +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/docs/docs/stylesheets/extra.css +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/docs/docs/troubleshooting.md +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/docs/docs/user.md +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/docs/mkdocs.yml +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/extras/nix/alibuild_nix.jnj +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/extras/nix/alidist-aliphysics.nix +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/extras/nix/alidist-helpers.nix +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/extras/nix/alidist.nix +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/extras/nix/flake.lock +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/extras/nix/flake.nix +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/extras/nix/hyperloop.nix +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/extras/nix/hyperloopTest.nix +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/extras/nix/nix-interactive.bash +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/extras/nix/update-envs.sh +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/pb +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/pyproject.toml +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/requirements.txt +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/setup.cfg +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/setup.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/templates/alibuild_nix.jnj +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/templates/alibuild_to_please.jnj +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_analytics.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_args.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_build.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_clean.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_cmd.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_completion.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_deps.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_doctor.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_git.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_hashing.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_init.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_install.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_log.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_migrate.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_packagelist.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_parseRecipe.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_sandbox.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_signing.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_source.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_sync.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_utilities.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/test_workarea.py +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/testdist/broken1.sh +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/testdist/broken2.sh +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/testdist/broken3.sh +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/testdist/broken4.sh +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/testdist/broken5.sh +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/testdist/broken6.sh +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/testdist/broken7.sh +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/testdist/clobber-initdotsh.sh +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/testdist/defaults-o2.sh +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/testdist/delete-etc.sh +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tests/testdist/tracking-env.sh +0 -0
- {alibuild-2.0.1 → alibuild-2.0.2}/tox.ini +0 -0
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '2.0.
|
|
32
|
-
__version_tuple__ = version_tuple = (2, 0,
|
|
31
|
+
__version__ = version = '2.0.2'
|
|
32
|
+
__version_tuple__ = version_tuple = (2, 0, 2)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'g523c3af01'
|
|
@@ -93,6 +93,25 @@ def add_parser(subparsers, detected_arch, work_dir_default):
|
|
|
93
93
|
choices=("ephemeral", "permanent"),
|
|
94
94
|
help="Retention tag for a blob restored by --persist. Default '%(default)s' (a "
|
|
95
95
|
"deliberately reconstructed blob should not be LRU-expired).")
|
|
96
|
+
# Publishing options, spelt as `aliBuild build` spells them: --rebaseline --apply
|
|
97
|
+
# rewrites the legacy store object and link, and the AC entry it re-signs.
|
|
98
|
+
p.add_argument("--legacy-links-store", dest="legacyStore", default="", metavar="STORE",
|
|
99
|
+
help="As for 'aliBuild build': where the legacy TARS/<arch>/ links and "
|
|
100
|
+
"store objects live, if not in the artifact store.")
|
|
101
|
+
p.add_argument("--cas-public-url", dest="casPublicUrl", default="", metavar="URL",
|
|
102
|
+
help="As for 'aliBuild build': public base URL of the CAS bucket, which "
|
|
103
|
+
"the store objects in --legacy-links-store redirect to.")
|
|
104
|
+
p.add_argument("--sign-url", dest="signUrl", default="", metavar="URL",
|
|
105
|
+
help="Security-proxy sign route for the re-baselined AC entry. "
|
|
106
|
+
"--rebaseline --apply requires it unless --no-sign.")
|
|
107
|
+
p.add_argument("--sign-token", dest="signToken", default="", metavar="TOKEN",
|
|
108
|
+
help="Gate token presented to --sign-url.")
|
|
109
|
+
p.add_argument("--sign-token-file", dest="signTokenFile", default="", metavar="FILE",
|
|
110
|
+
help="Read the credential for --sign-url from FILE, for every request.")
|
|
111
|
+
p.add_argument("--signer", dest="signer", default="alibuild", metavar="NAME",
|
|
112
|
+
help="Signer label recorded in the signature. Default '%(default)s'.")
|
|
113
|
+
p.add_argument("--no-sign", dest="noSign", action="store_true",
|
|
114
|
+
help="Re-baseline without signing: the AC entry is left unsigned.")
|
|
96
115
|
return p
|
|
97
116
|
|
|
98
117
|
|
|
@@ -456,9 +475,12 @@ def verify_rebuild(args, sync, closure, build_runner=None):
|
|
|
456
475
|
or defaults_from_closure(sync, closure) or "release")
|
|
457
476
|
|
|
458
477
|
# Read-only remote store (no ::rw) => dependencies are fetched and reused,
|
|
459
|
-
# nothing is uploaded.
|
|
460
|
-
#
|
|
461
|
-
#
|
|
478
|
+
# nothing is uploaded. The action hash and the revision are in the tarball
|
|
479
|
+
# (.meta.json, init.sh, relocate-me.sh), so a rebuild can only reproduce the
|
|
480
|
+
# recorded bytes under the recorded ones: a missing blob is rebuilt anyway, and
|
|
481
|
+
# with the legacy links in view the recorded revision is reused. Only a present
|
|
482
|
+
# blob needs --force-rebuild, which randomises the hash and takes a localN
|
|
483
|
+
# revision, so that rebuild never matches. Propagate -d so the rebuild
|
|
462
484
|
# streams a debug build log when reconstruct is run with --debug (-d is a
|
|
463
485
|
# global flag, so it must precede the "build" subcommand).
|
|
464
486
|
# Re-invoke through the *same interpreter*, not just the same script: executing
|
|
@@ -476,10 +498,14 @@ def verify_rebuild(args, sync, closure, build_runner=None):
|
|
|
476
498
|
# dependency (e.g. alibuild-recipe-tools under the cwd) would otherwise
|
|
477
499
|
# be picked up as a development package -- rebuilt from local sources and,
|
|
478
500
|
# worse, disabling the remote write store for the whole build.
|
|
479
|
-
"--force-tracked",
|
|
480
|
-
|
|
501
|
+
"--force-tracked", "--defaults", defaults]
|
|
502
|
+
if sync.artifact_blob_exists(recorded_hash, algo):
|
|
503
|
+
cmd += ["--force-rebuild", args.package]
|
|
481
504
|
if ac_store:
|
|
482
505
|
cmd += ["--ac-store", ac_store]
|
|
506
|
+
if getattr(args, "legacyStore", ""):
|
|
507
|
+
cmd += ["--legacy-links-store", args.legacyStore,
|
|
508
|
+
"--cas-public-url", args.casPublicUrl]
|
|
483
509
|
if getattr(args, "insecure", False):
|
|
484
510
|
cmd += ["--insecure"]
|
|
485
511
|
if os.path.isdir(reference_dir):
|
|
@@ -686,10 +712,26 @@ def doReconstruct(args, parser):
|
|
|
686
712
|
ac_store = (getattr(args, "acStore", "") or "").rstrip()
|
|
687
713
|
if ac_store.endswith("::rw"):
|
|
688
714
|
ac_store = ac_store[:-4]
|
|
715
|
+
# A re-baseline changes the digest the AC entry's signature covers, so it must
|
|
716
|
+
# re-sign it: refuse to write without a way to, as `aliBuild build` does.
|
|
717
|
+
no_sign = getattr(args, "noSign", False)
|
|
718
|
+
dieOnError(getattr(args, "rebaseline", False) and getattr(args, "apply", False) and
|
|
719
|
+
not no_sign and not (getattr(args, "signUrl", "") and
|
|
720
|
+
(getattr(args, "signToken", "") or
|
|
721
|
+
getattr(args, "signTokenFile", ""))),
|
|
722
|
+
"--rebaseline --apply re-signs the rewritten Action Cache entry: pass "
|
|
723
|
+
"--sign-url and --sign-token (or --sign-token-file), or --no-sign to "
|
|
724
|
+
"leave it unsigned.")
|
|
689
725
|
sync = remote_from_url(args.remoteStore, args.remoteStore, args.architecture,
|
|
690
726
|
args.workDir, getattr(args, "insecure", False),
|
|
691
727
|
ac_url=ac_store, ac_write_url=ac_store,
|
|
692
|
-
storage=getattr(args, "storage", "permanent")
|
|
728
|
+
storage=getattr(args, "storage", "permanent"),
|
|
729
|
+
sign_url="" if no_sign else getattr(args, "signUrl", ""),
|
|
730
|
+
sign_token=getattr(args, "signToken", ""),
|
|
731
|
+
sign_token_file=getattr(args, "signTokenFile", ""),
|
|
732
|
+
signer=getattr(args, "signer", "alibuild"),
|
|
733
|
+
legacy_url=getattr(args, "legacyStore", ""),
|
|
734
|
+
cas_public_url=getattr(args, "casPublicUrl", ""))
|
|
693
735
|
dieOnError(not isinstance(sync, REAPIRemoteSync),
|
|
694
736
|
"'aliBuild reconstruct' requires a reapi:// remote store, but got %r" %
|
|
695
737
|
(args.remoteStore or "(none)"))
|
|
@@ -861,7 +861,7 @@ class REAPIRemoteSync(Boto3RemoteSync):
|
|
|
861
861
|
match = re.search(r"store/[0-9a-f]{2}/([0-9a-f]+)/", target)
|
|
862
862
|
return match.group(1) if match else None
|
|
863
863
|
|
|
864
|
-
def migrate_put(self, ac_entry, tarball_path, recipe_text):
|
|
864
|
+
def migrate_put(self, ac_entry, tarball_path, recipe_text, sign=False):
|
|
865
865
|
"""Write a migrated legacy release into the reapi store: the tarball as a
|
|
866
866
|
CAS blob, the recovered recipe blob, the Action Cache entry, plus the legacy
|
|
867
867
|
store redirect and per-package link so it stays installable and
|
|
@@ -870,7 +870,8 @@ class REAPIRemoteSync(Boto3RemoteSync):
|
|
|
870
870
|
Migrated entries are intentionally left *unsigned*: their provenance is
|
|
871
871
|
reconstructed after the fact, so a signature would falsely assert a trusted
|
|
872
872
|
signer built them. They are consumed as legacy (tolerated under
|
|
873
|
-
--require-signature=warn, refused under require).
|
|
873
|
+
--require-signature=warn, refused under require). Only a re-baseline, which
|
|
874
|
+
rebuilt the tarball itself, passes sign=True."""
|
|
874
875
|
action = ac_entry["action"]
|
|
875
876
|
arch, pkg = action["architecture"], action["package"]
|
|
876
877
|
action_hash = action["actionHash"]
|
|
@@ -892,6 +893,8 @@ class REAPIRemoteSync(Boto3RemoteSync):
|
|
|
892
893
|
"outputDigest": "%s:%s" % (self.CAS_ALGO, content_hash),
|
|
893
894
|
"size": os.path.getsize(tarball_path),
|
|
894
895
|
})
|
|
896
|
+
if sign:
|
|
897
|
+
entry = self._sign_ac_entry(entry)
|
|
895
898
|
ac_path = resolve_ac_path(arch, action_hash)
|
|
896
899
|
debug("S3 put_object %s/%s (AC entry)", self.acWriteStore, ac_path)
|
|
897
900
|
self.s3.put_object(Bucket=self.acWriteStore, Key=ac_path,
|
|
@@ -899,14 +902,14 @@ class REAPIRemoteSync(Boto3RemoteSync):
|
|
|
899
902
|
ContentType="application/json")
|
|
900
903
|
|
|
901
904
|
store_key = os.path.join(resolve_store_path(arch, action_hash), tarball)
|
|
902
|
-
debug("S3 put_object %s/%s (store redirect)", self.
|
|
905
|
+
debug("S3 put_object %s/%s (store redirect)", self.legacyWriteStore, store_key)
|
|
903
906
|
self.s3.put_object(Bucket=self.legacyWriteStore, Key=store_key,
|
|
904
907
|
Body=os.fsencode(cas_path),
|
|
905
908
|
WebsiteRedirectLocation=self._cas_redirect(cas_path))
|
|
906
909
|
|
|
907
910
|
link_target = "../../%s/store/%s/%s/%s" % (arch, action_hash[:2], action_hash, tarball)
|
|
908
911
|
link_key = os.path.join(resolve_links_path(arch, pkg), tarball)
|
|
909
|
-
debug("S3 put_object %s/%s (link)", self.
|
|
912
|
+
debug("S3 put_object %s/%s (link)", self.legacyWriteStore, link_key)
|
|
910
913
|
# The link stays RELATIVE: it points at the store object beside it in the
|
|
911
914
|
# same tree, and the client reads its body rather than following the header.
|
|
912
915
|
self.s3.put_object(Bucket=self.legacyWriteStore, Key=link_key,
|
|
@@ -971,7 +974,9 @@ class REAPIRemoteSync(Boto3RemoteSync):
|
|
|
971
974
|
is an in-place pointer swap. The new blob is stored *before* the AC entry is
|
|
972
975
|
repointed, so a failure never leaves the entry dangling; the old blob is left
|
|
973
976
|
orphaned (delete it separately via delete_artifact_blob). The retention of the
|
|
974
|
-
blob being replaced is preserved (untagged == keep-forever == permanent).
|
|
977
|
+
blob being replaced is preserved (untagged == keep-forever == permanent). The
|
|
978
|
+
old signatures covered the old digest: they are dropped, and the entry is
|
|
979
|
+
signed afresh when signing is configured.
|
|
975
980
|
Returns (old_hash, new_hash, old_cas_path)."""
|
|
976
981
|
old_digest = (entry.get("result") or {}).get("outputDigest", "")
|
|
977
982
|
old_hash = old_digest.split(":", 1)[-1]
|
|
@@ -982,7 +987,8 @@ class REAPIRemoteSync(Boto3RemoteSync):
|
|
|
982
987
|
self.storage = self._retention_of(self.writeStore, old_cas_path) or "permanent"
|
|
983
988
|
try:
|
|
984
989
|
new_hash = self.migrate_put(
|
|
985
|
-
{k: v for k, v in entry.items() if k
|
|
990
|
+
{k: v for k, v in entry.items() if k not in ("result", "signatures")},
|
|
991
|
+
tarball_path, recipe_text, sign=True)
|
|
986
992
|
finally:
|
|
987
993
|
self.storage = prev_storage
|
|
988
994
|
return old_hash, new_hash, old_cas_path
|
|
@@ -551,6 +551,66 @@ class ReconstructTestCase(unittest.TestCase):
|
|
|
551
551
|
workDir="/sw", outputConfig=None)
|
|
552
552
|
self.assertRaises(SystemExit, doReconstruct, args, None)
|
|
553
553
|
|
|
554
|
+
def _publish_args(self, **kw):
|
|
555
|
+
return Namespace(package="zlib", version="v1", revision="1", architecture=ARCH,
|
|
556
|
+
remoteStore="reapi://proxy/cas", acStore="reapi://proxy/ac::rw",
|
|
557
|
+
insecure=True, workDir="/sw", outputConfig=None,
|
|
558
|
+
rebaseline=True, apply=True, legacyStore="reapi://proxy/repo",
|
|
559
|
+
casPublicUrl="https://example/cas", **kw)
|
|
560
|
+
|
|
561
|
+
def test_doReconstruct_refuses_rebaseline_apply_without_signer(self):
|
|
562
|
+
with patch("alibuild_helpers.reconstruct.remote_from_url") as remote:
|
|
563
|
+
self.assertRaises(SystemExit, doReconstruct, self._publish_args(), None)
|
|
564
|
+
remote.assert_not_called() # refused before touching any store
|
|
565
|
+
|
|
566
|
+
def test_doReconstruct_passes_publishing_options_like_build(self):
|
|
567
|
+
# Stop right after the store is built: it is not a REAPIRemoteSync.
|
|
568
|
+
for no_sign, sign_url in ((False, "https://proxy/sign"), (True, "")):
|
|
569
|
+
args = self._publish_args(signUrl="https://proxy/sign", signToken="",
|
|
570
|
+
signTokenFile="/tok", signer="ci", noSign=no_sign)
|
|
571
|
+
with patch("alibuild_helpers.reconstruct.remote_from_url",
|
|
572
|
+
return_value=object()) as remote:
|
|
573
|
+
self.assertRaises(SystemExit, doReconstruct, args, None)
|
|
574
|
+
kw = remote.call_args.kwargs
|
|
575
|
+
self.assertEqual((kw["legacy_url"], kw["cas_public_url"]),
|
|
576
|
+
("reapi://proxy/repo", "https://example/cas"))
|
|
577
|
+
self.assertEqual((kw["sign_url"], kw["sign_token_file"], kw["signer"]),
|
|
578
|
+
(sign_url, "/tok", "ci"))
|
|
579
|
+
|
|
580
|
+
@patch("alibuild_helpers.signing.sign_via_proxy")
|
|
581
|
+
@patch("alibuild_helpers.sync_reapi.REAPIRemoteSync._s3_init", new=MagicMock())
|
|
582
|
+
def test_do_rebaseline_reproduced_digest_leaves_ac_entry_untouched(self, sign_via_proxy):
|
|
583
|
+
s = sync_reapi.REAPIRemoteSync(
|
|
584
|
+
"reapi://proxy/cas", "reapi://proxy/cas", ARCH, "/sw",
|
|
585
|
+
legacyStore="reapi://proxy/repo", casPublicUrl="https://example/cas",
|
|
586
|
+
sign_url="https://proxy/sign", sign_token="tok")
|
|
587
|
+
s.s3 = MagicMock()
|
|
588
|
+
result = RebuildResult(True, kind="match", algo="sha256",
|
|
589
|
+
recorded="a" * 64, rebuilt="a" * 64, tarball="/x")
|
|
590
|
+
self.assertTrue(do_rebaseline(Namespace(package="zlib", version="v1", apply=True,
|
|
591
|
+
delete_old=False), s,
|
|
592
|
+
[self._rebaseline_entry()], result))
|
|
593
|
+
sign_via_proxy.assert_not_called()
|
|
594
|
+
s.s3.put_object.assert_not_called()
|
|
595
|
+
s.s3.upload_file.assert_not_called()
|
|
596
|
+
|
|
597
|
+
def test_verify_rebuild_keeps_the_recorded_hash_and_revision(self):
|
|
598
|
+
"""A missing blob is rebuilt under its recorded action hash and revision,
|
|
599
|
+
which are in the tarball: no --force-rebuild, and the legacy links in view."""
|
|
600
|
+
closure = [make_entry("zlib", "v1", "1", "c" * 64, "rz")]
|
|
601
|
+
args = self._rebuild_args()
|
|
602
|
+
args.legacyStore, args.casPublicUrl = "reapi://x/repo", "https://example/cas"
|
|
603
|
+
for present, forced in ((False, False), (True, True)):
|
|
604
|
+
commands = []
|
|
605
|
+
with patch("alibuild_helpers.reconstruct.materialize_recipes"), \
|
|
606
|
+
patch("alibuild_helpers.reconstruct.restore_sources", return_value=([], [])), \
|
|
607
|
+
patch("alibuild_helpers.reconstruct.GitSourceStore"):
|
|
608
|
+
verify_rebuild(args, self.make_sync({"c" * 64} if present else ()), closure,
|
|
609
|
+
build_runner=lambda cmd: commands.append(cmd) or 1)
|
|
610
|
+
self.assertEqual("--force-rebuild" in commands[0], forced)
|
|
611
|
+
self.assertIn("--legacy-links-store", commands[0])
|
|
612
|
+
self.assertIn("https://example/cas", commands[0])
|
|
613
|
+
|
|
554
614
|
|
|
555
615
|
if __name__ == "__main__":
|
|
556
616
|
unittest.main()
|
|
@@ -572,6 +572,51 @@ class REAPIRemoteSyncTestCase(unittest.TestCase):
|
|
|
572
572
|
# storage restored to its original value afterwards (no leak).
|
|
573
573
|
self.assertEqual(reapi.storage, "ephemeral")
|
|
574
574
|
|
|
575
|
+
@patch("alibuild_helpers.signing.sign_via_proxy")
|
|
576
|
+
@patch("os.path.getsize", new=MagicMock(return_value=4096))
|
|
577
|
+
def test_rebaseline_resigns_and_publishes_to_the_legacy_store(self, sign_via_proxy) -> None:
|
|
578
|
+
"""A re-baselined entry carries a fresh signature over the NEW digest, and
|
|
579
|
+
its store object and link go to the legacy bucket with an absolute redirect."""
|
|
580
|
+
sign_via_proxy.return_value = {"keyid": "new", "signer": "ci", "sig": "fresh"}
|
|
581
|
+
old_hash, new_hash = "a" * 64, "b" * 64
|
|
582
|
+
client = self.make_client()
|
|
583
|
+
reapi = sync_reapi.REAPIRemoteSync(
|
|
584
|
+
remoteStore="reapi://localhost/bucket", writeStore="reapi://localhost/bucket",
|
|
585
|
+
architecture=ARCHITECTURE, workdir="/sw", legacyStore="reapi://localhost/legacy",
|
|
586
|
+
casPublicUrl="https://example/cas", sign_url="https://proxy/sign",
|
|
587
|
+
sign_token="tok")
|
|
588
|
+
reapi.s3 = client
|
|
589
|
+
entry = {
|
|
590
|
+
"schemaVersion": 3,
|
|
591
|
+
"action": {"package": "zlib", "version": "v1", "revision": "1",
|
|
592
|
+
"architecture": ARCHITECTURE, "actionHash": REAPI_HASH,
|
|
593
|
+
"recipeDigest": "sha256:" + REAPI_RECIPE_DIGEST},
|
|
594
|
+
"result": {"tarball": "zlib-v1-1.%s.tar.gz" % ARCHITECTURE,
|
|
595
|
+
"outputDigest": "sha256:" + old_hash, "size": 1},
|
|
596
|
+
"signatures": [{"keyid": "old", "signer": "ci", "sig": "stale"}],
|
|
597
|
+
}
|
|
598
|
+
with patch("alibuild_helpers.sync_reapi.file_digest", return_value=new_hash):
|
|
599
|
+
reapi.rebaseline_ac_entry(entry, "/tmp/zlib.tar.gz", "recipe")
|
|
600
|
+
# Signed over the new digest, with the stale signature gone.
|
|
601
|
+
signed = sign_via_proxy.call_args.args[0]
|
|
602
|
+
self.assertEqual(signed["result"]["outputDigest"], "sha256:" + new_hash)
|
|
603
|
+
self.assertNotIn("signatures", signed)
|
|
604
|
+
puts = {c.kwargs["Key"]: c.kwargs for c in client.put_object.call_args_list}
|
|
605
|
+
ac = json.loads(puts[resolve_ac_path(ARCHITECTURE, REAPI_HASH)]["Body"].decode())
|
|
606
|
+
self.assertEqual(ac["signatures"], [sign_via_proxy.return_value])
|
|
607
|
+
self.assertEqual(ac["result"]["outputDigest"], "sha256:" + new_hash)
|
|
608
|
+
# Store object and link: legacy bucket, absolute redirect to the new blob.
|
|
609
|
+
tarball = "zlib-v1-1.%s.tar.gz" % ARCHITECTURE
|
|
610
|
+
stub = puts[resolve_store_path(ARCHITECTURE, REAPI_HASH) + "/" + tarball]
|
|
611
|
+
link = puts[resolve_links_path(ARCHITECTURE, "zlib") + "/" + tarball]
|
|
612
|
+
self.assertEqual(stub["Bucket"], "legacy")
|
|
613
|
+
self.assertEqual(stub["WebsiteRedirectLocation"],
|
|
614
|
+
"https://example/cas/" + resolve_cas_path(new_hash))
|
|
615
|
+
self.assertEqual(link["Bucket"], "legacy")
|
|
616
|
+
# The bytes and the ledger stay where they were.
|
|
617
|
+
self.assertEqual(client.upload_file.call_args.kwargs["Bucket"], "bucket")
|
|
618
|
+
self.assertEqual(puts[resolve_ac_path(ARCHITECTURE, REAPI_HASH)]["Bucket"], "bucket")
|
|
619
|
+
|
|
575
620
|
@patch("alibuild_helpers.sync_reapi.file_digest", new=MagicMock(return_value="e" * 64))
|
|
576
621
|
@patch("os.path.getsize", new=MagicMock(return_value=4096))
|
|
577
622
|
def test_put_legacy_artifact(self) -> None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|