Skip to content

Conversation

@AWqxKAWERbXo
Copy link

@AWqxKAWERbXo AWqxKAWERbXo commented Apr 29, 2025

This adds the ability to use submodules with update_code set to clonse_submodule while staying backwards compatible.

Issue: #2802

Using submodules were possible in Deployer 6 but not 7 and could be reintroduced like this.

  • Bug fix
  • New feature?
  • BC breaks?
  • Tests added?
  • Docs added?

Please, regenerate docs by running next command:
$ php bin/docgen

Co-authored-by: Jeffrey Cafferata <[email protected]>
run("$git clone -l $bare .");
run("$git remote set-url origin $repository", env: $env);
run("$git checkout --force $target");
run("$git submodule init");
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it's better to define it as a separate task which can be attached if needed.

Copy link
Author

Choose a reason for hiding this comment

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

I'm sorry, I'm not much into Deployer. I don't know how to solve this differently. Also, a separate task just for basically one line would be more complex.

Copy link
Member

Choose a reason for hiding this comment

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

task('deploy:git:submodules', function () {
    run('git submodule init');
    run('git submodule update');
});

Copy link
Member

Choose a reason for hiding this comment

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

host('production')
    ->set('needs_submodules', true);

after('deploy:update_code', function () {
    if (get('needs_submodules', false)) {
        invoke('deploy:git:submodules');
    }
});

@antonmedv antonmedv closed this Oct 28, 2025
@AWqxKAWERbXo AWqxKAWERbXo deleted the patch-1 branch October 28, 2025 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants