diff --git a/docs/recipe/magento2.md b/docs/recipe/magento2.md index 7e83e7801..eb06bf245 100644 --- a/docs/recipe/magento2.md +++ b/docs/recipe/magento2.md @@ -191,7 +191,7 @@ This setting supports the same options/structure as [magento_themes](/docs/recip ### static_content_jobs [Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L64) -Also set the number of conccurent jobs to run. The default is 1 +Also set the number of concurrent jobs to run. The default is 1 Update using: `set('static_content_jobs', '1');` ```php title="Default value" @@ -353,7 +353,7 @@ true ### artifact_file -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L343) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L345) The file the artifact is saved to @@ -363,7 +363,7 @@ The file the artifact is saved to ### artifact_dir -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L346) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L348) The directory the artifact is saved in @@ -373,7 +373,7 @@ The directory the artifact is saved in ### artifact_excludes_file -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L350) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L352) Points to a file with a list of files to exclude from packaging. The format is as with the `tar --exclude-from=[file]` option @@ -384,7 +384,7 @@ The format is as with the `tar --exclude-from=[file]` option ### build_from_repo -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L353) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L355) If set to true, the artifact is built from a clean copy of the project repository instead of the current working directory @@ -394,7 +394,7 @@ false ### repository -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L356) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L358) Overrides [repository](/docs/recipe/common.md#repository) from `recipe/common.php`. @@ -406,7 +406,7 @@ null ### artifact_path -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L359) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L361) The relative path to the artifact file. If the directory does not exist, it will be created @@ -419,7 +419,7 @@ return get('artifact_dir') . '/' . get('artifact_file'); ### bin/tar -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L367) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L369) The location of the tar command. On MacOS you should have installed gtar, as it supports the required settings :::info Autogenerated @@ -430,14 +430,14 @@ The value of this configuration is autogenerated on access. ### additional_shared_files -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L439) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L441) Array of shared files that will be added to the default shared_files without overriding ### additional_shared_dirs -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L441) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L443) Array of shared directories that will be added to the default shared_dirs without overriding @@ -486,7 +486,7 @@ in `app/etc/config.php`, e.g.: ### magento:deploy:assets:adminhtml -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L209) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L210) Deploys assets for backend only. @@ -494,7 +494,7 @@ Deploys assets for backend only. ### magento:deploy:assets:frontend -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L214) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L215) Deploys assets for frontend only. @@ -502,7 +502,7 @@ Deploys assets for frontend only. ### magento:sync:content_version -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L262) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L263) Syncs content version. @@ -510,7 +510,7 @@ Syncs content version. ### magento:maintenance:enable -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L272) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L273) Enables maintenance mode. @@ -518,7 +518,7 @@ Enables maintenance mode. ### magento:maintenance:disable -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L278) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L279) Disables maintenance mode. @@ -526,7 +526,7 @@ Disables maintenance mode. ### magento:maintenance:enable-if-needed -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L284) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L285) Set maintenance mode if needed. @@ -534,7 +534,7 @@ Set maintenance mode if needed. ### magento:config:import -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L291) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L292) Config Import. @@ -542,7 +542,7 @@ Config Import. ### magento:upgrade:db -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L300) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L301) Upgrades magento database. @@ -550,7 +550,7 @@ Upgrades magento database. ### magento:cache:flush -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L309) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L311) Flushes Magento Cache. @@ -558,7 +558,7 @@ Flushes Magento Cache. ### deploy:magento -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L314) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L316) Magento2 deployment operations. @@ -575,7 +575,7 @@ This task is group task which contains next tasks: ### magento:build -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L324) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L326) Magento2 build operations. @@ -588,7 +588,7 @@ This task is group task which contains next tasks: ### deploy -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L330) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L332) Deploys your project. @@ -604,7 +604,7 @@ This task is group task which contains next tasks: ### artifact:package -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L378) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L380) Packages all relevant files in an artifact. @@ -612,7 +612,7 @@ Packages all relevant files in an artifact. ### artifact:upload -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L388) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L390) Uploads artifact in release folder for extraction. @@ -620,7 +620,7 @@ Uploads artifact in release folder for extraction. ### artifact:extract -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L393) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L395) Extracts artifact in release path. @@ -628,7 +628,7 @@ Extracts artifact in release path. ### build:remove-generated -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L399) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L401) Clears generated files prior to building. @@ -636,7 +636,7 @@ Clears generated files prior to building. ### build:prepare -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L404) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L406) Prepare local artifact build. @@ -644,7 +644,7 @@ Prepare local artifact build. ### artifact:build -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L429) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L431) Builds an artifact. @@ -661,7 +661,7 @@ This task is group task which contains next tasks: ### deploy:additional-shared -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L445) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L447) Adds additional files and dirs to the list of shared files and dirs. @@ -669,7 +669,7 @@ Adds additional files and dirs to the list of shared files and dirs. ### magento:set_cache_prefix -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L460) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L462) Update cache id_prefix. @@ -683,7 +683,7 @@ after('deploy:magento', 'magento:cleanup_cache_prefix'); ### magento:cleanup_cache_prefix -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L500) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L502) Cleanup cache id_prefix env files. @@ -691,7 +691,7 @@ After successful deployment, move the tmp_env.php file to env.php ready for next ### magento:cron:stop -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L516) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L518) Remove cron from crontab and kill running cron jobs. @@ -703,7 +703,7 @@ To use this feature, add the following to your deployer scripts: ### magento:cron:install -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L532) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L534) Install cron in crontab. @@ -715,7 +715,7 @@ To use this feature, add the following to your deployer scripts: ### artifact:prepare -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L538) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L540) Prepares an artifact on the target server. @@ -735,7 +735,7 @@ This task is group task which contains next tasks: ### artifact:finish -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L551) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L553) Executes the tasks after artifact is released. @@ -750,7 +750,7 @@ This task is group task which contains next tasks: ### artifact:deploy -[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L560) +[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L562) Actually releases the artifact deployment. diff --git a/recipe/magento2.php b/recipe/magento2.php index fdfe6d24f..0e681e7c7 100644 --- a/recipe/magento2.php +++ b/recipe/magento2.php @@ -59,7 +59,7 @@ // Configuration -// Also set the number of conccurent jobs to run. The default is 1 +// Also set the number of concurrent jobs to run. The default is 1 // Update using: `set('static_content_jobs', '1');` set('static_content_jobs', '1'); @@ -197,11 +197,12 @@ invoke('magento:deploy:assets:frontend'); } else { if (count(get('magento_themes')) > 0 ) { - foreach (get('magento_themes') as $theme) { + $themes = array_is_list(get('magento_themes')) ? get('magento_themes') : array_keys(get('magento_themes')); + foreach ($themes as $theme) { $themesToCompile .= ' -t ' . $theme; } } - run("{{bin/php}} {{release_or_current_path}}/bin/magento setup:static-content:deploy --content-version={{content_version}} {{static_deploy_options}} {{static_content_locales}} $themesToCompile -j {{static_content_jobs}}"); + run("{{bin/php}} {{release_or_current_path}}/bin/magento setup:static-content:deploy -f --content-version={{content_version}} {{static_deploy_options}} {{static_content_locales}} $themesToCompile -j {{static_content_jobs}}"); } }); @@ -299,11 +300,12 @@ function magentoDeployAssetsSplit(string $area) desc('Upgrades magento database'); task('magento:upgrade:db', function () { if (get('database_upgrade_needed')) { - run("{{bin/php}} {{bin/magento}} setup:upgrade --keep-generated --no-interaction"); + run("{{bin/php}} {{bin/magento}} setup:db-schema:upgrade --no-interaction"); + run("{{bin/php}} {{bin/magento}} setup:db-data:upgrade --no-interaction"); } else { writeln('Database schema is up to date => upgrade skipped'); } -}); +})->once(); desc('Flushes Magento Cache'); task('magento:cache:flush', function () { diff --git a/recipe/shopware.php b/recipe/shopware.php index 9042bc941..e91f4d60c 100644 --- a/recipe/shopware.php +++ b/recipe/shopware.php @@ -150,6 +150,16 @@ function getPlugins(): array 'deploy:publish', ]); +task('deploy:update_code')->setCallback(static function () { + upload('.', '{{release_path}}', [ + 'options' => [ + '--exclude=.git', + '--exclude=deploy.php', + '--exclude=node_modules', + ], + ]); +}); + task('sw-build-without-db:get-remote-config', static function () { if (!test('[ -d {{current_path}} ]')) { return; diff --git a/src/Executor/Messenger.php b/src/Executor/Messenger.php index 17b4d604a..266868a1e 100644 --- a/src/Executor/Messenger.php +++ b/src/Executor/Messenger.php @@ -52,8 +52,9 @@ public function startTask(Task $task): void if (getenv('GITHUB_WORKFLOW')) { $this->output->writeln("::group::task {$task->getName()}"); } else if (getenv('GITLAB_CI')) { + $sectionId = md5($task->getName()); $start = round($this->startTime/1000); - $this->output->writeln("\e[0Ksection_start:{$start}:{$start}[collapsed=true]\r\e[0K{$task->getName()}"); + $this->output->writeln("\e[0Ksection_start:{$start}:{$sectionId}[collapsed=true]\r\e[0K{$task->getName()}"); } else { $this->output->writeln("task {$task->getName()}"); } @@ -78,9 +79,9 @@ public function endTask(Task $task, bool $error = false): void if (getenv('GITHUB_WORKFLOW')) { $this->output->writeln("::endgroup::"); } else if (getenv('GITLAB_CI')) { + $sectionId = md5($task->getName()); $endTime = round($endTime/1000); - $start = round($this->startTime/1000); - $this->output->writeln("\e[0Ksection_end:{$endTime}:{$start}\r\e[0K"); + $this->output->writeln("\e[0Ksection_end:{$endTime}:{$sectionId}\r\e[0K"); } else if ($this->output->isVeryVerbose()) { $this->output->writeln("done {$task->getName()} $taskTime"); }