From 2844357593257e7015aaa87af36983f4d87c595d Mon Sep 17 00:00:00 2001 From: Mika Kaukoranta Date: Mon, 21 Sep 2015 22:23:53 +0300 Subject: [PATCH 1/2] Update parent to 1.580.1 This enables @DataBoundSetter. [JENKINS-30618] --- pom.xml | 2 +- src/main/java/hudson/plugins/repo/TagAction.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index ab2641f..6653ab4 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.jenkins-ci.plugins plugin - 1.424 + 1.580.1 org.jenkins-ci.plugins diff --git a/src/main/java/hudson/plugins/repo/TagAction.java b/src/main/java/hudson/plugins/repo/TagAction.java index 36575ef..1b80287 100644 --- a/src/main/java/hudson/plugins/repo/TagAction.java +++ b/src/main/java/hudson/plugins/repo/TagAction.java @@ -23,7 +23,7 @@ */ package hudson.plugins.repo; -import hudson.model.AbstractBuild; +import hudson.model.Run; import hudson.scm.AbstractScmTagAction; import org.kohsuke.stapler.export.ExportedBean; @@ -42,7 +42,7 @@ public class TagAction extends AbstractScmTagAction { * @param build * Build which we are interested in tagging */ - TagAction(final AbstractBuild build) { + TagAction(final Run build) { super(build); } From 5bb7bd9bec9986d5e0079ca5b7c787fa910cecf8 Mon Sep 17 00:00:00 2001 From: Mika Kaukoranta Date: Mon, 21 Sep 2015 22:29:52 +0300 Subject: [PATCH 2/2] Add --no-tags repo sync option [FIXED JENKINS-30618] --- checkstyle.xml | 2 +- .../java/hudson/plugins/repo/RepoScm.java | 23 +++++++++++++++++++ .../hudson/plugins/repo/RepoScm/config.jelly | 4 ++++ src/main/webapp/help-noTags.html | 6 +++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/main/webapp/help-noTags.html diff --git a/checkstyle.xml b/checkstyle.xml index 059f0e7..3c35ea1 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -43,7 +43,7 @@ Checkstyle configuration that checks coding conventions. - + diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java index a6211c7..474fad8 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; @@ -92,6 +93,7 @@ public class RepoScm extends SCM implements Serializable { private final boolean quiet; private final boolean trace; private final boolean showAllChanges; + private boolean noTags; /** * Returns the manifest repository URL. @@ -245,6 +247,11 @@ public boolean isQuiet() { */ @Exported public boolean isTrace() { return trace; } + /** + * Returns the value of noTags. + */ + @Exported + public boolean isNoTags() { return noTags; } /** * The constructor takes in user parameters and sets them. Each job using @@ -328,6 +335,18 @@ public RepoScm(final String manifestRepositoryUrl, this.repoUrl = Util.fixEmptyAndTrim(repoUrl); } + /** + * Set noTags. + * + * @param noTags + * If this value is true, add the "--no-tags" option when + * executing "repo sync". + */ + @DataBoundSetter + public final void setNoTags(final boolean noTags) { + this.noTags = noTags; + } + @Override public SCMRevisionState calcRevisionsFromBuild( final AbstractBuild build, final Launcher launcher, @@ -465,6 +484,10 @@ private int doSync(final Launcher launcher, final FilePath workspace, if (jobs > 0) { commands.add("--jobs=" + jobs); } + if (isNoTags()) { + commands.add("--no-tags"); + } + int returnCode = launcher.launch().stdout(logger).pwd(workspace) .cmds(commands).envs(env).join(); diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly index 86b37ab..609865f 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-noTags.html b/src/main/webapp/help-noTags.html new file mode 100644 index 0000000..5567c7f --- /dev/null +++ b/src/main/webapp/help-noTags.html @@ -0,0 +1,6 @@ +
+

+ Don't fetch tags. + This is passed to repo as repo sync --no-tags. +

+