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; }