-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from netsells/feature/tidy-docker-login
Tidies up docker login
- Loading branch information
Showing
5 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
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
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,63 @@ | ||
<?php | ||
|
||
namespace App\Commands; | ||
|
||
use App\Helpers\Helpers; | ||
use App\Helpers\NetsellsFile; | ||
use App\Exceptions\ProcessFailed; | ||
use Symfony\Component\Process\Process; | ||
use LaravelZero\Framework\Commands\Command; | ||
use Symfony\Component\Console\Input\InputOption; | ||
|
||
class DockerLoginCommand extends Command | ||
{ | ||
/** | ||
* The signature of the command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'docker:aws:login'; | ||
|
||
/** | ||
* The description of the command. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Logs into docker via the AWS account'; | ||
|
||
/** @var Helpers $helpers */ | ||
protected $helpers; | ||
|
||
public function __construct(Helpers $helpers) | ||
{ | ||
$this->helpers = $helpers; | ||
parent::__construct(); | ||
} | ||
|
||
public function configure() | ||
{ | ||
$this->setDefinition($this->helpers->aws()->commonConsoleOptions()); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$requiredBinaries = ['docker', 'aws']; | ||
|
||
if ($this->helpers->checks()->checkAndReportMissingBinaries($this, $requiredBinaries)) { | ||
return 1; | ||
} | ||
|
||
$loginSuccessful = $this->helpers->aws()->ecs()->authenticateDocker($this); | ||
|
||
if (!$loginSuccessful) { | ||
return 1; | ||
} | ||
|
||
$this->info("Logged into docker."); | ||
} | ||
} |
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