Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 58de4b4

Browse files
oshmyheliukBarny Shergoldmeker12
authored
MCLOUD-7072: Add CLI command for generating .magento.env.yaml (#8040)
* MCLOUD-7072: Add CLI commands for creating and updating .magento.env.yaml * Apply suggestions from code review Co-authored-by: Barny Shergold <[email protected]> Co-authored-by: Margaret Eker <[email protected]>
1 parent bc9039c commit 58de4b4

File tree

2 files changed

+69
-21
lines changed

2 files changed

+69
-21
lines changed

src/cloud/project/magento-env-yaml.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,45 @@ When a failure occurs because of an unexpected value in the `.magento.env.yaml`
6767
```
6868

6969
Make any corrections, commit, and push the changes. If you do not receive an error message, then the changes to your configuration file pass the validation.
70+
71+
## Create configuration file from CLI
72+
73+
You can use the following `ece-tools` CLI commands to generate a `.magento.env.yaml` configuration file for a Cloud environment.
74+
75+
```bash
76+
php ./vendor/bin/ece-tools cloud:config:create # Creates a new configuration file
77+
php ./vendor/bin/ece-tools cloud:config:update # Updates values in the configuration file
78+
```
79+
80+
Both commands require a single argument, a JSON-formatted array that specifies a value for at least one build, deploy, or post-deploy variable. For example, the following command sets values for the `SCD_THREADS` and `CLEAN_STATIC_FILES` variables.
81+
82+
```bash
83+
php vendor/bin/ece-tools cloud:config:create '{"stage":{"build":{"SCD_THREADS":5}, "deploy":{"CLEAN_STATIC_FILES":false}}}'
84+
```
85+
86+
This command creates a new .magento.env.yaml file with the following settings:
87+
88+
```yaml
89+
stage:
90+
build:
91+
SCD_THREADS: 5
92+
deploy:
93+
CLEAN_STATIC_FILES: false
94+
```
95+
96+
You can use the cloud:config:update command to update the new file. For example, the following command changes the `SCD_THREADS` value and adds the `SCD_COMPRESSION_TIMEOUT` configuration:
97+
98+
```bash
99+
php vendor/bin/ece-tools cloud:config:update '{"stage":{"build":{"SCD_THREADS":3, "SCD_COMPRESSION_TIMEOUT":1000}}}'
100+
```
101+
102+
The updated file contains the following configuration:
103+
104+
```yaml
105+
stage:
106+
build:
107+
SCD_THREADS: 3
108+
SCD_COMPRESSION_TIMEOUT: 1000
109+
deploy:
110+
CLEAN_STATIC_FILES: false
111+
```

src/cloud/reference/ece-tools-reference.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,45 @@ php ./vendor/bin/ece-tools list
1919

2020
```terminal
2121
Available commands:
22-
build Builds application
23-
db-dump Creates backup of database
24-
deploy Deploys application
25-
help Displays help for a command
26-
list Lists commands
27-
patch Applies custom patches
22+
build Builds application.
23+
db-dump Creates database backups.
24+
deploy Deploys application.
25+
help Displays help for a command.
26+
list Lists commands.
27+
patch Applies custom patches.
2828
post-deploy Performs after deploy operations.
29-
run Execute scenario(s)
29+
run Execute scenario(s).
3030
backup
31-
backup:list Shows the list of backup files
31+
backup:list Shows the list of backup files.
3232
backup:restore Restore important configuration files. Run backup:list to show the list of backup files
33-
build
34-
build:generate Generates all necessary files for build stage
35-
build:transfer Transfer generated files into init directory
33+
build.
34+
build:generate Generates all necessary files for build stage.
35+
build:transfer Transfers generated files into init directory.
36+
cloud
37+
cloud:config:create Creates a `.magento.env.yaml` file with the specified build, deploy, and post-deploy variable configuration. Overwrites any existing `.magento,.env.yaml` file.
38+
cloud:config:update Updates the existing `.magento.env.yaml` file with the specified configuration. Creates `.magento.env.yaml` file if it does not exist.
3639
config
3740
config:dump [dump] Dump configuration for static content deployment.
3841
cron
39-
cron:disable Disable all Magento cron processes and kills currently running
40-
cron:enable Enable Magento cron processes
41-
cron:kill Kill all Magento cron processes
42+
cron:disable Disable all Magento cron processes and kills currently running.
43+
cron:enable Enable Magento cron processes.
44+
cron:kill Kill all Magento cron processes.
4245
cron:unlock Unlock cron jobs that stuck in "running" state.
4346
dev
4447
dev:git:update-composer Updates composer for deployment from git.
4548
env
46-
env:config:show Display encoded cloud configuration environment variables
49+
env:config:show Display encoded cloud configuration environment variables.
50+
error
51+
error:show Display info about error by error id or info about all errors from the last deployment.
4752
module
48-
module:refresh Refresh config to enable newly added modules
53+
module:refresh Refresh config to enable newly added modules.
4954
wizard
50-
wizard:ideal-state Verifies ideal state of configuration
51-
wizard:master-slave Verifies master-slave configuration
52-
wizard:scd-on-build Verifies SCD on build configuration
53-
wizard:scd-on-demand Verifies SCD on demand configuration
54-
wizard:scd-on-deploy Verifies SCD on deploy configuration
55+
wizard:ideal-state Verifies ideal state of configuration.
56+
wizard:master-slave Verifies master-slave configuration.
57+
wizard:scd-on-build Verifies SCD on build configuration.
58+
wizard:scd-on-demand Verifies SCD on demand configuration.
59+
wizard:scd-on-deploy Verifies SCD on deploy configuration.
60+
wizard:split-db-state Verifies ability to split DB and whether DB was already split or not.
5561
```
5662
{:.no-copy}
5763

0 commit comments

Comments
 (0)