junlin
junlin

Reputation: 2045

How can I config git submodule branch in Jenkins?

In the "Additional Behaviours >> Advanced sub-modules" behaviours option, I can't see the submodule branch to select.

Does it selects master by default or I can config branch in other way?

Upvotes: 3

Views: 7568

Answers (2)

vivek
vivek

Reputation: 1112

You can configure submodule branch name in your project's .gitmodules file manually.

[submodule "XXXXXXXXXX"]
    path = XXXXXXXXXX
    url = YOUR_SUBMODULE_GIT_URL
    branch = SUBMODULE_BRANCH_NAME

You have selected and configured advanced submodule behaviour for your project. After modifying above mentioned file, build your project. It will fetch and update your submodule with your configured branch mentioned as above.

Upvotes: 3

VonC
VonC

Reputation: 1329262

As I mention in Git submodules: Specify a branch/tag, your parent repo should include a .gitmodules in which you can specify the branch.

git config -f .gitmodules submodule.<path>.branch <branch>

But if that is not enough, make sure your first build step (or pre-build step) is a

git submodule update --remote

Upvotes: 3

Related Questions