Skip to content

Commit ac79bff

Browse files
authored
MAGECLOUD-4919: Ability to run ece-tools on custom github source code (#170)
1 parent 4be9829 commit ac79bff

File tree

9 files changed

+55
-8
lines changed

9 files changed

+55
-8
lines changed

images/php/7.1-cli/bin/cloud-build

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ set -e
77
RUN_HOOKS="run-hooks"
88

99
if [ "$MAGENTO_RUN_MODE" == "production" ]; then
10-
echo "Cleaning directories."
10+
echo "Cleaning directories:"
1111

12-
rm -rf $MAGENTO_ROOT/setup/*
12+
if [ "$INSTALLATION_TYPE" == "composer" ]; then
13+
echo "Cleaning setup directory."
14+
rm -rf $MAGENTO_ROOT/setup/*
15+
fi
16+
17+
echo "Cleaning vendor directory."
1318
rm -rf $MAGENTO_ROOT/vendor/*
19+
20+
echo "Cleaning generated directory."
1421
rm -rf $MAGENTO_ROOT/generated/*
1522
fi
1623

images/php/7.2-cli/bin/cloud-build

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ set -e
77
RUN_HOOKS="run-hooks"
88

99
if [ "$MAGENTO_RUN_MODE" == "production" ]; then
10-
echo "Cleaning directories."
10+
echo "Cleaning directories:"
1111

12-
rm -rf $MAGENTO_ROOT/setup/*
12+
if [ "$INSTALLATION_TYPE" == "composer" ]; then
13+
echo "Cleaning setup directory."
14+
rm -rf $MAGENTO_ROOT/setup/*
15+
fi
16+
17+
echo "Cleaning vendor directory."
1318
rm -rf $MAGENTO_ROOT/vendor/*
19+
20+
echo "Cleaning generated directory."
1421
rm -rf $MAGENTO_ROOT/generated/*
1522
fi
1623

images/php/7.3-cli/bin/cloud-build

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ set -e
77
RUN_HOOKS="run-hooks"
88

99
if [ "$MAGENTO_RUN_MODE" == "production" ]; then
10-
echo "Cleaning directories."
10+
echo "Cleaning directories:"
1111

12-
rm -rf $MAGENTO_ROOT/setup/*
12+
if [ "$INSTALLATION_TYPE" == "composer" ]; then
13+
echo "Cleaning setup directory."
14+
rm -rf $MAGENTO_ROOT/setup/*
15+
fi
16+
17+
echo "Cleaning vendor directory."
1318
rm -rf $MAGENTO_ROOT/vendor/*
19+
20+
echo "Cleaning generated directory."
1421
rm -rf $MAGENTO_ROOT/generated/*
1522
fi
1623

images/php/cli/bin/cloud-build

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ set -e
77
RUN_HOOKS="run-hooks"
88

99
if [ "$MAGENTO_RUN_MODE" == "production" ]; then
10-
echo "Cleaning directories."
10+
echo "Cleaning directories:"
1111

12-
rm -rf $MAGENTO_ROOT/setup/*
12+
if [ "$INSTALLATION_TYPE" == "composer" ]; then
13+
echo "Cleaning setup directory."
14+
rm -rf $MAGENTO_ROOT/setup/*
15+
fi
16+
17+
echo "Cleaning vendor directory."
1318
rm -rf $MAGENTO_ROOT/vendor/*
19+
20+
echo "Cleaning generated directory."
1421
rm -rf $MAGENTO_ROOT/generated/*
1522
fi
1623

src/Command/BuildCompose.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,13 @@ protected function configure(): void
205205
InputOption::VALUE_OPTIONAL,
206206
'Cloud environment variables'
207207
)
208+
->addOption(
209+
Source\CliSource::OPTION_INSTALLATION_TYPE,
210+
null,
211+
InputOption::VALUE_OPTIONAL,
212+
'Sets magento installation type',
213+
Source\BaseSource::INSTALLATION_TYPE_COMPOSER
214+
)
208215
->addOption(
209216
Source\CliSource::OPTION_HOST,
210217
null,

src/Config/Config.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ public function getVariables(): array
289289
$config->set(SourceInterface::VARIABLES . '.' . 'MFTF_UTILS', 1);
290290
}
291291

292+
$config->set(SourceInterface::VARIABLES . '.INSTALLATION_TYPE', $this->get(SourceInterface::INSTALLATION_TYPE));
293+
292294
return $config->get(SourceInterface::VARIABLES);
293295
}
294296

src/Config/Source/BaseSource.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
*/
1818
class BaseSource implements SourceInterface
1919
{
20+
public const INSTALLATION_TYPE_GIT = 'git';
21+
public const INSTALLATION_TYPE_COMPOSER = 'composer';
22+
2023
public const DEFAULT_HOST = 'magento2.docker';
2124
public const DEFAULT_PORT = '80';
2225

@@ -46,6 +49,7 @@ public function read(): Repository
4649
self::CRON_ENABLED => false,
4750
self::CONFIG_PORT => self::DEFAULT_PORT,
4851
self::CONFIG_HOST => self::DEFAULT_HOST,
52+
self::INSTALLATION_TYPE => self::INSTALLATION_TYPE_COMPOSER
4953
]);
5054

5155
try {

src/Config/Source/CliSource.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class CliSource implements SourceInterface
3030
public const OPTION_RABBIT_MQ = 'rmq';
3131
public const OPTION_SELENIUM_VERSION = 'selenium-version';
3232
public const OPTION_SELENIUM_IMAGE = 'selenium-image';
33+
public const OPTION_INSTALLATION_TYPE = 'installation-type';
3334

3435
/**
3536
* State modifiers.
@@ -167,6 +168,10 @@ public function read(): Repository
167168
$repository->set(self::CONFIG_PORT, $port);
168169
}
169170

171+
if ($installationType = $this->input->getOption(self::OPTION_INSTALLATION_TYPE)) {
172+
$repository->set(self::INSTALLATION_TYPE, $installationType);
173+
}
174+
170175
return $repository;
171176
}
172177
}

src/Config/Source/SourceInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ interface SourceInterface
8888
public const PHP_ENABLED_EXTENSIONS = self::PHP . '.extensions.enabled';
8989
public const PHP_DISABLED_EXTENSIONS = self::PHP . '.extensions.disabled';
9090

91+
public const INSTALLATION_TYPE = 'install.type';
9192
/**
9293
* Config
9394
*/

0 commit comments

Comments
 (0)