Skip to content

Commit 9aa13e5

Browse files
authored
Merge branch 'develop' into MCLOUD-7197
2 parents 5b1bf18 + 3806fe0 commit 9aa13e5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1568
-301
lines changed

config/schema.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,17 @@ variables:
176176
- stage:
177177
global:
178178
SKIP_HTML_MINIFICATION: true
179+
SKIP_COMPOSER_DUMP_AUTOLOAD:
180+
description: Skip running compose dump-autoload command
181+
type: boolean
182+
stages:
183+
- build
184+
default:
185+
build: false
186+
examples:
187+
- stage:
188+
build:
189+
SKIP_COMPOSER_DUMP_AUTOLOAD: true
179190
SCD_ON_DEMAND:
180191
description: Enable generation of static content when requested by a user.
181192
Pre-loading the cache using the post_deploy hook reduces site downtime.

src/Application.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ protected function getDefaultCommands()
7575
$this->container->create(Command\CronKill::class),
7676
$this->container->create(Command\CronUnlock::class),
7777
$this->container->create(Command\ConfigShow::class),
78+
$this->container->create(Command\ConfigCreate::class),
79+
$this->container->create(Command\ConfigUpdate::class),
7880
$this->container->create(Command\RunCommand::class),
7981
$this->container->create(Command\GenerateSchema::class),
8082
$this->container->create(Command\ErrorShow::class)

src/Command/ApplyPatches.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(Manager $manager)
4343
protected function configure(): void
4444
{
4545
$this->setName(self::NAME)
46-
->setDescription('Applies custom patches');
46+
->setDescription('Applies custom patches.');
4747

4848
parent::configure();
4949
}

src/Command/BackupList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __construct(
5555
protected function configure()
5656
{
5757
$this->setName(self::NAME)
58-
->setDescription('Shows the list of backup files');
58+
->setDescription('Shows the list of backup files.');
5959

6060
parent::configure();
6161
}

src/Command/BackupRestore.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ public function __construct(Restore $restore, LoggerInterface $logger)
5454
protected function configure()
5555
{
5656
$this->setName(self::NAME)
57-
->setDescription('Restore important configuration files. Run backup:list to show the list of backup files');
57+
->setDescription(
58+
'Restore important configuration files. Run backup:list to show the list of backup files.'
59+
);
5860
$this->addOption(
5961
'force',
6062
'f',

src/Command/Build.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Build extends Command
2828
protected function configure()
2929
{
3030
$this->setName(static::NAME)
31-
->setDescription('Builds application');
31+
->setDescription('Builds application.');
3232

3333
parent::configure();
3434
}

src/Command/Build/Generate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(Processor $processor)
4444
protected function configure()
4545
{
4646
$this->setName(static::NAME)
47-
->setDescription('Generates all necessary files for build stage');
47+
->setDescription('Generates all necessary files for build stage.');
4848

4949
parent::configure();
5050
}

src/Command/Build/Transfer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(Processor $processor)
4343
protected function configure()
4444
{
4545
$this->setName(static::NAME)
46-
->setDescription('Transfer generated files into init directory');
46+
->setDescription('Transfers generated files into init directory.');
4747

4848
parent::configure();
4949
}

src/Command/ConfigCreate.php

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\MagentoCloud\Command;
9+
10+
use Magento\MagentoCloud\Filesystem\ConfigFileList;
11+
use Magento\MagentoCloud\Filesystem\Driver\File;
12+
use Symfony\Component\Console\Command\Command;
13+
use Symfony\Component\Console\Input\InputArgument;
14+
use Symfony\Component\Console\Input\InputInterface;
15+
use Symfony\Component\Console\Output\OutputInterface;
16+
use Symfony\Component\Yaml\Yaml;
17+
18+
/**
19+
* Creates .magento.env.yaml
20+
*/
21+
class ConfigCreate extends Command
22+
{
23+
const NAME = 'cloud:config:create';
24+
25+
const ARG_CONFIGURATION = 'configuration';
26+
27+
/**
28+
* @var ConfigFileList
29+
*/
30+
private $configFileList;
31+
32+
/**
33+
* @var File
34+
*/
35+
private $file;
36+
37+
/**
38+
* @param ConfigFileList $configFileList
39+
* @param File $file
40+
*/
41+
public function __construct(ConfigFileList $configFileList, File $file)
42+
{
43+
$this->configFileList = $configFileList;
44+
$this->file = $file;
45+
46+
parent::__construct();
47+
}
48+
49+
/**
50+
* @inheritdoc
51+
*/
52+
protected function configure()
53+
{
54+
$this->setName(static::NAME)
55+
->setDescription(
56+
'Creates a `.magento.env.yaml` file with the specified build, deploy, and post-deploy variable ' .
57+
'configuration. Overwrites any existing `.magento,.env.yaml` file.'
58+
)
59+
->addArgument(
60+
self::ARG_CONFIGURATION,
61+
InputArgument::REQUIRED,
62+
'Configuration in JSON format'
63+
);
64+
65+
parent::configure();
66+
}
67+
68+
/**
69+
* @inheritDoc
70+
*/
71+
public function execute(InputInterface $input, OutputInterface $output)
72+
{
73+
$configuration = $input->getArgument(self::ARG_CONFIGURATION);
74+
75+
$decodedConfig = json_decode($configuration, true);
76+
77+
if (json_last_error() !== JSON_ERROR_NONE) {
78+
throw new \Exception('Wrong JSON format: ' . json_last_error_msg());
79+
}
80+
81+
$yaml = Yaml::dump($decodedConfig, 10, 2);
82+
$filePath = $this->configFileList->getEnvConfig();
83+
84+
$this->file->filePutContents($filePath, $yaml);
85+
86+
$output->writeln(sprintf("Config file %s was created", $filePath));
87+
}
88+
}

src/Command/ConfigShow.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function __construct(
6666
protected function configure()
6767
{
6868
$this->setName(static::NAME)
69-
->setDescription('Display encoded cloud configuration environment variables')
69+
->setDescription('Display encoded cloud configuration environment variables.')
7070
->addArgument(
7171
'variable',
7272
InputArgument::IS_ARRAY,

0 commit comments

Comments
 (0)