Skip to content

Commit 55de719

Browse files
authored
Merge branch 'develop' into imported-magento-magento-cloud-docker-300
2 parents 86ea179 + 26b482f commit 55de719

File tree

10 files changed

+69
-20
lines changed

10 files changed

+69
-20
lines changed

Diff for: composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"codeception/module-rest": "^1.2",
2727
"consolidation/robo": "^1.2",
2828
"phpmd/phpmd": "@stable",
29-
"phpstan/phpstan": "^0.11",
29+
"phpstan/phpstan": "^0.12",
3030
"phpunit/phpunit": "^8.5",
3131
"squizlabs/php_codesniffer": "^3.0"
3232
},

Diff for: images/varnish/4.0/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ ENV VARNISHD_PARAMS -p default_ttl=3600 -p default_grace=3600 -p feature=+esi_ig
1616

1717
COPY etc/varnish.vcl /data/varnish.vcl
1818

19+
RUN ["chmod", "644", "/data/varnish.vcl"]
1920
RUN ["chmod", "+x", "/entrypoint.sh"]
2021

2122
ENTRYPOINT ["/entrypoint.sh"]

Diff for: images/varnish/6.2/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
FROM varnish:6.2
22

33
COPY etc/default.vcl /etc/varnish/
4+
5+
RUN ["chmod", "644", "/etc/varnish/default.vcl"]

Diff for: src/Cli.php

+19
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\CloudDocker;
9+
10+
/**
11+
* Return codes for CLI comamnds.
12+
*
13+
* @codeCoverageIgnore
14+
*/
15+
class Cli
16+
{
17+
public const SUCCESS = 0;
18+
public const FAILURE = 1;
19+
}

Diff for: src/Command/BuildCompose.php

+17-7
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
namespace Magento\CloudDocker\Command;
99

1010
use Magento\CloudDocker\App\GenericException;
11+
use Magento\CloudDocker\Cli;
1112
use Magento\CloudDocker\Compose\DeveloperBuilder;
1213
use Magento\CloudDocker\Compose\BuilderFactory;
1314
use Magento\CloudDocker\Config\ConfigFactory;
1415
use Magento\CloudDocker\Config\Dist\Generator;
1516
use Magento\CloudDocker\Config\Source;
1617
use Magento\CloudDocker\Filesystem\Filesystem;
1718
use Symfony\Component\Console\Command\Command;
19+
use Symfony\Component\Console\Input\ArgvInput;
1820
use Symfony\Component\Console\Input\InputInterface;
1921
use Symfony\Component\Console\Input\InputOption;
2022
use Symfony\Component\Console\Output\OutputInterface;
@@ -308,7 +310,7 @@ protected function configure(): void
308310
*
309311
* @throws GenericException
310312
*/
311-
public function execute(InputInterface $input, OutputInterface $output)
313+
public function execute(InputInterface $input, OutputInterface $output): int
312314
{
313315
$config = $this->configFactory->create([
314316
$this->sourceFactory->create(Source\BaseSource::class),
@@ -323,16 +325,24 @@ public function execute(InputInterface $input, OutputInterface $output)
323325

324326
$this->distGenerator->generate($config);
325327

328+
$content = Yaml::dump([
329+
'version' => $compose->getVersion(),
330+
'services' => $compose->getServices(),
331+
'volumes' => $compose->getVolumes(),
332+
'networks' => $compose->getNetworks()
333+
], 6, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK);
334+
335+
if ($input instanceof ArgvInput) {
336+
$content = '# ./vendor/bin/ece-docker ' . $input . PHP_EOL . $content;
337+
}
338+
326339
$this->filesystem->put(
327340
$builder->getPath(),
328-
Yaml::dump([
329-
'version' => $compose->getVersion(),
330-
'services' => $compose->getServices(),
331-
'volumes' => $compose->getVolumes(),
332-
'networks' => $compose->getNetworks()
333-
], 6, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)
341+
$content
334342
);
335343

336344
$output->writeln('<info>Configuration was built.</info>');
345+
346+
return Cli::SUCCESS;
337347
}
338348
}

Diff for: src/Command/BuildCustomCompose.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\CloudDocker\Command;
99

1010
use Magento\CloudDocker\App\ConfigurationMismatchException;
11+
use Magento\CloudDocker\Cli;
1112
use Magento\CloudDocker\Compose\BuilderFactory;
1213
use Magento\CloudDocker\Config\ConfigFactory;
1314
use Magento\CloudDocker\Config\Dist\Generator;
@@ -101,7 +102,7 @@ protected function configure(): void
101102
* @throws ConfigurationMismatchException
102103
* @throws FilesystemException
103104
*/
104-
public function execute(InputInterface $input, OutputInterface $output)
105+
public function execute(InputInterface $input, OutputInterface $output): int
105106
{
106107
$source = json_decode($input->getArgument(self::ARG_SOURCE), true);
107108

@@ -134,5 +135,7 @@ public function execute(InputInterface $input, OutputInterface $output)
134135
);
135136

136137
$output->writeln('<info>Configuration was built.</info>');
138+
139+
return Cli::SUCCESS;
137140
}
138141
}

Diff for: src/Command/BuildDist.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77

88
namespace Magento\CloudDocker\Command;
99

10+
use Magento\CloudDocker\Cli;
1011
use Magento\CloudDocker\Config\ConfigFactory;
1112
use Magento\CloudDocker\Config\Dist\Generator;
1213
use Magento\CloudDocker\App\ConfigurationMismatchException;
14+
use Magento\CloudDocker\Filesystem\FilesystemException;
1315
use Symfony\Component\Console\Command\Command;
1416
use Symfony\Component\Console\Input\InputInterface;
1517
use Symfony\Component\Console\Output\OutputInterface;
@@ -67,8 +69,9 @@ protected function configure(): void
6769
* {@inheritDoc}
6870
*
6971
* @throws ConfigurationMismatchException
72+
* @throws FilesystemException
7073
*/
71-
public function execute(InputInterface $input, OutputInterface $output)
74+
public function execute(InputInterface $input, OutputInterface $output): int
7275
{
7376
$config = $this->configFactory->create([
7477
$this->sourceFactory->create(Source\BaseSource::class),
@@ -79,5 +82,7 @@ public function execute(InputInterface $input, OutputInterface $output)
7982
$this->distGenerator->generate($config);
8083

8184
$output->writeln('<info>Dist files generated</info>');
85+
86+
return Cli::SUCCESS;
8287
}
8388
}

Diff for: src/Command/Image/GenerateEs.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\CloudDocker\Command\Image;
99

10+
use Magento\CloudDocker\Cli;
1011
use Magento\CloudDocker\Filesystem\DirectoryList;
1112
use Magento\CloudDocker\Filesystem\Filesystem;
1213
use Symfony\Component\Console\Command\Command;
@@ -21,7 +22,7 @@ class GenerateEs extends Command
2122
private const NAME = 'image:generate:es';
2223

2324
private const SINGLE_NODE = 'RUN echo "discovery.type: single-node" >> '
24-
. '/usr/share/elasticsearch/config/elasticsearch.yml';
25+
. '/usr/share/elasticsearch/config/elasticsearch.yml';
2526

2627
/**
2728
* Configuration map for generating es images data
@@ -93,7 +94,7 @@ protected function configure(): void
9394
*
9495
* {@inheritDoc}
9596
*/
96-
public function execute(InputInterface $input, OutputInterface $output)
97+
public function execute(InputInterface $input, OutputInterface $output): int
9798
{
9899
foreach ($this->versionMap as $version => $versionData) {
99100
$destination = $this->directoryList->getImagesRoot() . '/elasticsearch/' . $version;
@@ -118,5 +119,7 @@ public function execute(InputInterface $input, OutputInterface $output)
118119
}
119120

120121
$output->writeln('<info>Done</info>');
122+
123+
return Cli::SUCCESS;
121124
}
122125
}

Diff for: src/Command/Image/GeneratePhp.php

+11-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Composer\Semver\Semver;
1111
use Magento\CloudDocker\App\ConfigurationMismatchException;
12+
use Magento\CloudDocker\Cli;
1213
use Magento\CloudDocker\Filesystem\FileNotFoundException;
1314
use Magento\CloudDocker\Filesystem\Filesystem;
1415
use Magento\CloudDocker\Compose\Php\ExtensionResolver;
@@ -19,7 +20,7 @@
1920
use Symfony\Component\Console\Output\OutputInterface;
2021

2122
/**
22-
* @inheritdoc
23+
* Generates PHP images.
2324
*/
2425
class GeneratePhp extends Command
2526
{
@@ -129,9 +130,10 @@ protected function configure(): void
129130
/**
130131
* {@inheritdoc}
131132
*
132-
* @throws ConfigurationMismatchException|FileNotFoundException
133+
* @throws ConfigurationMismatchException
134+
* @throws FileNotFoundException
133135
*/
134-
public function execute(InputInterface $input, OutputInterface $output)
136+
public function execute(InputInterface $input, OutputInterface $output): int
135137
{
136138
$versions = $input->getArgument(self::ARGUMENT_VERSION);
137139

@@ -149,12 +151,15 @@ public function execute(InputInterface $input, OutputInterface $output)
149151
}
150152

151153
$output->writeln('<info>Done</info>');
154+
155+
return Cli::SUCCESS;
152156
}
153157

154158
/**
155159
* @param string $version
156160
* @param string $edition
157-
* @throws ConfigurationMismatchException|FileNotFoundException
161+
* @throws ConfigurationMismatchException
162+
* @throws FileNotFoundException
158163
*/
159164
private function build(string $version, string $edition): void
160165
{
@@ -176,7 +181,8 @@ private function build(string $version, string $edition): void
176181
* @param string $phpVersion
177182
* @param string $edition
178183
* @return string
179-
* @throws ConfigurationMismatchException|FileNotFoundException
184+
* @throws ConfigurationMismatchException
185+
* @throws FileNotFoundException
180186
*
181187
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
182188
* @SuppressWarnings(PHPMD.NPathComplexity)

Diff for: tests/static/phpstan.neon

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
parameters:
22
level: 5
33
paths:
4-
- src
4+
- ../../src
55
excludes_analyse:
6-
- %currentWorkingDirectory%/src/Test/*
6+
- ../../src/Test/*
77
reportUnmatchedIgnoredErrors: false
88
ignoreErrors:
99
- message: "#.*Ternary operator condition is always true*#"
10-
path: %currentWorkingDirectory%/src/Command/Image/GeneratePhp.php
10+
path: ../../src/Command/Image/GeneratePhp.php
1111

0 commit comments

Comments
 (0)