Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14025833
D10336.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D10336.diff
View Options
diff --git a/src/applications/harbormaster/query/HarbormasterBuildArtifactQuery.php b/src/applications/harbormaster/query/HarbormasterBuildArtifactQuery.php
--- a/src/applications/harbormaster/query/HarbormasterBuildArtifactQuery.php
+++ b/src/applications/harbormaster/query/HarbormasterBuildArtifactQuery.php
@@ -8,6 +8,7 @@
private $artifactTypes;
private $artifactKeys;
private $keyBuildPHID;
+ private $keyBuildGeneration;
public function withIDs(array $ids) {
$this->ids = $ids;
@@ -24,8 +25,12 @@
return $this;
}
- public function withArtifactKeys($build_phid, array $artifact_keys) {
+ public function withArtifactKeys(
+ $build_phid,
+ $build_gen,
+ array $artifact_keys) {
$this->keyBuildPHID = $build_phid;
+ $this->keyBuildGeneration = $build_gen;
$this->artifactKeys = $artifact_keys;
return $this;
}
@@ -98,7 +103,7 @@
$indexes = array();
foreach ($this->artifactKeys as $key) {
$indexes[] = PhabricatorHash::digestForIndex(
- $this->keyBuildPHID.$key);
+ $this->keyBuildPHID.$this->keyBuildGeneration.$key);
}
$where[] = qsprintf(
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuild.php b/src/applications/harbormaster/storage/build/HarbormasterBuild.php
--- a/src/applications/harbormaster/storage/build/HarbormasterBuild.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuild.php
@@ -213,7 +213,10 @@
$artifact =
HarbormasterBuildArtifact::initializeNewBuildArtifact($build_target);
- $artifact->setArtifactKey($this->getPHID(), $artifact_key);
+ $artifact->setArtifactKey(
+ $this->getPHID(),
+ $this->getBuildGeneration(),
+ $artifact_key);
$artifact->setArtifactType($artifact_type);
$artifact->save();
return $artifact;
@@ -224,6 +227,7 @@
->setViewer(PhabricatorUser::getOmnipotentUser())
->withArtifactKeys(
$this->getPHID(),
+ $this->getBuildGeneration(),
array($name))
->executeOne();
if ($artifact === null) {
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuildArtifact.php b/src/applications/harbormaster/storage/build/HarbormasterBuildArtifact.php
--- a/src/applications/harbormaster/storage/build/HarbormasterBuildArtifact.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuildArtifact.php
@@ -38,9 +38,9 @@
return $this->assertAttached($this->buildTarget);
}
- public function setArtifactKey($build_phid, $key) {
+ public function setArtifactKey($build_phid, $build_gen, $key) {
$this->artifactIndex =
- PhabricatorHash::digestForIndex($build_phid.$key);
+ PhabricatorHash::digestForIndex($build_phid.$build_gen.$key);
$this->artifactKey = $key;
return $this;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 8, 8:47 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6737615
Default Alt Text
D10336.diff (2 KB)
Attached To
Mode
D10336: Prevent artifact key collision when builds are restarted
Attached
Detach File
Event Timeline
Log In to Comment