Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/Command/Environment/EnvironmentPushCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ protected function configure()
->addHiddenOption('branch', null, InputOption::VALUE_NONE, 'DEPRECATED: alias of --activate')
->addOption('parent', null, InputOption::VALUE_REQUIRED, 'Set the environment parent (only used with --activate)')
->addOption('type', null, InputOption::VALUE_REQUIRED, 'Set the environment type (only used with --activate )')
->addOption('no-clone-parent', null, InputOption::VALUE_NONE, "Do not clone the parent branch's data (only used with --activate)");
->addOption('no-clone-parent', null, InputOption::VALUE_NONE, "Do not clone the parent branch's data (only used with --activate)")
->addOption('deploy-strategy', 's', InputOption::VALUE_REQUIRED, 'Set the deployment strategy, rolling or stopstart (default)');
$this->addResourcesInitOption(
['parent', 'default', 'minimum', 'manual'],
'Set the resources to use for new services: parent, default, minimum, or manual.'
Expand Down Expand Up @@ -140,6 +141,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
$parentId = $input->getOption('parent');
$type = $input->getOption('type');

$strategy = $input->getOption('deploy-strategy');
if ($strategy !== null && $strategy !== 'rolling' && $strategy !== 'stopstart') {
$this->stdErr->writeln(sprintf('Invalid deploy strategy <error>%s</error>, should be "rolling" or "stopstart"', $strategy));
return 1;
}

// Check if the environment may be a production one.
$mayBeProduction = $type === 'production'
|| ($targetEnvironment && $targetEnvironment->type === 'production')
Expand Down Expand Up @@ -175,6 +182,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
}

if (!$targetEnvironment->operationAvailable('deploy', true)) {
$this->stdErr->writeln(sprintf('Deployment strategy: <info>%s</info>', $strategy ?: "stopstart"));
} else {
$this->stdErr->writeln('The activity will be staged, ignoring the deployment strategy.');
}

$this->stdErr->writeln('');

if (!$questionHelper->confirm('Are you sure you want to continue?')) {
Expand Down Expand Up @@ -238,6 +251,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($resourcesInit !== null) {
$gitArgs[] = '--push-option=resources.init=' . $resourcesInit;
}
if ($strategy !== null) {
$gitArgs[] = '--push-option=deploy.strategy=' . $strategy;
}

// Build the SSH command to use with Git.
$extraSshOptions = [];
Expand Down
Loading