Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Slack to Owners Page (Proof of Concept, do not land) #872

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
13ec744
[phab] Add retries to HTTP POST harbormaster builds as well as grafan…
Sep 28, 2021
b527033
Return artifactData in harbormaster.artifact.search API call
gsilk Aug 24, 2021
386590f
[DEVX-2064] disable foist upon and commandeer
txchen Oct 25, 2021
b31feee
[phabricator] only save build_unit_message for failed case or coverage
txchen Oct 29, 2021
6ea07f7
[perf] skip file policy check if it is public or readable by all users
txchen Oct 30, 2021
aace7af
Re-enable commandeer
txchen Nov 1, 2021
ce54a03
[phab] fix error handling for metrics emitting and increase nc timeout
Oct 21, 2021
6e700e5
Disable changing username during registration
annapst Feb 23, 2022
39a5237
Disable changing username during registration, try 2
annapst Feb 24, 2022
2c9c3ba
Disable changing username during registration, try 3
annapst Mar 1, 2022
c9155b9
Improve kubediff comments in Phab
annapst Sep 2, 2022
d2a19fe
Improve comments take 2
annapst Sep 13, 2022
74b6f30
Require revisions to be updated in the last 30 days by default
pugmajere Oct 11, 2022
f2c2599
[differential] Enable the modified start/end fields in search
pugmajere Oct 21, 2022
0e8a5ea
Editing the Phabricator disclosure markup rule
GavinLoughridge Jan 5, 2023
4a0844b
[commit-rendering] include project tags in commit template
joeljeske Jun 7, 2023
e82818a
Merge pull request #2 from robinhoodmarkets/tags-in-commit
joeljeske Jun 8, 2023
cbbfd72
[phabricator] allow exposing current action to search (#3)
joeljeske Jun 28, 2023
56cd30a
[diffs] prevent force accept (#4)
joeljeske Aug 10, 2023
f7434d6
Remove "Owns No Changed Paths" in Diff View
joeljeske Sep 6, 2023
9ab3223
[phabricator] add exact responsible viewer function
yi-lu Feb 9, 2024
fc3ce9d
[custom fields] Call setObject before shouldEnableForRole
marcelofabri Mar 4, 2024
4368724
Merge pull request #5 from robinhoodmarkets/marcelo/custom-field-set-…
yi-lu Mar 5, 2024
f8fbf1a
Revert "Merge pull request #5 from robinhoodmarkets/marcelo/custom-fi…
yi-lu Mar 8, 2024
e310cbd
[phabricator] prevent sending email for project/owner updates
joeljeske Jul 17, 2024
c2eab37
[phabricator] Add slack channel to ping for review to owners page
kvissuet Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .arcconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"phabricator.uri": "https://secure.phabricator.com/",
"phabricator.uri": "https://phabricator.robinhood.com/",
"load": ["src/"],
"history.immutable": false
}
4 changes: 4 additions & 0 deletions src/__phutil_library_map__.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@
'DifferentialDiffViewController' => 'applications/differential/controller/DifferentialDiffViewController.php',
'DifferentialDoorkeeperRevisionFeedStoryPublisher' => 'applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php',
'DifferentialDraftField' => 'applications/differential/customfield/DifferentialDraftField.php',
'DifferentialExactResponsibleViewerFunctionDatasource' => 'applications/differential/typeahead/DifferentialExactResponsibleViewerFunctionDatasource.php',
'DifferentialExactUserFunctionDatasource' => 'applications/differential/typeahead/DifferentialExactUserFunctionDatasource.php',
'DifferentialFieldParseException' => 'applications/differential/exception/DifferentialFieldParseException.php',
'DifferentialFieldValidationException' => 'applications/differential/exception/DifferentialFieldValidationException.php',
Expand Down Expand Up @@ -5766,6 +5767,7 @@
'PhutilRemarkupCodeBlockRule' => 'infrastructure/markup/blockrule/PhutilRemarkupCodeBlockRule.php',
'PhutilRemarkupDefaultBlockRule' => 'infrastructure/markup/blockrule/PhutilRemarkupDefaultBlockRule.php',
'PhutilRemarkupDelRule' => 'infrastructure/markup/markuprule/PhutilRemarkupDelRule.php',
'PhutilRemarkupDisclosureRule' => 'infrastructure/markup/markuprule/PhutilRemarkupDisclosureRule.php',
'PhutilRemarkupDocumentLinkRule' => 'infrastructure/markup/markuprule/PhutilRemarkupDocumentLinkRule.php',
'PhutilRemarkupEngine' => 'infrastructure/markup/remarkup/PhutilRemarkupEngine.php',
'PhutilRemarkupEngineTestCase' => 'infrastructure/markup/remarkup/__tests__/PhutilRemarkupEngineTestCase.php',
Expand Down Expand Up @@ -6661,6 +6663,7 @@
'DifferentialDiffViewController' => 'DifferentialController',
'DifferentialDoorkeeperRevisionFeedStoryPublisher' => 'DoorkeeperFeedStoryPublisher',
'DifferentialDraftField' => 'DifferentialCoreCustomField',
'DifferentialExactResponsibleViewerFunctionDatasource' => 'PhabricatorTypeaheadDatasource',
'DifferentialExactUserFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'DifferentialFieldParseException' => 'Exception',
'DifferentialFieldValidationException' => 'Exception',
Expand Down Expand Up @@ -12767,6 +12770,7 @@
'PhutilRemarkupCodeBlockRule' => 'PhutilRemarkupBlockRule',
'PhutilRemarkupDefaultBlockRule' => 'PhutilRemarkupBlockRule',
'PhutilRemarkupDelRule' => 'PhutilRemarkupRule',
'PhutilRemarkupDisclosureRule' => 'PhutilRemarkupRule',
'PhutilRemarkupDocumentLinkRule' => 'PhutilRemarkupRule',
'PhutilRemarkupEngine' => 'PhutilMarkupEngine',
'PhutilRemarkupEngineTestCase' => 'PhutilTestCase',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function handleRequest(AphrontRequest $request) {
->setDefaultUsername($default_username)
->setDefaultEmail($default_email)
->setDefaultRealName($default_realname)
->setCanEditUsername(true)
->setCanEditUsername(($default_username === null))
->setCanEditEmail(($default_email === null))
->setCanEditRealName(true)
->setShouldVerifyEmail(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ protected function buildCustomEditFields($object) {
$author_field->setCommentActionLabel(pht('Foist Upon'));
}

$fields[] = $author_field;
// DEVX-2064
// $fields[] = $author_field;

$fields[] = id(new PhabricatorRemarkupEditField())
->setKey(DifferentialRevisionSummaryTransaction::EDITKEY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ public function getAttachmentDescription() {

public function willLoadAttachmentData($query, $spec) {
$query->needReviewers(true);
$query->needActiveDiffs(true);
}

public function getAttachmentForObject($object, $data, $spec) {
$reviewers = $object->getReviewers();
$diff_phid = $object->getActiveDiff()->getPHID();

$status_blocking = DifferentialReviewerStatus::STATUS_BLOCKING;

Expand All @@ -30,6 +32,7 @@ public function getAttachmentForObject($object, $data, $spec) {
'status' => $status,
'isBlocking' => $is_blocking,
'actorPHID' => $reviewer->getLastActorPHID(),
'isCurrentAction' => $reviewer->isCurrentAction($diff_phid),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getFieldAliases() {
}

public function isTemplateField() {
return false;
return true;
}

public function parseFieldValue($value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ protected function buildCustomSearchFields() {
id(new PhabricatorSearchDateField())
->setLabel(pht('Modified After'))
->setKey('modifiedStart')
->setIsHidden(true)
->setIsHidden(false)
->setDescription(
pht('Find revisions modified at or after a particular time.')),
id(new PhabricatorSearchDateField())
->setLabel(pht('Modified Before'))
->setKey('modifiedEnd')
->setIsHidden(true)
->setIsHidden(false)
->setDescription(
pht('Find revisions modified at or before a particular time.')),
id(new PhabricatorSearchStringListField())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function isAccepted($diff_phid) {
return false;
}

private function isCurrentAction($diff_phid) {
public function isCurrentAction($diff_phid) {
if (!$diff_phid) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ public function canReviewerForceAccept(
PhabricatorUser $viewer,
DifferentialReviewer $reviewer) {

// NOTE(joel.jeske)
// We do not want to support force-acceptance if owning a parent package
// All ownership rules should be declared in OWNERS.toml files
return false;

if (!$reviewer->isPackage()) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php

final class DifferentialExactResponsibleViewerFunctionDatasource
extends PhabricatorTypeaheadDatasource {

public function getBrowseTitle() {
return pht('Browse Exact Viewer');
}

public function getPlaceholderText() {
return pht('Type exact-viewer()...');
}

public function getDatasourceApplicationClass() {
return 'PhabricatorPeopleApplication';
}

public function getDatasourceFunctions() {
return array(
'exact-viewer' => array(
'name' => pht('Exact Current Viewer'),
'summary' => pht('Results matching the current viewing user exactly.'),
'description' => pht(
'Find revisions the current viewer is responsible for, exactly,'.
'and not include those through their projects or packages. '),
),
);
}

public function loadResults() {
if ($this->getViewer()->getPHID()) {
$results = array($this->renderViewerFunctionToken());
} else {
$results = array();
}

return $this->filterResultsAgainstTokens($results);
}

protected function canEvaluateFunction($function) {
if (!$this->getViewer()->getPHID()) {
return false;
}

return parent::canEvaluateFunction($function);
}

protected function evaluateFunction($function, array $argv_list) {
$results = array();
foreach ($argv_list as $argv) {
$results[] = $this->getViewer()->getPHID();
}
return $results;
}

public function renderFunctionTokens($function, array $argv_list) {
$tokens = array();
foreach ($argv_list as $argv) {
$tokens[] = PhabricatorTypeaheadTokenView::newFromTypeaheadResult(
$this->renderViewerFunctionToken());
}
return $tokens;
}

private function renderViewerFunctionToken() {
return $this->newFunctionResult()
->setName(pht('Exact: Current Viewer'))
->setPHID('exact-viewer()')
->setIcon('fa-user')
->setUnique(true);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function getDatasourceApplicationClass() {
public function getComponentDatasources() {
return array(
new DifferentialResponsibleUserDatasource(),
new DifferentialExactResponsibleViewerFunctionDatasource(),
new DifferentialResponsibleViewerFunctionDatasource(),
new DifferentialExactUserFunctionDatasource(),
new PhabricatorProjectDatasource(),
Expand Down
13 changes: 8 additions & 5 deletions src/applications/differential/view/DifferentialReviewersView.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,14 @@ public function render() {
null,
$diff->getPHID()));

if ($reviewer->isPackage()) {
if (!$reviewer->getChangesets()) {
$item->setNote(pht('(Owns No Changed Paths)'));
}
}
// With advanced Ownership in OWNERS.toml, this is message is
// no longer accurate.
//
// if ($reviewer->isPackage()) {
// if (!$reviewer->getChangesets()) {
// $item->setNote(pht('(Owns No Changed Paths)'));
// }
// }

if ($handle->hasCapabilities()) {
if (!$handle->hasViewCapability($diff)) {
Expand Down
7 changes: 7 additions & 0 deletions src/applications/files/query/PhabricatorFileQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ protected function loadPage() {
$always_visible = true;
}

// DEVX-2087: skip file policy check if it is PUBLIC or ALL_USERS
$file_view_policy = $file->getViewPolicy();
if ($file_view_policy == PhabricatorPolicies::POLICY_PUBLIC ||
$file_view_policy == PhabricatorPolicies::POLICY_USER) {
$always_visible = true;
}

if ($always_visible) {
// We just treat these files as though they aren't attached to
// anything. This saves a query in common cases when we're loading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,14 @@ private function sendToTarget(

$unit_messages = $request->getValue('unit', array());
foreach ($unit_messages as $unit) {
$save[] = HarbormasterBuildUnitMessage::newFromDictionary(
$bu_message = HarbormasterBuildUnitMessage::newFromDictionary(
$build_target,
$unit);
// DEVX-2087:only save to db for failed test case and coverage information
if (($bu_message->getResult() == ArcanistUnitTestResult::RESULT_FAIL) ||
($bu_message->getProperty('coverage') != null)) {
$save[] = $bu_message;
}
}

$save[] = HarbormasterBuildMessage::initializeNewMessage($viewer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,34 +56,73 @@ public function execute(
'vurisprintf',
$settings['uri'],
$variables);

$method = nonempty(idx($settings, 'method'), 'POST');

$future = id(new HTTPSFuture($uri))
->setMethod($method)
->setTimeout(60);

$credential_phid = $this->getSetting('credential');
if ($credential_phid) {
$key = PassphrasePasswordKey::loadFromPHID(
$credential_phid,
$viewer);
$future->setHTTPBasicAuthCredentials(
$key->getUsernameEnvelope()->openEnvelope(),
$key->getPasswordEnvelope());
$sleepDuration = 30;
$retry = 0;
while (true) {
$future = id(new HTTPSFuture($uri))
->setMethod($method)
->setTimeout(60);

$credential_phid = $this->getSetting('credential');
if ($credential_phid) {
$key = PassphrasePasswordKey::loadFromPHID(
$credential_phid,
$viewer);
$future->setHTTPBasicAuthCredentials(
$key->getUsernameEnvelope()->openEnvelope(),
$key->getPasswordEnvelope());
}

$this->resolveFutures(
$build,
$build_target,
array($future));

$this->logHTTPResponse($build, $build_target, $future, $uri);

list($status) = $future->resolve();
try {
$this->emitBuildResultMetric($build->getBuildPlan()->getID(), $status->getStatusCode(), $retry);
} catch (Exception $e) {
echo 'Caught exception while sending Jenkins metrics to statsd: ', $e->getMessage(), "\n";
}
if (!$status->isError()) {
return;
}
if ($retry == 2) {
throw new HarbormasterBuildFailureException();
}
sleep($sleepDuration);
$sleepDuration *= 2;
$retry++;
}
}

$this->resolveFutures(
$build,
$build_target,
array($future));

$this->logHTTPResponse($build, $build_target, $future, $uri);

list($status) = $future->resolve();
if ($status->isError()) {
throw new HarbormasterBuildFailureException();
public function emitBuildResultMetric($plan, $status, $retry) {
$template = 'echo "phabricator_build_result_total:1|c|#plan:$plan,status:$status,retry:$retry" | nc -w 3 -vu apollo-statsd.integration-tests.svc.cluster.local 8125';
$vars = array(
'$plan' => $plan,
'$status' => $status,
'$retry' => $retry,
);
$command = strtr($template, $vars);
echo $command;

$metrics_retry = 0;
$retval = 0;
$output = null;
while ($metrics_retry < 3) {
exec($command, $output, $retval);
if ($retval == 0) {
return;
}
$metrics_retry++;
sleep(1);
}
echo "Got error code $retval when sending metrics to statsd with output:\n";
print_r($output);
}

public function getFieldSpecifications() {
Expand Down Expand Up @@ -112,5 +151,4 @@ public function getFieldSpecifications() {
public function supportsWaitForMessage() {
return true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ public function getFieldValuesForConduit() {
'buildTargetPHID' => $this->getBuildTargetPHID(),
'artifactType' => $this->getArtifactType(),
'artifactKey' => $this->getArtifactKey(),
'artifactData' => $this->artifactData,
'isReleased' => (bool)$this->getIsReleased(),
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/applications/home/view/PHUIHomeView.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ private function buildRevisionPanel() {
$panel = $this->newQueryPanel()
->setName(pht('Active Revisions'))
->setProperty('class', 'DifferentialRevisionSearchEngine')
->setProperty('key', 'active');
->setProperty('key', 'active')
->setProperty('modifiedStart', '30 days ago');

return $this->renderPanel($panel);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,18 @@ private function buildPackageDetailView(
$ignored = phutil_tag('em', array(), pht('None'));
}



$view->addProperty(pht('Ignored Attributes'), $ignored);

// Add Slack Channel Field
$slack_channel = $package->getSlackChannel();
if ($slack_channel) {
$view->addProperty(pht('Slack Channel'), $slack_channel);
} else {
$view->addProperty(pht('Slack Channel'), phutil_tag('em', array(), pht('None')));
}

$description = $package->getDescription();
if (strlen($description)) {
$description = new PHUIRemarkupView($viewer, $description);
Expand Down
Loading