Skip to content
Permalink
Browse files

Merge pull request #348 from nKey/submodule-reference-new

[FIXED JENKINS-18666] Submodule reference
  • Loading branch information
MarkEWaite committed Nov 16, 2015
2 parents 2c2dae0 + 8719788 commit 1840aff6a2422a771fba798a0b10595878eb7ff3
@@ -204,7 +204,7 @@ void readBackExtensionsFromLegacy() {
skipTag = null;
}
if (disableSubmodules || recursiveSubmodules || trackingSubmodules) {
addIfMissing(new SubmoduleOption(disableSubmodules, recursiveSubmodules, trackingSubmodules, null));
addIfMissing(new SubmoduleOption(disableSubmodules, recursiveSubmodules, trackingSubmodules, null, null));
}
if (isNotBlank(gitConfigName) || isNotBlank(gitConfigEmail)) {
addIfMissing(new UserIdentity(gitConfigName,gitConfigEmail));
@@ -35,17 +35,20 @@
/**
* Use --recursive flag on submodule commands - requires git>=1.6.5
* Use --remote flag on submodule update command - requires git>=1.8.2
* Use --reference flag on submodule update command - requires git>=1.6.4
*/
private boolean disableSubmodules;
private boolean recursiveSubmodules;
private boolean trackingSubmodules;
private String reference;
private Integer timeout;

@DataBoundConstructor
public SubmoduleOption(boolean disableSubmodules, boolean recursiveSubmodules, boolean trackingSubmodules, Integer timeout) {
public SubmoduleOption(boolean disableSubmodules, boolean recursiveSubmodules, boolean trackingSubmodules, String reference, Integer timeout) {
this.disableSubmodules = disableSubmodules;
this.recursiveSubmodules = recursiveSubmodules;
this.trackingSubmodules = trackingSubmodules;
this.reference = reference;
this.timeout = timeout;
}

@@ -61,6 +64,10 @@ public boolean isTrackingSubmodules() {
return trackingSubmodules;
}

public String getReference() {
return reference;
}

public Integer getTimeout() {
return timeout;
}
@@ -83,6 +90,7 @@ public void onCheckoutCompleted(GitSCM scm, Run<?, ?> build, GitClient git, Task
git.submoduleUpdate()
.recursive(recursiveSubmodules)
.remoteTracking(trackingSubmodules)
.ref(build.getEnvironment(listener).expand(reference))
.timeout(timeout)
.execute();
}
@@ -11,6 +11,9 @@ f.entry(title:_("Recursively update submodules"), field:"recursiveSubmodules") {
f.entry(title:_("Update tracking submodules to tip of branch"), field:"trackingSubmodules") {
f.checkbox()
}
f.entry(title:_("Path of the reference repo to use during submodule update"), field:"reference") {
f.textbox()
}
f.entry(title:_("Timeout (in minutes) for submodules operations"), field:"timeout") {
f.textbox()
}
@@ -0,0 +1,11 @@
<div>
Specify a folder containing a repository that will be used by Git as a reference during clone operations.<br/>
This option will be ignored if the folder is not available on the master or slave where the clone is being executed.<br/>
To prepare a reference folder with multiple subprojects, create a bare git repository and add all the remote urls then perform a fetch:<br/>
<pre>
git init --bare
git remote add SubProject1 https://gitrepo.com/subproject1
git remote add SubProject2 https://gitrepo.com/subproject2
git fetch --all
</pre>
</div>

0 comments on commit 1840aff

Please sign in to comment.
You can’t perform that action at this time.