Page MenuHomePhabricator

D19085.diff
No OneTemporary

D19085.diff

diff --git a/src/applications/config/option/PhabricatorCoreConfigOptions.php b/src/applications/config/option/PhabricatorCoreConfigOptions.php
--- a/src/applications/config/option/PhabricatorCoreConfigOptions.php
+++ b/src/applications/config/option/PhabricatorCoreConfigOptions.php
@@ -37,6 +37,24 @@
$proto_doc_name = pht('User Guide: Prototype Applications');
$applications_app_href = '/applications/';
+ $silent_description = $this->deformat(pht(<<<EOREMARKUP
+This option allows you to stop Phabricator from sending data to most external
+services: it will disable email, SMS, repository mirroring, remote builds,
+Doorkeeper writes, and webhooks.
+
+This option is intended to allow a Phabricator instance to be exported, copied,
+imported, and run in a test environment without impacting users. For example,
+if you are migrating to new hardware, you could perform a test migration first
+with this flag set, make sure things work, and then do a production cutover
+later with higher confidence and less disruption.
+
+Without making use of this flag to silence the temporary test environment,
+users would receive duplicate email during the time the test instance and old
+production instance were both in operation.
+EOREMARKUP
+ ));
+
+
return array(
$this->newOption('phabricator.base-uri', 'string', null)
->setLocked(true)
@@ -232,21 +250,7 @@
pht('Run Normally'),
))
->setSummary(pht('Stop Phabricator from sending any email, etc.'))
- ->setDescription(
- pht(
- 'This option allows you to stop Phabricator from sending '.
- 'any data to external services. Among other things, it will '.
- 'disable email, SMS, repository mirroring, and HTTP hooks.'.
- "\n\n".
- 'This option is intended to allow a Phabricator instance to '.
- 'be exported, copied, imported, and run in a test environment '.
- 'without impacting users. For example, if you are migrating '.
- 'to new hardware, you could perform a test migration first, '.
- 'make sure things work, and then do a production cutover '.
- 'later with higher confidence and less disruption. Without '.
- 'this flag, users would receive duplicate email during the '.
- 'time the test instance and old production instance were '.
- 'both in operation.')),
+ ->setDescription($silent_description),
);
}
diff --git a/src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php b/src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php
--- a/src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php
+++ b/src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php
@@ -295,6 +295,18 @@
->append($body);
}
+ protected function logSilencedCall(
+ HarbormasterBuild $build,
+ HarbormasterBuildTarget $build_target,
+ $label) {
+
+ $build_target
+ ->newLog($label, 'silenced')
+ ->append(
+ pht(
+ 'Declining to make service call because `phabricator.silent` is '.
+ 'enabled in configuration.'));
+ }
/* -( Automatic Targets )-------------------------------------------------- */
diff --git a/src/applications/harbormaster/step/HarbormasterBuildkiteBuildStepImplementation.php b/src/applications/harbormaster/step/HarbormasterBuildkiteBuildStepImplementation.php
--- a/src/applications/harbormaster/step/HarbormasterBuildkiteBuildStepImplementation.php
+++ b/src/applications/harbormaster/step/HarbormasterBuildkiteBuildStepImplementation.php
@@ -72,6 +72,11 @@
HarbormasterBuildTarget $build_target) {
$viewer = PhabricatorUser::getOmnipotentUser();
+ if (PhabricatorEnv::getEnvConfig('phabricator.silent')) {
+ $this->logSilencedCall($build, $build_target, pht('Buildkite'));
+ throw new HarbormasterBuildFailureException();
+ }
+
$buildable = $build->getBuildable();
$object = $buildable->getBuildableObject();
diff --git a/src/applications/harbormaster/step/HarbormasterCircleCIBuildStepImplementation.php b/src/applications/harbormaster/step/HarbormasterCircleCIBuildStepImplementation.php
--- a/src/applications/harbormaster/step/HarbormasterCircleCIBuildStepImplementation.php
+++ b/src/applications/harbormaster/step/HarbormasterCircleCIBuildStepImplementation.php
@@ -84,6 +84,11 @@
HarbormasterBuildTarget $build_target) {
$viewer = PhabricatorUser::getOmnipotentUser();
+ if (PhabricatorEnv::getEnvConfig('phabricator.silent')) {
+ $this->logSilencedCall($build, $build_target, pht('CircleCI'));
+ throw new HarbormasterBuildFailureException();
+ }
+
$buildable = $build->getBuildable();
$object = $buildable->getBuildableObject();
diff --git a/src/applications/harbormaster/step/HarbormasterHTTPRequestBuildStepImplementation.php b/src/applications/harbormaster/step/HarbormasterHTTPRequestBuildStepImplementation.php
--- a/src/applications/harbormaster/step/HarbormasterHTTPRequestBuildStepImplementation.php
+++ b/src/applications/harbormaster/step/HarbormasterHTTPRequestBuildStepImplementation.php
@@ -43,6 +43,12 @@
HarbormasterBuildTarget $build_target) {
$viewer = PhabricatorUser::getOmnipotentUser();
+
+ if (PhabricatorEnv::getEnvConfig('phabricator.silent')) {
+ $this->logSilencedCall($build, $build_target, pht('HTTP Request'));
+ throw new HarbormasterBuildFailureException();
+ }
+
$settings = $this->getSettings();
$variables = $build_target->getVariables();

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 12, 1:37 PM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7587599
Default Alt Text
D19085.diff (5 KB)

Event Timeline