Skip to content

update_code recipe - 3rd option update_code_strategy that loads submodule #4063

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alxndr-w
Copy link

@alxndr-w alxndr-w 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 <jeffrey@jcid.nl>
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');
    }
});

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