Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14702087
D13751.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13751.diff
View Options
diff --git a/src/applications/harbormaster/step/HarbormasterLeaseHostBuildStepImplementation.php b/src/applications/harbormaster/step/HarbormasterLeaseHostBuildStepImplementation.php
--- a/src/applications/harbormaster/step/HarbormasterLeaseHostBuildStepImplementation.php
+++ b/src/applications/harbormaster/step/HarbormasterLeaseHostBuildStepImplementation.php
@@ -45,14 +45,26 @@
) + $custom_attributes)
->queueForActivation();
- // Create the associated artifact.
- $artifact = $build_target->createArtifact(
- PhabricatorUser::getOmnipotentUser(),
- $settings['name'],
- HarbormasterHostArtifact::ARTIFACTCONST,
- array(
- 'drydockLeasePHID' => $lease->getPHID(),
- ));
+ try {
+ // Create the associated artifact.
+ $artifact = $build_target->createArtifact(
+ PhabricatorUser::getOmnipotentUser(),
+ $settings['name'],
+ HarbormasterHostArtifact::ARTIFACTCONST,
+ array(
+ 'drydockLeasePHID' => $lease->getPHID(),
+ ));
+ } catch (Exception $ex) {
+ // Make sure the lease is released if we fail
+ // for any reason.
+ $lease->reload();
+ $lease->setStatus(DrydockLeaseStatus::STATUS_BROKEN);
+ $lease->setBrokenReason(pht(
+ 'Failed to save artifact reference to lease, so the lease '.
+ 'was forcibly broken by Harbormaster.'));
+ $lease->save();
+ throw $ex;
+ }
} else {
// Load the lease.
$impl = $artifact->getArtifactImplementation();
diff --git a/src/applications/harbormaster/step/HarbormasterLeaseWorkingCopyBuildStepImplementation.php b/src/applications/harbormaster/step/HarbormasterLeaseWorkingCopyBuildStepImplementation.php
--- a/src/applications/harbormaster/step/HarbormasterLeaseWorkingCopyBuildStepImplementation.php
+++ b/src/applications/harbormaster/step/HarbormasterLeaseWorkingCopyBuildStepImplementation.php
@@ -40,14 +40,23 @@
+ $custom_attributes)
->queueForActivation();
- // Create the associated artifact.
- $artifact = $build_target->createArtifact(
- PhabricatorUser::getOmnipotentUser(),
- $settings['name'],
- HarbormasterHostArtifact::ARTIFACTCONST,
- array(
- 'drydockLeasePHID' => $lease->getPHID(),
- ));
+ try {
+ // Create the associated artifact.
+ $artifact = $build_target->createArtifact(
+ PhabricatorUser::getOmnipotentUser(),
+ $settings['name'],
+ HarbormasterHostArtifact::ARTIFACTCONST,
+ array(
+ 'drydockLeasePHID' => $lease->getPHID(),
+ ));
+ } catch (Exception $ex) {
+ // Make sure the lease is released if we fail
+ // for any reason.
+ $lease->reload();
+ $lease->setStatus(DrydockLeaseStatus::STATUS_BROKEN);
+ $lease->save();
+ throw $ex;
+ }
} else {
// Load the lease.
$impl = $artifact->getArtifactImplementation();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 16, 4:36 AM (19 h, 44 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6996023
Default Alt Text
D13751.diff (2 KB)
Attached To
Mode
D13751: [harbormaster/core] Fix issue where exception during artifact save would result in orphaned lease
Attached
Detach File
Event Timeline
Log In to Comment