1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 23:40:57 +01:00

Support reading and querying Almanac service PHIDs via "diffusion.repository.search"

Summary:
Ref T13222. See PHI992. If you lose all hosts in a service cluster, you may need to get a list of affected repositories to figure out which backups to pull.

Support doing this via the API.

Test Plan: Queried by service PHID and saw service PHIDs in the call results.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13222

Differential Revision: https://secure.phabricator.com/D19848
This commit is contained in:
epriestley 2018-12-05 11:34:52 -08:00
parent 70bf63bc3a
commit 5d54f26dac
2 changed files with 21 additions and 0 deletions

View file

@ -44,6 +44,15 @@ final class PhabricatorRepositorySearchEngine
->setKey('uris')
->setDescription(
pht('Search for repositories by clone/checkout URI.')),
id(new PhabricatorPHIDsSearchField())
->setLabel(pht('Services'))
->setKey('almanacServicePHIDs')
->setAliases(
array(
'almanacServicePHID',
'almanacService',
'almanacServices',
)),
);
}
@ -80,6 +89,10 @@ final class PhabricatorRepositorySearchEngine
$query->withURIs($map['uris']);
}
if ($map['almanacServicePHIDs']) {
$query->withAlmanacServicePHIDs($map['almanacServicePHIDs']);
}
return $query;
}

View file

@ -2773,6 +2773,13 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
->setDescription(
pht(
'True if the repository is importing initial commits.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('almanacServicePHID')
->setType('phid?')
->setDescription(
pht(
'The Almanac Service that hosts this repository, if the '.
'repository is clustered.')),
);
}
@ -2784,6 +2791,7 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
'shortName' => $this->getRepositorySlug(),
'status' => $this->getStatus(),
'isImporting' => (bool)$this->isImporting(),
'almanacServicePHID' => $this->getAlmanacServicePHID(),
);
}