Skip to content

Commit 2340afb

Browse files
authored
Merge pull request #40 from magento-commerce/develop
Merge develop into 2002.1
2 parents 41949c3 + 89cdaee commit 2340afb

File tree

103 files changed

+1778
-438
lines changed

Some content is hidden

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

103 files changed

+1778
-438
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
php-versions: ['7.1', '7.2', '7.3']
10+
php-versions: ['7.1', '7.2', '7.3', '7.4']
1111
steps:
1212
- name: Checkout
1313
uses: actions/checkout@v1

.travis.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
dist: bionic
22

3+
cache:
4+
bundler: true
5+
directories:
6+
- $HOME/docker
7+
38
addons:
49
hosts:
510
- magento2.docker
@@ -31,6 +36,9 @@ stages:
3136

3237
jobs:
3338
exclude:
39+
- php: '7.1'
40+
env: TEST_SUITE=functional-ce
41+
3442
- php: '7.1'
3543
env: TEST_SUITE=functional-ee
3644

@@ -46,7 +54,8 @@ jobs:
4654
before_install:
4755
# https://github.com/kylekatarnls/update-helper/issues/9
4856
- if [ -n "${COMPOSER_VERSION}" ]; then travis_retry composer self-update ${COMPOSER_VERSION}; fi;
49-
57+
- if [ -n "${DOCKER_USERNAME}" ] && [ -n "${DOCKER_PASSWORD}" ]; then docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}; fi;
58+
- if [[ -d $HOME/docker ]]; then ls $HOME/docker/*.tar.gz | xargs -I {file} sh -c "zcat {file} | docker load"; fi
5059

5160
install:
5261
- phpenv config-add travis.php.ini
@@ -65,3 +74,6 @@ before_script:
6574
script:
6675
- if [ $TEST_SUITE == "functional-ce" ]; then ./tests/travis/functional_ce.sh; fi;
6776
- if [ $TEST_SUITE == "functional-ee" ] && [ $TRAVIS_SECURE_ENV_VARS == "true" ]; then ./tests/travis/prepare_functional_parallel.sh && ./tests/travis/functional_ee.sh; fi;
77+
- >
78+
mkdir -p $HOME/docker && docker images -a --filter='dangling=false' --format '{{.Repository}}:{{.Tag}} {{.ID}}'
79+
| xargs -n 2 -t sh -c 'test -e $HOME/docker/$1.tar.gz || docker save $0 | gzip -2 > $HOME/docker/$1.tar.gz'

composer.json

Lines changed: 2 additions & 2 deletions
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.4",
5+
"version": "2002.1.5",
66
"license": "OSL-3.0",
77
"repositories": {
88
"repo.magento.com": {
@@ -41,7 +41,7 @@
4141
"consolidation/robo": "^1.2",
4242
"php-mock/php-mock-phpunit": "^2.0",
4343
"phpmd/phpmd": "@stable",
44-
"phpstan/phpstan": "^0.11",
44+
"phpstan/phpstan": "^0.12",
4545
"phpunit/php-code-coverage": "^6.0",
4646
"phpunit/phpunit": "^7.2",
4747
"squizlabs/php_codesniffer": "^3.0",

config/schema.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,22 @@ variables:
137137
deploy:
138138
SCD_MATRIX:
139139
magento/backend: []
140+
SCD_NO_PARENT:
141+
description: Adds '--no-parent' option to SCD CLI command. This option does not allow to generate static content
142+
for parent themes what decrease time for generation static content.
143+
type: boolean
144+
magento_version: '>=2.4.2'
145+
stages:
146+
- global
147+
- build
148+
- deploy
149+
default:
150+
build: false
151+
deploy: false
152+
examples:
153+
- stage:
154+
build:
155+
SCD_NO_PARENT: true
140156
SCD_USE_BALER:
141157
description: Run Baler after performing static content deployment in order to generate an optimized JavaScript bundle.
142158
type: boolean

src/App/Logger.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,21 @@ private function prepare(): void
102102
* @param string $deployLogPath deploy log path
103103
* @param string $buildPhaseLogContent build log content
104104
* @return bool
105-
*
106-
* @throws FileSystemException
107105
*/
108106
private function isBuildLogApplied(string $deployLogPath, string $buildPhaseLogContent): bool
109107
{
110-
return false !== strpos($this->file->fileGetContents($deployLogPath), $buildPhaseLogContent);
108+
$buildLogLines = explode(PHP_EOL, $buildPhaseLogContent);
109+
if (!isset($buildLogLines[0])) {
110+
return true;
111+
}
112+
113+
$needle = strtr(addslashes($buildLogLines[0]), [
114+
'[' => '\[',
115+
']' => '\]',
116+
]);
117+
118+
$result = @shell_exec(sprintf('grep "%s" %s', $needle, $deployLogPath));
119+
120+
return !empty($result);
111121
}
112122
}

src/App/Logger/Prepare/ErrorLogFile.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,19 @@ private function isNeedToCopyBuildErrorLogFile(string $deployLogPath, string $bu
8989
return false;
9090
}
9191

92+
$buildPhaseLogContent = $this->file->fileGetContents($buildPhaseLogPath);
93+
if (empty($buildPhaseLogContent)) {
94+
return false;
95+
}
96+
9297
$deployLogFileExists = $this->file->isExists($deployLogPath);
9398
if (!$deployLogFileExists) {
9499
return true;
95100
}
96101

97102
return false === strpos(
98103
$this->file->fileGetContents($deployLogPath),
99-
$this->file->fileGetContents($buildPhaseLogPath)
104+
$buildPhaseLogContent
100105
);
101106
}
102107
}

src/Application.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ protected function getDefaultCommands()
7777
$this->container->create(Command\ConfigShow::class),
7878
$this->container->create(Command\ConfigCreate::class),
7979
$this->container->create(Command\ConfigUpdate::class),
80+
$this->container->create(Command\ConfigValidate::class),
8081
$this->container->create(Command\RunCommand::class),
8182
$this->container->create(Command\GenerateSchema::class),
8283
$this->container->create(Command\ErrorShow::class)

src/Cli.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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;
9+
10+
/**
11+
* @api
12+
*
13+
* @codeCoverageIgnore
14+
*/
15+
class Cli
16+
{
17+
public const SUCCESS = 0;
18+
public const FAILURE = 1;
19+
}

src/Command/ApplyPatches.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
namespace Magento\MagentoCloud\Command;
99

10+
use Magento\MagentoCloud\Cli;
11+
use Magento\MagentoCloud\Config\ConfigException;
1012
use Magento\MagentoCloud\Patch\Manager;
1113
use Magento\MagentoCloud\Shell\ShellException;
1214
use Symfony\Component\Console\Command\Command;
@@ -49,12 +51,15 @@ protected function configure(): void
4951
}
5052

5153
/**
52-
* {@inheritdoc}
54+
* {@inheritDoc}
5355
*
5456
* @throws ShellException
57+
* @throws ConfigException
5558
*/
56-
public function execute(InputInterface $input, OutputInterface $output)
59+
public function execute(InputInterface $input, OutputInterface $output): int
5760
{
5861
$this->manager->apply();
62+
63+
return Cli::SUCCESS;
5964
}
6065
}

src/Command/BackupList.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77

88
namespace Magento\MagentoCloud\Command;
99

10+
use Magento\MagentoCloud\Cli;
1011
use Symfony\Component\Console\Command\Command;
1112
use Symfony\Component\Console\Input\InputInterface;
1213
use Symfony\Component\Console\Output\OutputInterface;
1314
use Magento\MagentoCloud\Command\Backup\FileList as BackupFilesList;
1415
use Psr\Log\LoggerInterface;
16+
use Exception;
1517

1618
/**
1719
* CLI command for showing the list of backup files.
@@ -30,10 +32,7 @@ class BackupList extends Command
3032
*/
3133
private $logger;
3234

33-
/**
34-
* Command name
35-
*/
36-
const NAME = 'backup:list';
35+
public const NAME = 'backup:list';
3736

3837
/**
3938
* @param BackupFilesList $backupFilesList
@@ -52,7 +51,7 @@ public function __construct(
5251
/**
5352
* @inheritdoc
5453
*/
55-
protected function configure()
54+
protected function configure(): void
5655
{
5756
$this->setName(self::NAME)
5857
->setDescription('Shows the list of backup files.');
@@ -61,16 +60,21 @@ protected function configure()
6160
}
6261

6362
/**
64-
* @inheritdoc
63+
* {@inheritDoc}
64+
*
65+
* @throws Exception
6566
*/
66-
protected function execute(InputInterface $input, OutputInterface $output)
67+
protected function execute(InputInterface $input, OutputInterface $output): int
6768
{
6869
try {
6970
$output->writeln('<comment>The list of backup files:</comment>');
7071
$output->writeln($this->backupFilesList->get() ?: 'There are no files in the backup');
71-
} catch (\Exception $exception) {
72+
} catch (Exception $exception) {
7273
$this->logger->critical($exception->getMessage());
74+
7375
throw $exception;
7476
}
77+
78+
return Cli::SUCCESS;
7579
}
7680
}

0 commit comments

Comments
 (0)