hammerkit 2.0.0-next.10 → 2.0.0-next.11

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.
@@ -720,13 +720,19 @@ function getPrivilegedNamespaceProblem(namespace, labels, backend) {
720
720
  `${namespace} ${ENFORCE_LABEL}=baseline ${AUDIT_LABEL}- --overwrite`);
721
721
  }
722
722
  exports.getPrivilegedNamespaceProblem = getPrivilegedNamespaceProblem;
723
- // What may mount a claim a run kept: the runs of the same repository, as they share the
724
- // cache, and on a sandbox the runs of that sandbox only, whose claim is on the same node or
725
- // zone as the kept ones. The owner is the namespace's.
723
+ // What may mount a claim a run kept: the runs of the same branch or tag of a repository,
724
+ // which share its cache, so that the runs of two branches go side by side and the runs of one find what
725
+ // the last one left; on a sandbox the runs of that sandbox only, whose claim is on the same
726
+ // node or zone as the kept ones. The owner is the namespace's.
726
727
  function getVolumeScope(run) {
727
728
  if (run.source.type === 'sandbox' && !run.source.check) {
728
729
  return `sandbox-${(0, crypto_1.createHash)('sha256').update(run.source.id).digest('hex').slice(0, 24)}`;
729
730
  }
731
+ // a ref given as a commit hash names no branch: its runs keep the repository's claims
732
+ if (run.source.type === 'ref' && !/^[0-9a-f]{40}([0-9a-f]{24})?$/i.test(run.source.ref)) {
733
+ const key = `ref\0${run.source.repo}\0${run.source.ref}`;
734
+ return `ref-${(0, crypto_1.createHash)('sha256').update(key).digest('hex').slice(0, 24)}`;
735
+ }
730
736
  return (0, executor_1.cacheNamespace)(run);
731
737
  }
732
738
  exports.getVolumeScope = getVolumeScope;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hammerkit",
3
3
  "description": "Containerized build tool with incremental caching that runs the same build file locally, in Docker and on Kubernetes.",
4
- "version": "2.0.0-next.10",
4
+ "version": "2.0.0-next.11",
5
5
  "keywords": [
6
6
  "build",
7
7
  "build-tool",