Skip to content

Commit

Permalink
Fixes acquia#2720: Write deployment identifier using robo task.
Browse files Browse the repository at this point in the history
  • Loading branch information
malikkotob committed Apr 17, 2018
1 parent 9fb6893 commit c78fab4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
14 changes: 11 additions & 3 deletions src/Robo/Commands/Deploy/DeployCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,19 @@ protected function composerInstall() {
* Creates deployment_identifier file.
*/
protected function createDeployId($id) {
$this->taskExecStack()->exec("echo '$id' > deployment_identifier")
->dir($this->deployDir)
->stopOnFail()
$deployment_identifier_file = $this->getConfigValue('repo.root') . '/deployment_identifier';
$this->say("Generating deployment identifier...");
$result = $this->taskWriteToFile($deployment_identifier_file)
->line($id)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();

if (!$result->wasSuccessful()) {
$filepath = $this->getInspector()->getFs()->makePathRelative($deployment_identifier_file, $this->getConfigValue('repo.root'));
throw new BltException("Unable to write deployment identifier to $filepath.");
}

return $result->getExitCode();
}

/**
Expand Down
14 changes: 11 additions & 3 deletions src/Robo/Commands/Setup/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,19 @@ public function drupalInstall() {
* Creates deployment_identifier file.
*/
protected function createDeployId($id) {
$this->taskExecStack()->exec("echo '$id' > deployment_identifier")
->dir($this->getConfigValue('repo.root'))
->stopOnFail()
$deployment_identifier_file = $this->getConfigValue('repo.root') . '/deployment_identifier';
$this->say("Generating deployment identifier...");
$result = $this->taskWriteToFile($deployment_identifier_file)
->line($id)
->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
->run();

if (!$result->wasSuccessful()) {
$filepath = $this->getInspector()->getFs()->makePathRelative($deployment_identifier_file, $this->getConfigValue('repo.root'));
throw new BltException("Unable to write deployment identifier to $filepath.");
}

return $result->getExitCode();
}

/**
Expand Down

0 comments on commit c78fab4

Please sign in to comment.