diff --git a/src/applications/harbormaster/query/HarbormasterBuildArtifactQuery.php b/src/applications/harbormaster/query/HarbormasterBuildArtifactQuery.php index 79cee61a1b..077e77a4bd 100644 --- a/src/applications/harbormaster/query/HarbormasterBuildArtifactQuery.php +++ b/src/applications/harbormaster/query/HarbormasterBuildArtifactQuery.php @@ -8,6 +8,7 @@ final class HarbormasterBuildArtifactQuery private $artifactTypes; private $artifactKeys; private $keyBuildPHID; + private $keyBuildGeneration; public function withIDs(array $ids) { $this->ids = $ids; @@ -24,8 +25,12 @@ final class HarbormasterBuildArtifactQuery 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 @@ final class HarbormasterBuildArtifactQuery $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 index e6849ac17d..2c4b4f9bab 100644 --- a/src/applications/harbormaster/storage/build/HarbormasterBuild.php +++ b/src/applications/harbormaster/storage/build/HarbormasterBuild.php @@ -213,7 +213,10 @@ final class HarbormasterBuild extends HarbormasterDAO $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 @@ final class HarbormasterBuild extends HarbormasterDAO ->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 index 74b85532bc..08608a746b 100644 --- a/src/applications/harbormaster/storage/build/HarbormasterBuildArtifact.php +++ b/src/applications/harbormaster/storage/build/HarbormasterBuildArtifact.php @@ -38,9 +38,9 @@ final class HarbormasterBuildArtifact extends HarbormasterDAO 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; }