Skip to content

Commit 7c7b400

Browse files
authored
Merge pull request #10 from magento-commerce/develop
MCLOUD-7202: Release magento-cloud-docker 1.2.0 and ece-tools 2002.1.3
2 parents c3f921f + f1e6f7f commit 7c7b400

File tree

93 files changed

+2279
-441
lines changed

Some content is hidden

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

93 files changed

+2279
-441
lines changed

.github/workflows/ci.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
composer config --unset repositories.repo.magento.com
2424
composer remove --no-update magento/magento-cloud-components
2525
composer remove --no-update magento/magento-cloud-docker
26+
composer remove --no-update magento/quality-patches
2627
composer remove --no-update magento/magento-cloud-patches
2728
- name: Composer Update
2829
run: composer update

.travis.yml

+6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ jobs:
4343
- php: '7.4'
4444
env: TEST_SUITE=functional-ee
4545

46+
before_install:
47+
# https://github.com/kylekatarnls/update-helper/issues/9
48+
- if [ -n "${COMPOSER_VERSION}" ]; then travis_retry composer self-update ${COMPOSER_VERSION}; fi;
49+
50+
4651
install:
52+
- phpenv config-add travis.php.ini
4753
- composer config http-basic.repo.magento.com ${REPO_USERNAME_CE} ${REPO_PASSWORD_CE}
4854
- composer config github-oauth.github.com ${GITHUB_TOKEN}
4955
- if [ -n "${MCC_VERSION}" ]; then composer config repositories.mcc git [email protected]:magento/magento-cloud-components.git && composer require "magento/magento-cloud-components:${MCC_VERSION}" --no-update; fi;

codeception.dist.yml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ modules:
2424
composer_magento_username: "%REPO_USERNAME%"
2525
composer_magento_password: "%REPO_PASSWORD%"
2626
composer_github_token: "%GITHUB_TOKEN%"
27+
use_cached_workdir: true
2728
printOutput: false
2829
Magento\CloudDocker\Test\Functional\Codeception\Docker:
2930
system_magento_dir: "%Magento.docker.settings.system.magento_dir%"

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/ece-tools",
33
"description": "Provides tools to build and deploy Magento 2 Enterprise Edition",
44
"type": "magento2-component",
5-
"version": "2002.1.2",
5+
"version": "2002.1.3",
66
"license": "OSL-3.0",
77
"repositories": {
88
"repo.magento.com": {
@@ -24,6 +24,7 @@
2424
"magento/magento-cloud-components": "^1.0.6",
2525
"magento/magento-cloud-docker": "^1.0.0",
2626
"magento/magento-cloud-patches": "^1.0.6",
27+
"magento/quality-patches": "^1.0.3",
2728
"monolog/monolog": "^1.16",
2829
"nesbot/carbon": "^1.0||^2.0",
2930
"psr/container": "^1.0",

config/schema.error.yaml

+15-3
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
type: critical
175175
!php/const Magento\MagentoCloud\App\Error::DEPLOY_REDIS_CACHE_CLEAN_FAILED:
176176
title: 'Failed to clean the Redis cache'
177-
suggestion: 'Failed to clean the Redis cache. Check that the Redis cache configuration is correct and that the Redis service is available. See [Setup Redis service](https://devdocs.magento.com/cloud/project/project-conf-files_services-redis.html).'
177+
suggestion: 'Failed to clean the Redis cache. Check that the Redis cache configuration is correct and that the Redis service is available. See [Setup Redis service](https://devdocs.magento.com/cloud/project/services-redis.html).'
178178
step: 'pre-deploy: clean-redis-cache'
179179
stage: deploy
180180
type: critical
@@ -322,7 +322,7 @@
322322
type: critical
323323
!php/const Magento\MagentoCloud\App\Error::DEPLOY_ES_CANNOT_CONNECT:
324324
title: 'Can not connect to the Elasticsearch service'
325-
suggestion: 'Check that credentials for elasticsearch are correct and service is running'
325+
suggestion: 'Check for valid Elasticsearch credentials and verify that the service is running'
326326
stage: deploy
327327
type: critical
328328
!php/const Magento\MagentoCloud\App\Error::DEPLOY_WRONG_BRAINTREE_VARIABLE:
@@ -331,12 +331,18 @@
331331
suggestion: 'Support for the Braintree module is no longer included with Magento 2.4.0 and later. Remove the CONFIG__STORES__DEFAULT__PAYMENT__BRAINTREE__CHANNEL variable from the variables section of the .magento.app.yaml file. For Braintree support, use an official Braintree Payments extension from the Magento Marketplace instead.'
332332
stage: deploy
333333
type: critical
334-
!php/const Magento\MagentoCloud\App\Error::DEPLOY_WRONG_SEARCH_ENGINE:
334+
!php/const Magento\MagentoCloud\App\Error::DEPLOY_ES_SERVICE_NOT_INSTALLED:
335335
step: validate-config
336336
title: 'Magento 2.4.0 requires Elasticsearch service to be installed'
337337
suggestion: 'Install Elasticsearch service'
338338
stage: deploy
339339
type: critical
340+
!php/const Magento\MagentoCloud\App\Error::DEPLOY_WRONG_SEARCH_ENGINE:
341+
step: validate-config
342+
title: 'The search engine must be set to Elasticsearch for Magento >= 2.4.0'
343+
suggestion: 'Check the SEARCH_CONFIGURATION variable for the `engine` option. If it is configured, remove the option, or set the value to "elasticsearch".'
344+
stage: deploy
345+
type: critical
340346
!php/const Magento\MagentoCloud\App\Error::PD_DEPLOY_IS_FAILED:
341347
step: is-deploy-failed
342348
title: 'Deploy stage failed'
@@ -577,6 +583,12 @@
577583
suggestion: 'Check the `cloud.log` for more information.'
578584
step: 'pre-deploy:restore-writable-dirs'
579585
type: warning
586+
!php/const Magento\MagentoCloud\App\Error::WARN_NOT_SUPPORTED_MAGE_MODE:
587+
title: 'Mode value for MAGE_MODE environment variable not supported'
588+
stage: deploy
589+
suggestion: 'Remove the MAGE_MODE environment variable, or change its value to "production". Magento Cloud supports "production" mode only.'
590+
step: 'validate-config:mage-mode-variable'
591+
type: warning
580592
!php/const Magento\MagentoCloud\App\Error::WARN_DEBUG_LOG_ENABLED:
581593
title: 'Debug logging is enabled in Magento'
582594
suggestion: 'To save disk space, do not enable debug logging for your production environments.'

config/schema.yaml

+11
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.

dist/error-codes.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Critical errors indicate a problem with the Magento Commerce Cloud project confi
4646
| 104 | | Failed to parse the `.magento.env.yaml` file | Configuration is not defined in the `./vendor/magento/ece-tools/config/schema.yaml` file. Check that the config variable name is correct, and that it is defined. |
4747
| 105 | | Unable to read the `.magento.env.yaml` file | Unable to read the `./.magento.env.yaml` file. Check file permissions. |
4848
| 106 | | Unable to read the `.schema.yaml` file | |
49-
| 107 | pre-deploy: clean-redis-cache | Failed to clean the Redis cache | Failed to clean the Redis cache. Check that the Redis cache configuration is correct and that the Redis service is available. See [Setup Redis service](https://devdocs.magento.com/cloud/project/project-conf-files_services-redis.html). |
49+
| 107 | pre-deploy: clean-redis-cache | Failed to clean the Redis cache | Failed to clean the Redis cache. Check that the Redis cache configuration is correct and that the Redis service is available. See [Setup Redis service](https://devdocs.magento.com/cloud/project/services-redis.html). |
5050
| 108 | pre-deploy: set-production-mode | Command `/bin/magento maintenance:enable` failed | Check the `cloud.log` for more information. For more detailed command output, add the `VERBOSE_COMMANDS: '-vvv'` option to the `.magento.env.yaml` file. |
5151
| 109 | validate-config | Incorrect database configuration | Check that the the `DATABASE_CONFIGURATION` environment variable is configured correctly. |
5252
| 110 | validate-config | Incorrect session configuration | Check that the `SESSION_CONFIGURATION` environment variable is configured correctly. The configuration must contain at least the `save` parameter. |
@@ -71,9 +71,10 @@ Critical errors indicate a problem with the Magento Commerce Cloud project confi
7171
| 129 | install-update: reset-password | Unable to read reset password template | |
7272
| 130 | install-update: cache_type | Command failed: `php ./bin/magento cache:enable` | Command `php ./bin/magento cache:enable` runs only when Magento was installed but `./app/etc/env.php` file was absent or empty at the beginning of the deployment. Check the `cloud.log` for more information. Add `VERBOSE_COMMANDS: '-vvv'` into `.magento.env.yaml` for more detailed command output. |
7373
| 131 | install-update | The `crypt/key` key value does not exist in the `./app/etc/env.php` file or the `CRYPT_KEY` cloud environment variable | This error occurs if the `./app/etc/env.php` file is not present when Magento deployment begins, or if the `crypt/key` value is undefined. If you migrated the database from another environment, retrieve the crypt key value from that environment. Then, add the value to the [CRYPT_KEY](https://devdocs.magento.com/cloud/env/variables-deploy.html#crypt_key) cloud environment variable in your current environment. See [Add the Magento encryption key](https://devdocs.magento.com/cloud/setup/first-time-setup-import-import.html#encryption-key). If you accidentally removed the `./app/etc/env.php` file, use the following command to restore it from the backup files created from a previous deployment: `./vendor/bin/ece-tools backup:restore` CLI command ." |
74-
| 132 | | Can not connect to the Elasticsearch service | Check that credentials for elasticsearch are correct and service is running |
74+
| 132 | | Can not connect to the Elasticsearch service | Check for valid Elasticsearch credentials and verify that the service is running |
7575
| 133 | validate-config | Remove Magento Braintree module configuration which is no longer supported in Magento 2.4 and later versions. | Support for the Braintree module is no longer included with Magento 2.4.0 and later. Remove the CONFIG__STORES__DEFAULT__PAYMENT__BRAINTREE__CHANNEL variable from the variables section of the .magento.app.yaml file. For Braintree support, use an official Braintree Payments extension from the Magento Marketplace instead. |
7676
| 134 | validate-config | Magento 2.4.0 requires Elasticsearch service to be installed | Install Elasticsearch service |
77+
| 135 | validate-config | The search engine must be set to Elasticsearch for Magento >= 2.4.0 | Check the SEARCH_CONFIGURATION variable for the `engine` option. If it is configured, remove the option, or set the value to "elasticsearch". |
7778

7879
### Post-deploy stage
7980

@@ -147,7 +148,8 @@ Warning errors indicate a problem with the Magento Commerce Cloud project config
147148
| 2023 | install-update:split-db | Enabling a split database will be skipped. | |
148149
| 2024 | install-update:split-db | The SPLIT_DB variable is missing the configuration for split connection types. | |
149150
| 2025 | install-update:split-db | Slave connection not set. | |
150-
| 2026 | pre-deploy:restore-writable-dirs | Failed to restore some data generated data during the build phase to the mounted directories. | Check the `cloud.log` for more information. |
151+
| 2026 | pre-deploy:restore-writable-dirs | Failed to restore some data generated during the build phase to the mounted directories | Check the `cloud.log` for more information. |
152+
| 2027 | validate-config:mage-mode-variable | Mode value for MAGE_MODE environment variable not supported | Remove the MAGE_MODE environment variable, or change its value to "production". Magento Cloud supports "production" mode only. |
151153

152154
### Post-deploy stage
153155

scenario/deploy.xml

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<item name="elasticsuite-integrity" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\ElasticSuiteIntegrity</item>
3434
</item>
3535
<item name="warning" xsi:type="array">
36+
<item name="mage-mode-variable" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\MageModeVariable</item>
3637
<item name="database-split-connection" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\DatabaseSplitConnection</item>
3738
<item name="report-dir-nesting-level" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\ReportDirNestingLevel</item>
3839
<item name="admin-data" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\AdminData</item>

src/App/Error.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ class Error
7373
public const DEPLOY_CRYPT_KEY_IS_ABSENT = 131;
7474
public const DEPLOY_ES_CANNOT_CONNECT = 132;
7575
public const DEPLOY_WRONG_BRAINTREE_VARIABLE = 133;
76-
public const DEPLOY_WRONG_SEARCH_ENGINE = 134;
76+
public const DEPLOY_ES_SERVICE_NOT_INSTALLED = 134;
77+
public const DEPLOY_WRONG_SEARCH_ENGINE = 135;
7778

7879
public const PD_DEPLOY_IS_FAILED = 201;
7980
public const PD_ENV_PHP_IS_NOT_WRITABLE = 202;
@@ -130,6 +131,7 @@ class Error
130131
public const WARN_NOT_ENOUGH_DATA_SPLIT_DB_VAR = 2024;
131132
public const WARN_SLAVE_CONNECTION_NOT_SET = 2025;
132133
public const WARN_COPY_MOUNTED_DIRS_FAILED = 2026;
134+
public const WARN_NOT_SUPPORTED_MAGE_MODE = 2027;
133135

134136
/**
135137
* Post-deploy

src/Application.php

+2
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

+1-1
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

+1-1
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

+3-1
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

+1-1
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

+1-1
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

+1-1
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

+88
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

+1-1
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)