Skip to content
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

Remove absolute file paths from theme-config using the deploy_path #2801

Merged
merged 6 commits into from
Mar 12, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/recipe/shopware.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,15 @@ This task is group task which contains next tasks:


### sw-build-without-db:build
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L167)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L176)






### sw-build-without-db
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L171)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/shopware.php#L180)



Expand Down
13 changes: 11 additions & 2 deletions recipe/shopware.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,17 @@ function getPlugins(): array
download('{{deploy_path}}/current/files/theme-config', './files/');

// Temporary workaround to remove absolute file paths in Shopware <6.4.6.0
// See https://github.com/shopware/platform/commit/01c8ff86c7d8d3bee1888a26c24c9dc9b4529cbc and https://issues.shopware.com/issues/NEXT-17720
runLocally('sed -i "" -E \'s/\\\\\/var\\\\\/www\\\\\/htdocs\\\\\/releases\\\\\/[0-9]+\\\\\///g\' files/theme-config/* || true');
// See:
// - https://github.com/shopware/platform/commit/01c8ff86c7d8d3bee1888a26c24c9dc9b4529cbc
// - https://issues.shopware.com/issues/NEXT-17720
// - https://github.com/deployphp/deployer/issues/2754
$deployPath = get('deploy_path');
if (substr($deployPath, -1, 1) !== '/') {
$deployPath .= '/';
}
$deployPath .= 'releases/[0-9]*/';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s use releases/.+?/.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't work, it strips off the whole path;

sed -E 's#\\/var\\/www\\/htdocs\\/releases\\/.+?\\/##g' test.json

[
    {
        "storefront": {
            "path": "Resources\/app\/storefront\/src",
            "entryFilePath": "Resources\/app\/storefront\/src\/main.js",
            "webpack": null,
            "styleFiles": [
                "base.scss",
                "_base.scss",
                "@Plugins"
            ]
        }
    }
]%  

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antonmedv OK I changed the regex to;

$deployPath .= 'releases/[0-9a-zA-Z]*/';

Should be good to merge now 👍

$escapedDeployPath = str_replace('/', '\\\\/', $deployPath);
runLocally("sed -iE 's#${escapedDeployPath}##g' files/theme-config/* || true");
});
});

Expand Down