-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Temporary workaround in shopware recipe uses constant path #2754
Comments
I didn’t get it) Can you make a pr to discuss it? |
Created PR #2755 for removal of the workaround. |
The PR mentioned causes deployments on 6.4.6.0 not to fail, but still won't work for <6.4.6.0 and when the release path is not exactly the same as |
Example file [
{
"storefront": {
"path": "Resources\/app\/storefront\/src",
"entryFilePath": "Resources\/app\/storefront\/src\/main.js",
"webpack": null,
"styleFiles": [
"\/var\/www\/htdocs\/releases\/20211124115627\/vendor\/shopware\/storefront\/Resources\/app\/storefront\/src\/scss\/base.scss",
"\/var\/www\/htdocs\/releases\/20211124115627\/vendor\/shopware\/storefront\/Resources\/app\/storefront\/src\/scss\/skin\/shopware\/_base.scss",
"@Plugins"
]
}
}
] Run [
{
"storefront": {
"path": "Resources\/app\/storefront\/src",
"entryFilePath": "Resources\/app\/storefront\/src\/main.js",
"webpack": null,
"styleFiles": [
"vendor\/shopware\/storefront\/Resources\/app\/storefront\/src\/scss\/base.scss",
"vendor\/shopware\/storefront\/Resources\/app\/storefront\/src\/scss\/skin\/shopware\/_base.scss",
"@Plugins"
]
}
}
] Let's say That would mean this; Would need to be this; So Which would give us; $deployPath = get('deploy_path');
if (substr($deployPath, -1, 1) !== '/') {
$deployPath .= '/';
}
$deployPath .= 'releases/[0-9a-zA-Z]*/';
$escapedDeployPath = str_replace('/', '\\\\/', $deployPath);
runLocally("sed -iE 's#${escapedDeployPath}##g' files/theme-config/* || true"); Here's a quick & dirty test script; <?php
file_put_contents('test.json', '[
{
"storefront": {
"path": "Resources\/app\/storefront\/src",
"entryFilePath": "Resources\/app\/storefront\/src\/main.js",
"webpack": null,
"styleFiles": [
"\/var\/www\/htdocs\/releases\/20211124115627\/vendor\/shopware\/storefront\/Resources\/app\/storefront\/src\/scss\/base.scss",
"\/var\/www\/htdocs\/releases\/20211124115627\/vendor\/shopware\/storefront\/Resources\/app\/storefront\/src\/scss\/skin\/shopware\/_base.scss",
"@Plugins"
]
}
}
]');
$deployPath = '/var/www/htdocs';
// Ensure deploy path has a trailing slash
if (substr($deployPath, -1, 1) !== '/') {
$deployPath .= '/';
}
$deployPath .= 'releases/[0-9a-zA-Z]*/';
$escapedDeployPath = str_replace('/', '\\\\/', $deployPath);
$command = "sed -E 's#${escapedDeployPath}##g' test.json";
echo $command . PHP_EOL . PHP_EOL;
echo shell_exec($command); Output; [
{
"storefront": {
"path": "Resources\/app\/storefront\/src",
"entryFilePath": "Resources\/app\/storefront\/src\/main.js",
"webpack": null,
"styleFiles": [
"vendor\/shopware\/storefront\/Resources\/app\/storefront\/src\/scss\/base.scss",
"vendor\/shopware\/storefront\/Resources\/app\/storefront\/src\/scss\/skin\/shopware\/_base.scss",
"@Plugins"
]
}
}
] |
@Schrank I did a PR here; https://github.com/deployphp/deployer/pull/2801/files It's not 100% perfect because it still relies on the release name being numeric, which might not be the case, while within reasonable probability we can assume it is. edit; fixed the regex |
@peterjaap Very clean work! |
Thanks! |
The following line in the shopware recipe fixes absolute paths in theme config files. But the given absolute path can vary from deployment to deployment:
runLocally('sed -i "" -E \'s/\\\\\/var\\\\\/www\\\\\/htdocs\\\\\/releases\\\\\/[0-9]+\\\\\///g\' files/theme-config/*');
In my case the project is stored in an other path than "/var/www/htdocs". There is currently no way to change this path.
Btw: if I'm right the workaround is no longer needed, since it was fixed in Shopware 6.4.6.0: https://issues.shopware.com/issues/NEXT-17720. Maybe the workaround can simply be deleted.
The text was updated successfully, but these errors were encountered: