Skip to content

Commit

Permalink
Merge pull request #10 from magento-commerce/develop
Browse files Browse the repository at this point in the history
MCLOUD-7202: Release magento-cloud-docker 1.2.0 and ece-tools 2002.1.3
  • Loading branch information
oshmyheliuk authored Nov 3, 2020
2 parents c3f921f + f1e6f7f commit 7c7b400
Show file tree
Hide file tree
Showing 93 changed files with 2,279 additions and 441 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
composer config --unset repositories.repo.magento.com
composer remove --no-update magento/magento-cloud-components
composer remove --no-update magento/magento-cloud-docker
composer remove --no-update magento/quality-patches
composer remove --no-update magento/magento-cloud-patches
- name: Composer Update
run: composer update
Expand Down
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ jobs:
- php: '7.4'
env: TEST_SUITE=functional-ee

before_install:
# https://github.com/kylekatarnls/update-helper/issues/9
- if [ -n "${COMPOSER_VERSION}" ]; then travis_retry composer self-update ${COMPOSER_VERSION}; fi;


install:
- phpenv config-add travis.php.ini
- composer config http-basic.repo.magento.com ${REPO_USERNAME_CE} ${REPO_PASSWORD_CE}
- composer config github-oauth.github.com ${GITHUB_TOKEN}
- 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;
Expand Down
1 change: 1 addition & 0 deletions codeception.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ modules:
composer_magento_username: "%REPO_USERNAME%"
composer_magento_password: "%REPO_PASSWORD%"
composer_github_token: "%GITHUB_TOKEN%"
use_cached_workdir: true
printOutput: false
Magento\CloudDocker\Test\Functional\Codeception\Docker:
system_magento_dir: "%Magento.docker.settings.system.magento_dir%"
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/ece-tools",
"description": "Provides tools to build and deploy Magento 2 Enterprise Edition",
"type": "magento2-component",
"version": "2002.1.2",
"version": "2002.1.3",
"license": "OSL-3.0",
"repositories": {
"repo.magento.com": {
Expand All @@ -24,6 +24,7 @@
"magento/magento-cloud-components": "^1.0.6",
"magento/magento-cloud-docker": "^1.0.0",
"magento/magento-cloud-patches": "^1.0.6",
"magento/quality-patches": "^1.0.3",
"monolog/monolog": "^1.16",
"nesbot/carbon": "^1.0||^2.0",
"psr/container": "^1.0",
Expand Down
18 changes: 15 additions & 3 deletions config/schema.error.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
type: critical
!php/const Magento\MagentoCloud\App\Error::DEPLOY_REDIS_CACHE_CLEAN_FAILED:
title: 'Failed to clean the Redis cache'
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).'
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).'
step: 'pre-deploy: clean-redis-cache'
stage: deploy
type: critical
Expand Down Expand Up @@ -322,7 +322,7 @@
type: critical
!php/const Magento\MagentoCloud\App\Error::DEPLOY_ES_CANNOT_CONNECT:
title: 'Can not connect to the Elasticsearch service'
suggestion: 'Check that credentials for elasticsearch are correct and service is running'
suggestion: 'Check for valid Elasticsearch credentials and verify that the service is running'
stage: deploy
type: critical
!php/const Magento\MagentoCloud\App\Error::DEPLOY_WRONG_BRAINTREE_VARIABLE:
Expand All @@ -331,12 +331,18 @@
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.'
stage: deploy
type: critical
!php/const Magento\MagentoCloud\App\Error::DEPLOY_WRONG_SEARCH_ENGINE:
!php/const Magento\MagentoCloud\App\Error::DEPLOY_ES_SERVICE_NOT_INSTALLED:
step: validate-config
title: 'Magento 2.4.0 requires Elasticsearch service to be installed'
suggestion: 'Install Elasticsearch service'
stage: deploy
type: critical
!php/const Magento\MagentoCloud\App\Error::DEPLOY_WRONG_SEARCH_ENGINE:
step: validate-config
title: 'The search engine must be set to Elasticsearch for Magento >= 2.4.0'
suggestion: 'Check the SEARCH_CONFIGURATION variable for the `engine` option. If it is configured, remove the option, or set the value to "elasticsearch".'
stage: deploy
type: critical
!php/const Magento\MagentoCloud\App\Error::PD_DEPLOY_IS_FAILED:
step: is-deploy-failed
title: 'Deploy stage failed'
Expand Down Expand Up @@ -577,6 +583,12 @@
suggestion: 'Check the `cloud.log` for more information.'
step: 'pre-deploy:restore-writable-dirs'
type: warning
!php/const Magento\MagentoCloud\App\Error::WARN_NOT_SUPPORTED_MAGE_MODE:
title: 'Mode value for MAGE_MODE environment variable not supported'
stage: deploy
suggestion: 'Remove the MAGE_MODE environment variable, or change its value to "production". Magento Cloud supports "production" mode only.'
step: 'validate-config:mage-mode-variable'
type: warning
!php/const Magento\MagentoCloud\App\Error::WARN_DEBUG_LOG_ENABLED:
title: 'Debug logging is enabled in Magento'
suggestion: 'To save disk space, do not enable debug logging for your production environments.'
Expand Down
11 changes: 11 additions & 0 deletions config/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,17 @@ variables:
- stage:
global:
SKIP_HTML_MINIFICATION: true
SKIP_COMPOSER_DUMP_AUTOLOAD:
description: Skip running compose dump-autoload command
type: boolean
stages:
- build
default:
build: false
examples:
- stage:
build:
SKIP_COMPOSER_DUMP_AUTOLOAD: true
SCD_ON_DEMAND:
description: Enable generation of static content when requested by a user.
Pre-loading the cache using the post_deploy hook reduces site downtime.
Expand Down
8 changes: 5 additions & 3 deletions dist/error-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Critical errors indicate a problem with the Magento Commerce Cloud project confi
| 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. |
| 105 | | Unable to read the `.magento.env.yaml` file | Unable to read the `./.magento.env.yaml` file. Check file permissions. |
| 106 | | Unable to read the `.schema.yaml` file | |
| 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). |
| 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). |
| 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. |
| 109 | validate-config | Incorrect database configuration | Check that the the `DATABASE_CONFIGURATION` environment variable is configured correctly. |
| 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. |
Expand All @@ -71,9 +71,10 @@ Critical errors indicate a problem with the Magento Commerce Cloud project confi
| 129 | install-update: reset-password | Unable to read reset password template | |
| 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. |
| 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 ." |
| 132 | | Can not connect to the Elasticsearch service | Check that credentials for elasticsearch are correct and service is running |
| 132 | | Can not connect to the Elasticsearch service | Check for valid Elasticsearch credentials and verify that the service is running |
| 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. |
| 134 | validate-config | Magento 2.4.0 requires Elasticsearch service to be installed | Install Elasticsearch service |
| 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". |

### Post-deploy stage

Expand Down Expand Up @@ -147,7 +148,8 @@ Warning errors indicate a problem with the Magento Commerce Cloud project config
| 2023 | install-update:split-db | Enabling a split database will be skipped. | |
| 2024 | install-update:split-db | The SPLIT_DB variable is missing the configuration for split connection types. | |
| 2025 | install-update:split-db | Slave connection not set. | |
| 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. |
| 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. |
| 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. |

### Post-deploy stage

Expand Down
1 change: 1 addition & 0 deletions scenario/deploy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<item name="elasticsuite-integrity" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\ElasticSuiteIntegrity</item>
</item>
<item name="warning" xsi:type="array">
<item name="mage-mode-variable" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\MageModeVariable</item>
<item name="database-split-connection" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\DatabaseSplitConnection</item>
<item name="report-dir-nesting-level" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\ReportDirNestingLevel</item>
<item name="admin-data" xsi:type="object">Magento\MagentoCloud\Config\Validator\Deploy\AdminData</item>
Expand Down
4 changes: 3 additions & 1 deletion src/App/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class Error
public const DEPLOY_CRYPT_KEY_IS_ABSENT = 131;
public const DEPLOY_ES_CANNOT_CONNECT = 132;
public const DEPLOY_WRONG_BRAINTREE_VARIABLE = 133;
public const DEPLOY_WRONG_SEARCH_ENGINE = 134;
public const DEPLOY_ES_SERVICE_NOT_INSTALLED = 134;
public const DEPLOY_WRONG_SEARCH_ENGINE = 135;

public const PD_DEPLOY_IS_FAILED = 201;
public const PD_ENV_PHP_IS_NOT_WRITABLE = 202;
Expand Down Expand Up @@ -130,6 +131,7 @@ class Error
public const WARN_NOT_ENOUGH_DATA_SPLIT_DB_VAR = 2024;
public const WARN_SLAVE_CONNECTION_NOT_SET = 2025;
public const WARN_COPY_MOUNTED_DIRS_FAILED = 2026;
public const WARN_NOT_SUPPORTED_MAGE_MODE = 2027;

/**
* Post-deploy
Expand Down
2 changes: 2 additions & 0 deletions src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ protected function getDefaultCommands()
$this->container->create(Command\CronKill::class),
$this->container->create(Command\CronUnlock::class),
$this->container->create(Command\ConfigShow::class),
$this->container->create(Command\ConfigCreate::class),
$this->container->create(Command\ConfigUpdate::class),
$this->container->create(Command\RunCommand::class),
$this->container->create(Command\GenerateSchema::class),
$this->container->create(Command\ErrorShow::class)
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ApplyPatches.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(Manager $manager)
protected function configure(): void
{
$this->setName(self::NAME)
->setDescription('Applies custom patches');
->setDescription('Applies custom patches.');

parent::configure();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/BackupList.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function __construct(
protected function configure()
{
$this->setName(self::NAME)
->setDescription('Shows the list of backup files');
->setDescription('Shows the list of backup files.');

parent::configure();
}
Expand Down
4 changes: 3 additions & 1 deletion src/Command/BackupRestore.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ public function __construct(Restore $restore, LoggerInterface $logger)
protected function configure()
{
$this->setName(self::NAME)
->setDescription('Restore important configuration files. Run backup:list to show the list of backup files');
->setDescription(
'Restore important configuration files. Run backup:list to show the list of backup files.'
);
$this->addOption(
'force',
'f',
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Build.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Build extends Command
protected function configure()
{
$this->setName(static::NAME)
->setDescription('Builds application');
->setDescription('Builds application.');

parent::configure();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Build/Generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(Processor $processor)
protected function configure()
{
$this->setName(static::NAME)
->setDescription('Generates all necessary files for build stage');
->setDescription('Generates all necessary files for build stage.');

parent::configure();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Build/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(Processor $processor)
protected function configure()
{
$this->setName(static::NAME)
->setDescription('Transfer generated files into init directory');
->setDescription('Transfers generated files into init directory.');

parent::configure();
}
Expand Down
88 changes: 88 additions & 0 deletions src/Command/ConfigCreate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\MagentoCloud\Command;

use Magento\MagentoCloud\Filesystem\ConfigFileList;
use Magento\MagentoCloud\Filesystem\Driver\File;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Yaml\Yaml;

/**
* Creates .magento.env.yaml
*/
class ConfigCreate extends Command
{
const NAME = 'cloud:config:create';

const ARG_CONFIGURATION = 'configuration';

/**
* @var ConfigFileList
*/
private $configFileList;

/**
* @var File
*/
private $file;

/**
* @param ConfigFileList $configFileList
* @param File $file
*/
public function __construct(ConfigFileList $configFileList, File $file)
{
$this->configFileList = $configFileList;
$this->file = $file;

parent::__construct();
}

/**
* @inheritdoc
*/
protected function configure()
{
$this->setName(static::NAME)
->setDescription(
'Creates a `.magento.env.yaml` file with the specified build, deploy, and post-deploy variable ' .
'configuration. Overwrites any existing `.magento,.env.yaml` file.'
)
->addArgument(
self::ARG_CONFIGURATION,
InputArgument::REQUIRED,
'Configuration in JSON format'
);

parent::configure();
}

/**
* @inheritDoc
*/
public function execute(InputInterface $input, OutputInterface $output)
{
$configuration = $input->getArgument(self::ARG_CONFIGURATION);

$decodedConfig = json_decode($configuration, true);

if (json_last_error() !== JSON_ERROR_NONE) {
throw new \Exception('Wrong JSON format: ' . json_last_error_msg());
}

$yaml = Yaml::dump($decodedConfig, 10, 2);
$filePath = $this->configFileList->getEnvConfig();

$this->file->filePutContents($filePath, $yaml);

$output->writeln(sprintf("Config file %s was created", $filePath));
}
}
2 changes: 1 addition & 1 deletion src/Command/ConfigShow.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function __construct(
protected function configure()
{
$this->setName(static::NAME)
->setDescription('Display encoded cloud configuration environment variables')
->setDescription('Display encoded cloud configuration environment variables.')
->addArgument(
'variable',
InputArgument::IS_ARRAY,
Expand Down
Loading

0 comments on commit 7c7b400

Please sign in to comment.