diff --git a/pom.xml b/pom.xml index ab2641f..9267ec0 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.jenkins-ci.plugins plugin - 1.424 + 1.554.3 org.jenkins-ci.plugins diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java index a6211c7..057dd40 100644 --- a/src/main/java/hudson/plugins/repo/RepoScm.java +++ b/src/main/java/hudson/plugins/repo/RepoScm.java @@ -56,6 +56,7 @@ import org.apache.commons.lang.StringUtils; import org.kohsuke.stapler.DataBoundConstructor; +import org.kohsuke.stapler.DataBoundSetter; import org.kohsuke.stapler.QueryParameter; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.export.Exported; @@ -90,6 +91,7 @@ public class RepoScm extends SCM implements Serializable { private final boolean currentBranch; private final boolean resetFirst; private final boolean quiet; + private boolean forceSync; private final boolean trace; private final boolean showAllChanges; @@ -240,6 +242,13 @@ public boolean isCurrentBranch() { public boolean isQuiet() { return quiet; } + /** + * Returns the value of forceSync. + */ + @Exported + public boolean isForceSync() { + return forceSync; + } /** * Returns the value of trace. */ @@ -328,6 +337,17 @@ public RepoScm(final String manifestRepositoryUrl, this.repoUrl = Util.fixEmptyAndTrim(repoUrl); } + /** + * Enables --force-sync option on repo sync command. + * @param forceSync + * If this value is true, add the "--force-sync" option when + * executing "repo sync". + */ + @DataBoundSetter + public void setForceSync(final boolean forceSync) { + this.forceSync = forceSync; + } + @Override public SCMRevisionState calcRevisionsFromBuild( final AbstractBuild build, final Launcher launcher, @@ -462,6 +482,9 @@ private int doSync(final Launcher launcher, final FilePath workspace, if (isQuiet()) { commands.add("-q"); } + if (isForceSync()) { + commands.add("--force-sync"); + } if (jobs > 0) { commands.add("--jobs=" + jobs); } diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly index 86b37ab..202cf01 100644 --- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly +++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly @@ -56,6 +56,10 @@ + + + + diff --git a/src/main/webapp/help-forceSync.html b/src/main/webapp/help-forceSync.html new file mode 100644 index 0000000..85264a5 --- /dev/null +++ b/src/main/webapp/help-forceSync.html @@ -0,0 +1,6 @@ +
+

+ Continue sync even if a project fails to sync + This is passed to repo as repo sync --force-sync. +

+