@@ -30,7 +30,8 @@ protected function configure()
3030 ->addHiddenOption ('branch ' , null , InputOption::VALUE_NONE , 'DEPRECATED: alias of --activate ' )
3131 ->addOption ('parent ' , null , InputOption::VALUE_REQUIRED , 'Set the environment parent (only used with --activate) ' )
3232 ->addOption ('type ' , null , InputOption::VALUE_REQUIRED , 'Set the environment type (only used with --activate ) ' )
33- ->addOption ('no-clone-parent ' , null , InputOption::VALUE_NONE , "Do not clone the parent branch's data (only used with --activate) " );
33+ ->addOption ('no-clone-parent ' , null , InputOption::VALUE_NONE , "Do not clone the parent branch's data (only used with --activate) " )
34+ ->addOption ('deploy-strategy ' , 's ' , InputOption::VALUE_REQUIRED , 'Set the deployment strategy, rolling or stopstart (default) ' );
3435 $ this ->addResourcesInitOption (
3536 ['parent ' , 'default ' , 'minimum ' , 'manual ' ],
3637 'Set the resources to use for new services: parent, default, minimum, or manual. '
@@ -140,6 +141,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
140141 $ parentId = $ input ->getOption ('parent ' );
141142 $ type = $ input ->getOption ('type ' );
142143
144+ $ strategy = $ input ->getOption ('deploy-strategy ' );
145+ if ($ strategy !== null && $ strategy !== 'rolling ' && $ strategy !== 'stopstart ' ) {
146+ $ this ->stdErr ->writeln ("Invalid deploy strategy <error> $ strategy</error>, should be 'rolling' or 'stopstart'. " );
147+ return 1 ;
148+ }
149+
143150 // Check if the environment may be a production one.
144151 $ mayBeProduction = $ type === 'production '
145152 || ($ targetEnvironment && $ targetEnvironment ->type === 'production ' )
@@ -177,6 +184,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
177184
178185 $ this ->stdErr ->writeln ('' );
179186
187+ if ($ strategy !== null ) {
188+ # If Automatic deployments enabled on the env
189+ if (!$ targetEnvironment ->operationAvailable ('deploy ' , true )) {
190+ if ($ strategy === 'rolling ' ) {
191+ $ this ->stdErr ->writeln ('The deployment will not cause downtime as "rolling" strategy was specified. ' );
192+ }
193+ } else {
194+ $ this ->stdErr ->writeln ('The activity will be staged, ignoring the deployment strategy. ' );
195+ }
196+ }
197+
180198 if (!$ questionHelper ->confirm ('Are you sure you want to continue? ' )) {
181199 return 1 ;
182200 }
@@ -238,6 +256,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
238256 if ($ resourcesInit !== null ) {
239257 $ gitArgs [] = '--push-option=resources.init= ' . $ resourcesInit ;
240258 }
259+ if ($ strategy !== null ) {
260+ $ gitArgs [] = '--push-option=deploy.strategy= ' . $ strategy ;
261+ }
241262
242263 // Build the SSH command to use with Git.
243264 $ extraSshOptions = [];
0 commit comments