-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skipping stock deploy, adding new command.
- Loading branch information
Showing
5 changed files
with
89 additions
and
29 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
app/code/Magento/NewRelicReporting/Console/Command/DeployMarker.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace Magento\NewRelicReporting\Console\Command; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
|
||
use Magento\NewRelicReporting\Model\Apm\DeploymentsFactory; | ||
use Magento\NewRelicReporting\Model\ServiceShellUser; | ||
|
||
class DeployMarker extends Command | ||
{ | ||
protected $deploymentsFactory; | ||
protected $serviceShellUser; | ||
|
||
public function __construct( | ||
DeploymentsFactory $deploymentsFactory, | ||
ServiceShellUser $serviceShellUser, | ||
$name = null | ||
) { | ||
$this->deploymentsFactory = $deploymentsFactory; | ||
$this->serviceShellUser = $serviceShellUser; | ||
parent::__construct($name); | ||
} | ||
|
||
protected function configure() | ||
{ | ||
$this->setName("newrelic:create:deploy-marker"); | ||
$this->setDescription("Check the deploy queue for entries and create an appropriate deploy marker.") | ||
->addArgument( | ||
'message', | ||
InputArgument::REQUIRED, | ||
'Deploy Message?' | ||
) | ||
->addArgument( | ||
'changelog', | ||
InputArgument::REQUIRED, | ||
'Change Log?' | ||
) | ||
->addArgument( | ||
'user', | ||
InputArgument::OPTIONAL, | ||
'Deployment User' | ||
); | ||
parent::configure(); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$this->deploymentsFactory->create()->setDeployment( | ||
$input->getArgument('message'), | ||
$input->getArgument('changelog'), | ||
$this->serviceShellUser->get($input->getArgument('user')) | ||
); | ||
$output->writeln('<info>NewRelic deployment information sent</info>'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
app/code/Magento/NewRelicReporting/Model/ServiceShellUser.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Magento\NewRelicReporting\Model; | ||
|
||
class ServiceShellUser | ||
{ | ||
const DEFAULT_USER = 'cron'; | ||
|
||
public function get($userFromArgument = false) | ||
{ | ||
if ($userFromArgument) { | ||
return $userFromArgument; | ||
} | ||
|
||
$user = `echo \$USER`; | ||
if ($user) { | ||
return $user; | ||
} | ||
|
||
return self::DEFAULT_USER; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters