Add some Drydock documentation plus "Test Configuration" for repository automation
Summary: Ref T182. Ref T9252. - Adds a "Test" repository operation that just runs `git status` to see if things work. - Adds a button for it in Edit Repository. - Shows operation status on the operation detail view to make this workflow work a little better. - Adds a lot of words. Words words words words. Test Plan: - Tested repository operation. - Read words. Reviewers: chad Reviewed By: chad Maniphest Tasks: T182, T9252 Differential Revision: https://secure.phabricator.com/D14349
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
final class DiffusionRepositoryTestAutomationController
|
||||
extends DiffusionRepositoryEditController {
|
||||
|
||||
protected function processDiffusionRequest(AphrontRequest $request) {
|
||||
$viewer = $this->getViewer();
|
||||
$drequest = $this->diffusionRequest;
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
$repository = id(new PhabricatorRepositoryQuery())
|
||||
->setViewer($viewer)
|
||||
->requireCapabilities(
|
||||
array(
|
||||
PhabricatorPolicyCapability::CAN_VIEW,
|
||||
PhabricatorPolicyCapability::CAN_EDIT,
|
||||
))
|
||||
->withIDs(array($repository->getID()))
|
||||
->executeOne();
|
||||
if (!$repository) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
|
||||
|
||||
if (!$repository->canPerformAutomation()) {
|
||||
return $this->newDialog()
|
||||
->setTitle(pht('Automation Not Configured'))
|
||||
->appendParagraph(
|
||||
pht(
|
||||
'You can not run a configuration test for this repository '.
|
||||
'because you have not configured repository automation yet. '.
|
||||
'Configure it first, then test the configuration.'))
|
||||
->addCancelButton($edit_uri);
|
||||
}
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
$op = new DrydockTestRepositoryOperation();
|
||||
|
||||
$operation = DrydockRepositoryOperation::initializeNewOperation($op)
|
||||
->setAuthorPHID($viewer->getPHID())
|
||||
->setObjectPHID($repository->getPHID())
|
||||
->setRepositoryPHID($repository->getPHID())
|
||||
->setRepositoryTarget('none:')
|
||||
->save();
|
||||
|
||||
$operation->scheduleUpdate();
|
||||
|
||||
$operation_id = $operation->getID();
|
||||
$operation_uri = "/drydock/operation/{$operation_id}/";
|
||||
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI($operation_uri);
|
||||
}
|
||||
|
||||
return $this->newDialog()
|
||||
->setTitle(pht('Test Automation Configuration'))
|
||||
->appendParagraph(
|
||||
pht(
|
||||
'This configuration test will build a working copy of the '.
|
||||
'repository and perform some basic validation. If it works, '.
|
||||
'your configuration is substantially correct.'))
|
||||
->appendParagraph(
|
||||
pht(
|
||||
'The test will not perform any writes against the repository, so '.
|
||||
'write operations may still fail even if the test passes. This '.
|
||||
'test covers building and reading working copies, but not writing '.
|
||||
'to them.'))
|
||||
->appendParagraph(
|
||||
pht(
|
||||
'If you run into write failures despite passing this test, '.
|
||||
'it suggests that your setup is nearly correct but authentication '.
|
||||
'is probably not fully configured.'))
|
||||
->addCancelButton($edit_uri)
|
||||
->addSubmitButton(pht('Start Test'));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user