From 898c66b68dee92e3d6af1601a9d33621b25eef49 Mon Sep 17 00:00:00 2001
From: Bjarke Freund-Hansen
Date: Mon, 20 Feb 2012 11:51:08 +0100
Subject: [PATCH 001/184] Fixed NPE in RevisionState.hashCode()
---
src/main/java/hudson/plugins/repo/RevisionState.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/main/java/hudson/plugins/repo/RevisionState.java b/src/main/java/hudson/plugins/repo/RevisionState.java
index 6ed583f..c36096c 100644
--- a/src/main/java/hudson/plugins/repo/RevisionState.java
+++ b/src/main/java/hudson/plugins/repo/RevisionState.java
@@ -136,7 +136,9 @@ public boolean equals(final Object obj) {
@Override
public int hashCode() {
- return branch.hashCode() ^ manifest.hashCode() ^ projects.hashCode();
+ return (branch != null ? branch.hashCode() : 0)
+ ^ (manifest != null ? manifest.hashCode() : 0)
+ ^ projects.hashCode();
}
/**
From d48ea50ab88f37a30c084cc3fd3868b2a29b824c Mon Sep 17 00:00:00 2001
From: Arnaud Heritier
Date: Wed, 4 Apr 2012 17:05:23 +0300
Subject: [PATCH 002/184] RElease a bugfix for JENKINS-12466
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 4774dfd..4ea683b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.3-SNAPSHOT
+ 1.2.1-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
From 2740ebd710e87dc45b6c90a6b316104b87e005e1 Mon Sep 17 00:00:00 2001
From: Nicolas De Loof
Date: Fri, 6 Apr 2012 18:11:54 +0200
Subject: [PATCH 003/184] updated maven pom to use repo.jenkins-ci.org
repository
---
pom.xml | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 4ea683b..837f75b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -99,4 +99,20 @@
http://github.com/jenkinsci/repo-plugin
-
+
+
+
+ repo.jenkins-ci.org
+ http://repo.jenkins-ci.org/public/
+
+
+
+
+
+ repo.jenkins-ci.org
+ http://repo.jenkins-ci.org/public/
+
+
+
+
+
From 3fb046ccc4b8e9396b6d658c8779ba3a6939f0bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arnaud=20He=CC=81ritier?=
Date: Mon, 23 Apr 2012 12:58:51 +0200
Subject: [PATCH 004/184] [maven-release-plugin] prepare release repo-1.2.1
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 837f75b..98a38cb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.2.1-SNAPSHOT
+ 1.2.1
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
From d908037b8c2a3e34c7cf51bdbbc2eb44110774d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arnaud=20He=CC=81ritier?=
Date: Mon, 23 Apr 2012 12:58:57 +0200
Subject: [PATCH 005/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 98a38cb..07e934c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.2.1
+ 1.2.2-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
From 87878522dd1ad5ee56e1712e2066a03d2b4d33ba Mon Sep 17 00:00:00 2001
From: Bjarke Freund-Hansen
Date: Wed, 7 Nov 2012 12:50:35 +0100
Subject: [PATCH 006/184] Caching of ProjectState objects.
Made the existing constructor of ProjectState private, and created a new
named constructor which caches the instances of ProjectState. This ensures
that no two identical ProjectStates will exist.
---
.../hudson/plugins/repo/ProjectState.java | 49 +++++++++++++++++--
.../hudson/plugins/repo/RevisionState.java | 9 ++--
.../plugins/repo/TestRevisionState.java | 10 ++--
3 files changed, 55 insertions(+), 13 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/ProjectState.java b/src/main/java/hudson/plugins/repo/ProjectState.java
index 4b6af2e..258a239 100644
--- a/src/main/java/hudson/plugins/repo/ProjectState.java
+++ b/src/main/java/hudson/plugins/repo/ProjectState.java
@@ -23,6 +23,8 @@
*/
package hudson.plugins.repo;
+import java.util.HashMap;
+import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -31,7 +33,7 @@
* when projects have changed. A repo manifest contains a list of projects, and
* a build in Hudson has a list of ProjectStates.
*/
-public class ProjectState {
+public final class ProjectState {
private final String path;
private final String serverPath;
@@ -40,9 +42,14 @@ public class ProjectState {
private static Logger debug =
Logger.getLogger("hudson.plugins.repo.ProjectState");
+ private static Map projectStateCache
+ = new HashMap();
+
/**
* Create an object representing the state of a project.
*
+ * Project state is immutable and cached.
+ *
* @param path
* The client-side path of the project
* @param serverPath
@@ -50,7 +57,25 @@ public class ProjectState {
* @param revision
* The SHA-1 revision of the project
*/
- public ProjectState(final String path, final String serverPath,
+ public static synchronized ProjectState constructCachedInstance(
+ final String path, final String serverPath, final String revision) {
+ ProjectState projectState
+ = projectStateCache.get(
+ calculateHashCode(path, serverPath, revision));
+
+ if (projectState == null) {
+ projectState = new ProjectState(path, serverPath, revision);
+ projectStateCache.put(projectState.hashCode(), projectState);
+ }
+
+ return projectState;
+ }
+
+ /**
+ * Private constructor called by named constructor
+ * constructCachedInstance().
+ */
+ private ProjectState(final String path, final String serverPath,
final String revision) {
this.path = path;
this.serverPath = serverPath;
@@ -99,8 +124,24 @@ public boolean equals(final Object obj) {
@Override
public int hashCode() {
+ return calculateHashCode(path, serverPath, revision);
+ }
+
+ /**
+ * Calculates the hash code of a would-be ProjectState object with
+ * the provided parameters.
+ *
+ * @param path
+ * The client-side path of the project
+ * @param serverPath
+ * The server-side path of the project
+ * @param revision
+ * The SHA-1 revision of the project
+ */
+ public static int calculateHashCode(final String path,
+ final String serverPath, final String revision) {
return 23 + (path == null ? 37 : path.hashCode())
- + (serverPath == null ? 97 : serverPath.hashCode())
- + (revision == null ? 389 : revision.hashCode());
+ + (serverPath == null ? 97 : serverPath.hashCode())
+ + (revision == null ? 389 : revision.hashCode());
}
}
diff --git a/src/main/java/hudson/plugins/repo/RevisionState.java b/src/main/java/hudson/plugins/repo/RevisionState.java
index c36096c..8b7b0e8 100644
--- a/src/main/java/hudson/plugins/repo/RevisionState.java
+++ b/src/main/java/hudson/plugins/repo/RevisionState.java
@@ -104,8 +104,8 @@ public RevisionState(final String manifest, final String branch,
path = serverPath;
}
if (path != null && serverPath != null && revision != null) {
- projects.put(path, new ProjectState(path, serverPath,
- revision));
+ projects.put(path, ProjectState.constructCachedInstance(
+ path, serverPath, revision));
if (logger != null) {
logger.println("Added a project: " + path
+ " at revision: " + revision);
@@ -194,8 +194,9 @@ public List whatChanged(final RevisionState previousState) {
// This is a new project, just added to the manifest.
final ProjectState newProject = projects.get(key);
debug.log(Level.FINE, "New project: " + key);
- changes.add(new ProjectState(newProject.getPath(), newProject
- .getServerPath(), null));
+ changes.add(ProjectState.constructCachedInstance(
+ newProject.getPath(), newProject.getServerPath(),
+ null));
} else if (!status.equals(projects.get(key))) {
changes.add(previousStateCopy.get(key));
}
diff --git a/src/test/java/hudson/plugins/repo/TestRevisionState.java b/src/test/java/hudson/plugins/repo/TestRevisionState.java
index e152d0d..d08dbcd 100644
--- a/src/test/java/hudson/plugins/repo/TestRevisionState.java
+++ b/src/test/java/hudson/plugins/repo/TestRevisionState.java
@@ -95,15 +95,15 @@ public void testChangeDetection() {
List changes = stateTwo.whatChanged(stateOne);
List expectedChanges = new ArrayList();
- expectedChanges.add(new ProjectState("a", "a", "c9039e9649d133d80073e432816b9b4915776b41"));
- expectedChanges.add(new ProjectState("c", "c", "fa822eff984195ec8923718cd025fd44b77a26ef"));
- expectedChanges.add(new ProjectState("d", "d", null));
+ expectedChanges.add(ProjectState.constructCachedInstance("a", "a", "c9039e9649d133d80073e432816b9b4915776b41"));
+ expectedChanges.add(ProjectState.constructCachedInstance("c", "c", "fa822eff984195ec8923718cd025fd44b77a26ef"));
+ expectedChanges.add(ProjectState.constructCachedInstance("d", "d", null));
Assert.assertEquals(expectedChanges, changes);
changes = stateThree.whatChanged(stateTwo);
expectedChanges.clear();
- expectedChanges.add(new ProjectState("b", "b", "c27d6b02c859b291878db67f256cefac3adb26df"));
- expectedChanges.add(new ProjectState("c", "c", "7086d7305fa6c7c1930de1e7d96fffc9c819b479"));
+ expectedChanges.add(ProjectState.constructCachedInstance("b", "b", "c27d6b02c859b291878db67f256cefac3adb26df"));
+ expectedChanges.add(ProjectState.constructCachedInstance("c", "c", "7086d7305fa6c7c1930de1e7d96fffc9c819b479"));
Assert.assertEquals(expectedChanges, changes);
}
}
From c741a0cf9297b13dd8df14cdf26d210e627b6f52 Mon Sep 17 00:00:00 2001
From: Bjarke Freund-Hansen
Date: Wed, 7 Nov 2012 15:51:23 +0100
Subject: [PATCH 007/184] Unit tests of ProjectState
Testing for equality and that caching of ProjectState object instances
works.
---
.../hudson/plugins/repo/TestProjectState.java | 68 +++++++++++++++++++
1 file changed, 68 insertions(+)
create mode 100644 src/test/java/hudson/plugins/repo/TestProjectState.java
diff --git a/src/test/java/hudson/plugins/repo/TestProjectState.java b/src/test/java/hudson/plugins/repo/TestProjectState.java
new file mode 100644
index 0000000..d6ead42
--- /dev/null
+++ b/src/test/java/hudson/plugins/repo/TestProjectState.java
@@ -0,0 +1,68 @@
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2011, Brad Larson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package hudson.plugins.repo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+
+import junit.framework.TestCase;
+
+/**
+ * Test cases for the {@link RevisionState} class.
+ */
+public class TestProjectState extends TestCase {
+
+ private ProjectState projectStateA = ProjectState.constructCachedInstance("a", "a",
+ "c9039e9649d133d80073e432816b9b4915776b41");
+
+
+ private ProjectState projectStateB = ProjectState.constructCachedInstance("b", "b",
+ "fa822eff984195ec8923718cd025fd44b77a26ef");
+
+ private ProjectState projectStateA2 = ProjectState.constructCachedInstance("a", "a",
+ "c9039e9649d133d80073e432816b9b4915776b41");
+
+
+ /**
+ * Test {@link ProjectState#constructCachedInstance(String, String, String)}
+ */
+ public void testCaching()
+ {
+ Assert.assertTrue(projectStateA == projectStateA2);
+ Assert.assertFalse(projectStateA == projectStateB);
+ Assert.assertFalse(projectStateB == projectStateA2);
+ }
+
+ /**
+ * Test {@link ProjectState#equals(Object)}.
+ */
+ public void testEquality()
+ {
+ Assert.assertTrue(projectStateA.equals(projectStateA2));
+ Assert.assertFalse(projectStateA.equals(projectStateB));
+ Assert.assertFalse(projectStateB.equals(projectStateA2));
+ }
+}
From 39c48d59c23ef5fc1c4b1d76a31c3580efb76443 Mon Sep 17 00:00:00 2001
From: Bjarke Freund-Hansen
Date: Thu, 8 Nov 2012 10:03:04 +0100
Subject: [PATCH 008/184] Using cache of ProjectStates for xstream
deserialization.
Implemented the readReslove() method in ProjectState, such that the
cache is used when objects are deserialized by xstream from disk on
jenkins startup.
---
.../java/hudson/plugins/repo/ProjectState.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/main/java/hudson/plugins/repo/ProjectState.java b/src/main/java/hudson/plugins/repo/ProjectState.java
index 258a239..d41fb9c 100644
--- a/src/main/java/hudson/plugins/repo/ProjectState.java
+++ b/src/main/java/hudson/plugins/repo/ProjectState.java
@@ -85,6 +85,24 @@ private ProjectState(final String path, final String serverPath,
+ " revision: " + revision);
}
+ /**
+ * Enforce usage of the cache when xstream deserializes the
+ * ProjectState objects.
+ */
+ private synchronized Object readResolve() {
+ ProjectState projectState
+ = projectStateCache.get(
+ calculateHashCode(path, serverPath, revision));
+
+ if (projectState == null) {
+ projectStateCache.put(this.hashCode(), this);
+ projectState = this;
+ }
+
+ return projectState;
+ }
+
+
/**
* Gets the client-side path of the project.
*/
From fb6ea7e78fc0e59de4b9e7e2a7274f3648e7a263 Mon Sep 17 00:00:00 2001
From: "kyunam.jo"
Date: Tue, 10 Jul 2012 17:41:43 +0900
Subject: [PATCH 009/184] Add feature: support two repo sync's options
- current branch option(-c) is fetch only current branch from server
if this option is enabled, sync operation will be more faster
- quiet option(-q) is more quiet. you can't see tag and branch information
if this option is enabled, log file will be more smaller
---
checkstyle.xml | 4 ++-
.../java/hudson/plugins/repo/RepoScm.java | 32 ++++++++++++++++++-
.../hudson/plugins/repo/RepoScm/config.jelly | 10 ++++++
src/main/webapp/help-currentBranch.html | 8 +++++
src/main/webapp/help-quiet.html | 8 +++++
5 files changed, 60 insertions(+), 2 deletions(-)
create mode 100644 src/main/webapp/help-currentBranch.html
create mode 100644 src/main/webapp/help-quiet.html
diff --git a/checkstyle.xml b/checkstyle.xml
index 785f8a6..c0f2ece 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -42,7 +42,9 @@ 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 42d66cf..d333a7a 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -74,6 +74,8 @@ public class RepoScm extends SCM {
private final int jobs;
private final String localManifest;
private final String destinationDir;
+ private final boolean currentBranch;
+ private final boolean quiet;
/**
* Returns the manifest repository URL.
@@ -130,6 +132,19 @@ public String getDestinationDir() {
return destinationDir;
}
+ /**
+ * Returns the value of currentBranch.
+ */
+ public boolean isCurrentBranch() {
+ return currentBranch;
+ }
+
+ /**
+ * Returns the value of quiet.
+ */
+ public boolean isQuiet() {
+ return quiet;
+ }
/**
* The constructor takes in user parameters and sets them. Each job using
* the RepoSCM will call this constructor.
@@ -154,12 +169,19 @@ public String getDestinationDir() {
* @param destinationDir
* If not null then the source is synced to the destinationDir
* subdirectory of the workspace.
+ * @param currentBranch
+ * if this value is true,
+ * add "-c" options when excute "repo sync".
+ * @param quiet
+ * if this value is true,
+ * add "-q" options when excute "repo sync".
*/
@DataBoundConstructor
public RepoScm(final String manifestRepositoryUrl,
final String manifestBranch, final String manifestFile,
final String mirrorDir, final int jobs,
- final String localManifest, final String destinationDir) {
+ final String localManifest, final String destinationDir,
+ final boolean currentBranch, final boolean quiet) {
this.manifestRepositoryUrl = manifestRepositoryUrl;
this.manifestBranch = Util.fixEmptyAndTrim(manifestBranch);
this.manifestFile = Util.fixEmptyAndTrim(manifestFile);
@@ -167,6 +189,8 @@ public RepoScm(final String manifestRepositoryUrl,
this.jobs = jobs;
this.localManifest = Util.fixEmptyAndTrim(localManifest);
this.destinationDir = Util.fixEmptyAndTrim(destinationDir);
+ this.currentBranch = currentBranch;
+ this.quiet = quiet;
// TODO: repoUrl
this.repoUrl = null;
}
@@ -271,6 +295,12 @@ private int doSync(final Launcher launcher, final FilePath workspace,
commands.add(getDescriptor().getExecutable());
commands.add("sync");
commands.add("-d");
+ if (isCurrentBranch()) {
+ commands.add("-c");
+ }
+ if (isQuiet()) {
+ commands.add("-q");
+ }
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 6512e8d..27ecc33 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -32,6 +32,16 @@
+
+
+
+
+
+
+
+
diff --git a/src/main/webapp/help-currentBranch.html b/src/main/webapp/help-currentBranch.html
new file mode 100644
index 0000000..e8b4bb5
--- /dev/null
+++ b/src/main/webapp/help-currentBranch.html
@@ -0,0 +1,8 @@
+
+
+ If this option value is checked, added repo sync '-c' option.
+ This option is fetched only current branch from server.
+ So sync operation is more faster than operation without this option
+ This is passed to repo as repo sync -c.
+
+
diff --git a/src/main/webapp/help-quiet.html b/src/main/webapp/help-quiet.html
new file mode 100644
index 0000000..233228b
--- /dev/null
+++ b/src/main/webapp/help-quiet.html
@@ -0,0 +1,8 @@
+
+
+ If this option value is checked, added repo sync '-q' option.
+ This option is be more quiet. you can't see tag and branch information
+ So log file is more smaller than orignal log file
+ This is passed to repo as repo sync -q.
+
+
From a31c966e6a220761ec7ccc85718038f33ad3da9f Mon Sep 17 00:00:00 2001
From: Bjarke Freund-Hansen
Date: Wed, 14 Nov 2012 08:41:21 +0100
Subject: [PATCH 010/184] Corrected identation
---
src/main/java/hudson/plugins/repo/RepoScm.java | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index d333a7a..381464c 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -134,17 +134,18 @@ public String getDestinationDir() {
/**
* Returns the value of currentBranch.
- */
+ */
public boolean isCurrentBranch() {
return currentBranch;
}
- /**
+ /**
* Returns the value of quiet.
- */
+ */
public boolean isQuiet() {
return quiet;
}
+
/**
* The constructor takes in user parameters and sets them. Each job using
* the RepoSCM will call this constructor.
@@ -298,9 +299,9 @@ private int doSync(final Launcher launcher, final FilePath workspace,
if (isCurrentBranch()) {
commands.add("-c");
}
- if (isQuiet()) {
- commands.add("-q");
- }
+ if (isQuiet()) {
+ commands.add("-q");
+ }
if (jobs > 0) {
commands.add("--jobs=" + jobs);
}
From 7e85c2ae9eefff0494ec453ef5f50bf305ce97ed Mon Sep 17 00:00:00 2001
From: Bjarke Freund-Hansen
Date: Wed, 14 Nov 2012 08:02:35 +0100
Subject: [PATCH 011/184] Improved wording of help text
... for current branch and quiet repo options.
---
src/main/webapp/help-currentBranch.html | 7 +++----
src/main/webapp/help-quiet.html | 4 +---
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/main/webapp/help-currentBranch.html b/src/main/webapp/help-currentBranch.html
index e8b4bb5..d3f3be7 100644
--- a/src/main/webapp/help-currentBranch.html
+++ b/src/main/webapp/help-currentBranch.html
@@ -1,8 +1,7 @@
-
- If this option value is checked, added repo sync '-c' option.
- This option is fetched only current branch from server.
- So sync operation is more faster than operation without this option
+
+ Fetch only the current branch from server.
+ Increases the speed of the repo sync operation.
This is passed to repo as repo sync -c.
diff --git a/src/main/webapp/help-quiet.html b/src/main/webapp/help-quiet.html
index 233228b..097aa73 100644
--- a/src/main/webapp/help-quiet.html
+++ b/src/main/webapp/help-quiet.html
@@ -1,8 +1,6 @@
- If this option value is checked, added repo sync '-q' option.
- This option is be more quiet. you can't see tag and branch information
- So log file is more smaller than orignal log file
+ Make repo more quiet.
This is passed to repo as repo sync -q.
From b7c8ee255d106c5104e3ce5846d4f2959be18469 Mon Sep 17 00:00:00 2001
From: Bjarke Freund-Hansen
Date: Wed, 14 Nov 2012 08:10:52 +0100
Subject: [PATCH 012/184] Updated roadmap
---
ROADMAP | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/ROADMAP b/ROADMAP
index ca7d05f..41f5f4a 100644
--- a/ROADMAP
+++ b/ROADMAP
@@ -1,10 +1,15 @@
-Future features roadmap (Mostly from Sony Ericson)
+Future features roadmap
+=======================
Roughly in order of priority. I have no solid plans to work on any of these,
but if you'd like to make any contributions, this list is a good place to
start!
Investigate usage of ToolInstaller
+ Automagically fetch repo from a URL, put it in the workspace and
+ put that dir in the PATH for the current build. Such that it is
+ not necessary to install repo manually on all your slaves.
+
Wipe workspace option? (Follow git plugin here)
Badge/Tag support
@@ -12,3 +17,4 @@ Gerrit-Download integration (Gerrit Trigger plugin support)
Better auto-retry logic
Support smartsync (-s option)
+
From c7bbc7c728c93ccc505301a135cfa9db2793db4c Mon Sep 17 00:00:00 2001
From: Bjarke Freund-Hansen
Date: Wed, 14 Nov 2012 08:12:12 +0100
Subject: [PATCH 013/184] Bjarke added to maintainers and copyright notice
---
LICENSE.txt | 1 +
README.txt | 3 ++-
pom.xml | 10 ++++++++++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/LICENSE.txt b/LICENSE.txt
index 28a4c19..bc36cca 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,5 +1,6 @@
The MIT License
+Copyright (c) 2012-, Bjarke Freund-Hansen
Copyright (c) 2011-, Brad Larson
Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/README.txt b/README.txt
index 3429d66..9e98d62 100644
--- a/README.txt
+++ b/README.txt
@@ -7,6 +7,7 @@ a static manifest.
=============
-Maintainer
+Maintainers
+Bjarke Freund-Hansen - bjarkefh@gmail.com
Brad Larson - bklarson@gmail.com
diff --git a/pom.xml b/pom.xml
index 07e934c..8e6b6bb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,6 +23,16 @@
+
+ bjarkef
+ Bjarke Freund-Hansen
+ bjarkefh@gmail.com
+
+ developer
+ maintainer
+
+ +1
+
bklarson
Brad Larson
From 39dc567cea2bd9b27ff538b11cb4adb4c745e396 Mon Sep 17 00:00:00 2001
From: Joe Hansche
Date: Fri, 24 Aug 2012 19:16:57 -0400
Subject: [PATCH 014/184] [FIXED JENKINS-14926] Implement the parent
interface's getAffectedFiles() method.
---
src/main/java/hudson/plugins/repo/ChangeLogEntry.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/main/java/hudson/plugins/repo/ChangeLogEntry.java b/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
index 8743214..1087047 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
@@ -260,6 +260,15 @@ public List getModifiedFiles() {
return modifiedFiles;
}
+ /**
+ * Returns a set of paths in the workspace that was
+ * affected by this change.
+ */
+ @Override
+ public List getAffectedFiles() {
+ return modifiedFiles;
+ }
+
@Override
public String getMsg() {
return getCommitText();
From f2ead6f615c42097413f1cf4ba17d6e7ca43b71a Mon Sep 17 00:00:00 2001
From: Bjarke Freund-Hansen
Date: Wed, 14 Nov 2012 08:59:05 +0100
Subject: [PATCH 015/184] New Known Bugs file
---
KNOWN_BUGS.txt | 5 +++++
1 file changed, 5 insertions(+)
create mode 100644 KNOWN_BUGS.txt
diff --git a/KNOWN_BUGS.txt b/KNOWN_BUGS.txt
new file mode 100644
index 0000000..ced75d0
--- /dev/null
+++ b/KNOWN_BUGS.txt
@@ -0,0 +1,5 @@
+Known bugs
+==========
+
+Manually building a project with no changes, will cause a
+"failed to determine" changes in the build result.
From b2e0bff4cd4382a1c57e1ae026f9acb21a22df01 Mon Sep 17 00:00:00 2001
From: Pekka Nikander
Date: Tue, 9 Oct 2012 09:30:11 +0300
Subject: [PATCH 016/184] Allow localManifest to be specified either literally
or as an URL.
Check the beginning of the localManifest field. If it starts with
legal XML preamble
+ The may be given here literally, as XML; see the example below.
+Such literal content must start with the
+string <?xml. Alternatively, the content may be given
+as an URL, in which case the file pointed by the URL is user. If the
+content does not start with the code<?xml prefix, it is
+assumed to be an URL.
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <manifest>
+ <project path="external/project" name="org/project" remote="github" revision="master" /&/gt;
+ </manifest>
+
From 2aafc0f05b8f881b43a2d78e2dd67df0fe3f2d07 Mon Sep 17 00:00:00 2001
From: Pekka Nikander
Date: Fri, 12 Oct 2012 09:40:24 +0300
Subject: [PATCH 017/184] Enhance comments and help for localManifest
---
src/main/java/hudson/plugins/repo/RepoScm.java | 8 ++++----
src/main/webapp/help-localManifest.html | 13 +++++++------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index b944cdf..49d8081 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -167,10 +167,10 @@ public boolean isQuiet() {
* The number of concurrent jobs to use for the sync command. If
* this is 0 or negative the jobs parameter is not specified.
* @param localManifest
- * May be null, a string containing XML, or an URL.
- * If XML, this string is written to .repo/local_manifest.xml
- * If an URL, the URL is fetched and the content is written
- * to .repo/local_manifest.xml
+ * May be null, a string containing XML, or an URL.
+ * If XML, this string is written to .repo/local_manifest.xml
+ * If an URL, the URL is fetched and the content is written
+ * to .repo/local_manifest.xml
* @param destinationDir
* If not null then the source is synced to the destinationDir
* subdirectory of the workspace.
diff --git a/src/main/webapp/help-localManifest.html b/src/main/webapp/help-localManifest.html
index 9c82fc8..13f3dcf 100644
--- a/src/main/webapp/help-localManifest.html
+++ b/src/main/webapp/help-localManifest.html
@@ -1,18 +1,19 @@
- The contents of .repo/local_manifest.xml. This is written prior to
-callinging sync. The default is to not use a local_manifest file.
+ The contents of .repo/local_manifest.xml. This is written prior to
+callinging sync. The default is to not use a local_manifest.txt file.
-
The may be given here literally, as XML; see the example below.
+
The contents may be given here literally, as XML; see the example below.
Such literal content must start with the
string <?xml. Alternatively, the content may be given
-as an URL, in which case the file pointed by the URL is user. If the
-content does not start with the code<?xml prefix, it is
+as an URL, in which case the file pointed by the URL is used. If the
+content does not start with the <?xml prefix, it is
assumed to be an URL.
+
An example
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
- <project path="external/project" name="org/project" remote="github" revision="master" /&/gt;
+ <project path="external/project" name="org/project" remote="github" revision="master" />
</manifest>
From a2c89c200cbe2eb73ef41a6874f01e7bde42e119 Mon Sep 17 00:00:00 2001
From: Bjarke Freund-Hansen
Date: Mon, 19 Nov 2012 15:28:26 +0100
Subject: [PATCH 018/184] [maven-release-plugin] prepare release repo-1.3
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 8e6b6bb..63915ea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.2.2-SNAPSHOT
+ 1.3
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
From 6d042ec98e66c2aa57fcc276a55852051beb3f0c Mon Sep 17 00:00:00 2001
From: Bjarke Freund-Hansen
Date: Mon, 19 Nov 2012 15:28:34 +0100
Subject: [PATCH 019/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 63915ea..48026cd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.3
+ 1.4-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
From 0a31b156fc3f0f38653116a9e3f4ccfd808d77e4 Mon Sep 17 00:00:00 2001
From: Siva Velusamy
Date: Fri, 18 Jan 2013 08:19:25 -0800
Subject: [PATCH 020/184] Add support for repo group command (repo init -g)
---
.../java/hudson/plugins/repo/RepoScm.java | 20 ++++++++++++++++++-
.../hudson/plugins/repo/RepoScm/config.jelly | 4 ++++
src/main/webapp/help-manifestGroup.html | 7 +++++++
3 files changed, 30 insertions(+), 1 deletion(-)
create mode 100644 src/main/webapp/help-manifestGroup.html
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 49d8081..76ded88 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -70,6 +70,7 @@ public class RepoScm extends SCM {
// Advanced Fields:
private final String manifestBranch;
private final String manifestFile;
+ private final String manifestGroup;
private final String repoUrl;
private final String mirrorDir;
private final int jobs;
@@ -101,6 +102,14 @@ public String getManifestFile() {
return manifestFile;
}
+ /**
+ * Returns the group of projects to fetch. By default, this is null and
+ * repo will fetch the default group.
+ */
+ public String getManifestGroup() {
+ return manifestGroup;
+ }
+
/**
* Returns the name of the mirror directory. By default, this is null and
* repo does not use a mirror.
@@ -160,6 +169,10 @@ public boolean isQuiet() {
* @param manifestFile
* The file to use as the repository manifest. Typically this is
* null which will cause repo to use the default of "default.xml"
+ * @param manifestGroup
+ * The group name for the projects that need to be fetched.
+ * Typically, this is null and all projects tagged 'default' will
+ * be fetched.
* @param mirrorDir
* The path of the mirror directory to reference when
* initializing repo.
@@ -184,11 +197,12 @@ public boolean isQuiet() {
@DataBoundConstructor
public RepoScm(final String manifestRepositoryUrl,
final String manifestBranch, final String manifestFile,
- final String mirrorDir, final int jobs,
+ final String manifestGroup, final String mirrorDir, final int jobs,
final String localManifest, final String destinationDir,
final boolean currentBranch, final boolean quiet) {
this.manifestRepositoryUrl = manifestRepositoryUrl;
this.manifestBranch = Util.fixEmptyAndTrim(manifestBranch);
+ this.manifestGroup = Util.fixEmptyAndTrim(manifestGroup);
this.manifestFile = Util.fixEmptyAndTrim(manifestFile);
this.mirrorDir = Util.fixEmptyAndTrim(mirrorDir);
this.jobs = jobs;
@@ -341,6 +355,10 @@ private boolean checkoutCode(final Launcher launcher,
commands.add("--repo-url=" + repoUrl);
commands.add("--no-repo-verify");
}
+ if (manifestGroup != null) {
+ commands.add("-g");
+ commands.add(manifestGroup);
+ }
int returnCode =
launcher.launch().stdout(logger).pwd(workspace)
.cmds(commands).join();
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index 27ecc33..90e037a 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -20,6 +20,10 @@
+
+
+
+
diff --git a/src/main/webapp/help-manifestGroup.html b/src/main/webapp/help-manifestGroup.html
new file mode 100644
index 0000000..35d366e
--- /dev/null
+++ b/src/main/webapp/help-manifestGroup.html
@@ -0,0 +1,7 @@
+
+
+ Restricts manifest projects to ones tagged with provided group name. This is passed to repo as
+ repo init -g groupName. If a group name is not provided, the -g
+ option is not passed to repo and it will default to fetching projects that are tagged with 'default'.
+
+
From d187c09ac3a6a95ae96f660ba7409503e418d8df Mon Sep 17 00:00:00 2001
From: "Arvid E. Picciani"
Date: Tue, 23 Apr 2013 11:06:37 +0200
Subject: [PATCH 021/184] Switch pom.xml from hudson to jenkins
hudson is semi dead and doesn't build with jre7
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 48026cd..019c3e4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,9 +1,9 @@
4.0.0
- org.jvnet.hudson.plugins
+ org.jenkins-ci.plugins
plugin
- 1.350
+ 1.424
org.jenkins-ci.plugins
From 2d5502a236ea1d9aad51da37ef174583cfb7b87d Mon Sep 17 00:00:00 2001
From: "Arvid E. Picciani"
Date: Thu, 29 Nov 2012 21:25:51 +0100
Subject: [PATCH 022/184] implement ui for --repo-url
---
checkstyle.xml | 2 +-
src/main/java/hudson/plugins/repo/RepoScm.java | 14 ++++++++++++--
.../hudson/plugins/repo/RepoScm/config.jelly | 4 ++++
src/main/webapp/help-repoUrl.html | 6 ++++++
4 files changed, 23 insertions(+), 3 deletions(-)
create mode 100644 src/main/webapp/help-repoUrl.html
diff --git a/checkstyle.xml b/checkstyle.xml
index c0f2ece..7da48d6 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 76ded88..bf8e50b 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -110,6 +110,13 @@ public String getManifestGroup() {
return manifestGroup;
}
+ /**
+ * Returns the repo url. by default, this is null and
+ * repo is fetched from aosp
+ */
+ public String getRepoUrl() {
+ return repoUrl;
+ }
/**
* Returns the name of the mirror directory. By default, this is null and
* repo does not use a mirror.
@@ -187,6 +194,9 @@ public boolean isQuiet() {
* @param destinationDir
* If not null then the source is synced to the destinationDir
* subdirectory of the workspace.
+ * @param repoUrl
+ * If not null then use this url as repo base,
+ * instead of the default
* @param currentBranch
* if this value is true,
* add "-c" options when excute "repo sync".
@@ -199,6 +209,7 @@ public RepoScm(final String manifestRepositoryUrl,
final String manifestBranch, final String manifestFile,
final String manifestGroup, final String mirrorDir, final int jobs,
final String localManifest, final String destinationDir,
+ final String repoUrl,
final boolean currentBranch, final boolean quiet) {
this.manifestRepositoryUrl = manifestRepositoryUrl;
this.manifestBranch = Util.fixEmptyAndTrim(manifestBranch);
@@ -210,8 +221,7 @@ public RepoScm(final String manifestRepositoryUrl,
this.destinationDir = Util.fixEmptyAndTrim(destinationDir);
this.currentBranch = currentBranch;
this.quiet = quiet;
- // TODO: repoUrl
- this.repoUrl = null;
+ this.repoUrl = Util.fixEmptyAndTrim(repoUrl);
}
@Override
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index 90e037a..de327d1 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -28,6 +28,10 @@
+
+
+
+
diff --git a/src/main/webapp/help-repoUrl.html b/src/main/webapp/help-repoUrl.html
new file mode 100644
index 0000000..20c90c9
--- /dev/null
+++ b/src/main/webapp/help-repoUrl.html
@@ -0,0 +1,6 @@
+
+
+ Pull repo itself from this git repository. By default this is empty, and repo will be pulled
+ from its default git url (i.e. googles)
+
+
From 5d40971cbd307c4427d690afa43f0bd931757240 Mon Sep 17 00:00:00 2001
From: "Arvid E. Picciani"
Date: Tue, 23 Apr 2013 11:24:05 +0200
Subject: [PATCH 023/184] adding myself as maintainer
so people know who to poke
---
pom.xml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/pom.xml b/pom.xml
index 019c3e4..2e89d71 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,6 +23,16 @@
+
+ aep
+ Arvid E. Picciani
+ aep-jenkins@exys.org
+
+ developer
+ maintainer
+
+ +1
+
bjarkef
Bjarke Freund-Hansen
From 1d6eb763c61eebcf56d02a536c214cb346d978ab Mon Sep 17 00:00:00 2001
From: "Arvid E. Picciani"
Date: Tue, 23 Apr 2013 11:25:02 +0200
Subject: [PATCH 024/184] [maven-release-plugin] prepare release repo-1.4
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 2e89d71..d0466cc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.4-SNAPSHOT
+ 1.4
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
From fdf57f76eb5cb9bd351552f7bf85be3987427918 Mon Sep 17 00:00:00 2001
From: "Arvid E. Picciani"
Date: Tue, 23 Apr 2013 11:25:09 +0200
Subject: [PATCH 025/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index d0466cc..0606303 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.4
+ 1.5-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
From f41af34f824a690463e157a4d2c531fa63ce6cc8 Mon Sep 17 00:00:00 2001
From: "Arvid E. Picciani"
Date: Wed, 24 Apr 2013 12:28:39 +0200
Subject: [PATCH 026/184] [maven-release-plugin] prepare release repo-1.5
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 0606303..de74547 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.5-SNAPSHOT
+ 1.5
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
From 8e52f38771c3163ec67ae32a6d35364e720ef3a8 Mon Sep 17 00:00:00 2001
From: "Arvid E. Picciani"
Date: Wed, 24 Apr 2013 12:28:45 +0200
Subject: [PATCH 027/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index de74547..d706d10 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.5
+ 1.6-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
From d9a9fce579d2b658308f8dcc0e000b8f30911877 Mon Sep 17 00:00:00 2001
From: Rainer Burgstaller
Date: Fri, 9 Aug 2013 14:00:09 +0200
Subject: [PATCH 028/184] fixed major bug in branch comparison
the old code did a string comparison with == which is obviously wrong.
---
src/main/java/hudson/plugins/repo/RepoScm.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index bf8e50b..6581a3b 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -52,6 +52,7 @@
import net.sf.json.JSONObject;
+import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
@@ -431,7 +432,7 @@ private RevisionState getLastState(final Run, ?> lastBuild) {
}
final RevisionState lastState =
lastBuild.getAction(RevisionState.class);
- if (lastState != null && lastState.getBranch() == manifestBranch) {
+ if (lastState != null && StringUtils.equals(lastState.getBranch(), manifestBranch)) {
return lastState;
}
return getLastState(lastBuild.getPreviousBuild());
From 0d1699d010f797b7f9310931775e3299eed5167e Mon Sep 17 00:00:00 2001
From: Rainer Burgstaller
Date: Fri, 9 Aug 2013 14:03:39 +0200
Subject: [PATCH 029/184] fixed checkstyle
---
src/main/java/hudson/plugins/repo/RepoScm.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 6581a3b..eb6a7e2 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -432,7 +432,8 @@ private RevisionState getLastState(final Run, ?> lastBuild) {
}
final RevisionState lastState =
lastBuild.getAction(RevisionState.class);
- if (lastState != null && StringUtils.equals(lastState.getBranch(), manifestBranch)) {
+ if (lastState != null
+ && StringUtils.equals(lastState.getBranch(), manifestBranch)) {
return lastState;
}
return getLastState(lastBuild.getPreviousBuild());
From 4aeacc8728bf116b6c1b38fc5fbb0e0ef742a2cc Mon Sep 17 00:00:00 2001
From: "Arvid E. Picciani"
Date: Thu, 10 Oct 2013 20:38:42 +0200
Subject: [PATCH 030/184] take the manifest repo itself into account in
RevisionState
---
.../java/hudson/plugins/repo/ChangeLog.java | 62 +++++++++----------
.../java/hudson/plugins/repo/RepoScm.java | 28 +++++++--
.../hudson/plugins/repo/RevisionState.java | 15 ++++-
.../plugins/repo/TestRevisionState.java | 13 ++--
4 files changed, 76 insertions(+), 42 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/ChangeLog.java b/src/main/java/hudson/plugins/repo/ChangeLog.java
index 261094f..10e9056 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLog.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLog.java
@@ -142,8 +142,20 @@ public static List generateChangeLog(
commands.add("log");
commands.add("--raw");
commands.add("--first-parent");
- commands.add("--format=\"zzREPOzz%H%n%an<%ae>%aD"
- + "%n%cn<%ce>%cD%n%s%n%n%byyREPOyy\"");
+
+ final String format = "[[]]"
+ + "%H[[]"
+ + "%an[[]"
+ + "%ae[[]"
+ + "%aD[[]"
+ + "%cn[[]"
+ + "%ce[[]"
+ + "%cD[[]"
+ + "%s[[]"
+ + "%b[[]";
+
+
+ commands.add("--format=\"" + format + "\"");
// TODO: make this work with the -M flag to show copied and renamed
// files.
// TODO: even better, use jgit to do the diff. It would be faster,
@@ -154,39 +166,27 @@ public static List generateChangeLog(
final OutputStream gitOutput = new ByteArrayOutputStream();
launcher.launch().stdout(gitOutput).pwd(gitdir).cmds(commands)
.join();
- final String[] changelogs =
- gitOutput.toString().split("zzREPOzz");
+ final String o = gitOutput.toString();
+ final String[] changelogs = o.split(
+ "\\[\\[\\]\\]");
+ debug.log(Level.INFO, o);
for (final String changelog : changelogs) {
- if (changelog.length() < 10) {
- // This isn't a helpful message. Skip it.
+ final String[] parts = changelog.split(
+ "\\[\\[\\]");
+ if (parts.length < 9) {
+ // this is broken
continue;
}
- int endLine = changelog.indexOf('\n');
- final String revision = changelog.substring(0, endLine);
- int firstEmailPos = changelog.indexOf('<', endLine);
- final String authorName =
- changelog.substring(endLine + 1, firstEmailPos);
- int endEmail = changelog.indexOf('>', firstEmailPos);
- final String authorEmail =
- changelog.substring(firstEmailPos + 1, endEmail);
- endLine = changelog.indexOf('\n', endEmail);
- final String authorDate =
- changelog.substring(endEmail + 1, endLine);
- firstEmailPos = changelog.indexOf('<', endLine);
- final String committerName =
- changelog.substring(endLine + 1, firstEmailPos);
- endEmail = changelog.indexOf('>', firstEmailPos);
- final String committerEmail =
- changelog.substring(firstEmailPos + 1, endEmail);
- endLine = changelog.indexOf('\n', endEmail);
- final String committerDate =
- changelog.substring(endEmail + 1, endLine);
- final int endComment = changelog.indexOf("yyREPOyy", endLine);
- final String commitText =
- changelog.substring(endLine + 1, endComment);
+ final String revision = parts[0];
+ final String authorName = parts[1];
+ final String authorEmail = parts[2];
+ final String authorDate = parts[3];
+ final String committerName = parts[4];
+ final String committerEmail = parts[5];
+ final String committerDate = parts[6];
+ final String commitText = parts[7];
+ final String[] fileLines = parts[8].split("\n");
- final String[] fileLines =
- changelog.substring(endComment).split("\n");
final List modifiedFiles =
new ArrayList();
for (final String fileLine : fileLines) {
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index bf8e50b..dfbe8d3 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -267,10 +267,10 @@ protected PollingResult compareRemoteRevisionWith(
Change.INCOMPARABLE);
}
- final RevisionState currentState =
- new RevisionState(getStaticManifest(launcher, repoDir,
- listener.getLogger()), manifestBranch,
- listener.getLogger());
+ final RevisionState currentState = new RevisionState(
+ getStaticManifest(launcher, repoDir, listener.getLogger()),
+ getManifestRevision(launcher, repoDir, listener.getLogger()),
+ manifestBranch, listener.getLogger());
final Change change;
if (currentState.equals(myBaseline)) {
change = Change.NONE;
@@ -302,8 +302,10 @@ public boolean checkout(
}
final String manifest =
getStaticManifest(launcher, repoDir, listener.getLogger());
+ final String manifestRevision =
+ getManifestRevision(launcher, repoDir, listener.getLogger());
final RevisionState currentState =
- new RevisionState(manifest, manifestBranch,
+ new RevisionState(manifest, manifestRevision, manifestBranch,
listener.getLogger());
build.addAction(currentState);
final RevisionState previousState =
@@ -425,6 +427,22 @@ private String getStaticManifest(final Launcher launcher,
return manifestText;
}
+ private String getManifestRevision(final Launcher launcher,
+ final FilePath workspace, final OutputStream logger)
+ throws IOException, InterruptedException {
+ final ByteArrayOutputStream output = new ByteArrayOutputStream();
+ final List commands = new ArrayList(6);
+ commands.add("git");
+ commands.add("rev-parse");
+ commands.add("HEAD");
+ launcher.launch().stderr(logger).stdout(output).pwd(
+ new FilePath(workspace, ".repo/manifests"))
+ .cmds(commands).join();
+ final String manifestText = output.toString().trim();
+ debug.log(Level.FINEST, manifestText);
+ return manifestText;
+ }
+
private RevisionState getLastState(final Run, ?> lastBuild) {
if (lastBuild == null) {
return null;
diff --git a/src/main/java/hudson/plugins/repo/RevisionState.java b/src/main/java/hudson/plugins/repo/RevisionState.java
index 8b7b0e8..c96cb49 100644
--- a/src/main/java/hudson/plugins/repo/RevisionState.java
+++ b/src/main/java/hudson/plugins/repo/RevisionState.java
@@ -65,13 +65,15 @@ public class RevisionState extends SCMRevisionState implements Serializable {
*
* @param manifest
* A string representation of the static manifest XML file
+ * @param manifestRevision
+ * Git hash of the manifest repo
* @param branch
* The branch of the manifest project
* @param logger
* A PrintStream for logging errors
*/
- public RevisionState(final String manifest, final String branch,
- final PrintStream logger) {
+ public RevisionState(final String manifest, final String manifestRevision,
+ final String branch, final PrintStream logger) {
this.manifest = manifest;
this.branch = branch;
try {
@@ -112,6 +114,15 @@ public RevisionState(final String manifest, final String branch,
}
}
}
+
+ final String manifestP = ".repo/manifests.git";
+ projects.put(manifestP, ProjectState.constructCachedInstance(
+ manifestP, manifestP, manifestRevision));
+ if (logger != null) {
+ logger.println("Manifest at revision: " + manifestRevision);
+ }
+
+
} catch (final Exception e) {
logger.println(e);
return;
diff --git a/src/test/java/hudson/plugins/repo/TestRevisionState.java b/src/test/java/hudson/plugins/repo/TestRevisionState.java
index d08dbcd..fd5b072 100644
--- a/src/test/java/hudson/plugins/repo/TestRevisionState.java
+++ b/src/test/java/hudson/plugins/repo/TestRevisionState.java
@@ -40,6 +40,8 @@ public class TestRevisionState extends TestCase {
private RevisionState stateOneCopy;
private RevisionState stateTwo;
private RevisionState stateThree;
+ private RevisionState stateMChange;
+
private String manifestOne =
""
@@ -72,10 +74,12 @@ public class TestRevisionState extends TestCase {
protected void setUp() throws Exception {
super.setUp();
- stateOne = new RevisionState(manifestOne, "master", null);
- stateOneCopy = new RevisionState(manifestOne, "master", null);
- stateTwo = new RevisionState(manifestTwo, "master", null);
- stateThree = new RevisionState(manifestThree, "master", null);
+ stateOne = new RevisionState(manifestOne, "a", "master", null);
+ stateOneCopy = new RevisionState(manifestOne, "a", "master", null);
+ stateTwo = new RevisionState(manifestTwo, "a", "master", null);
+ stateThree = new RevisionState(manifestThree, "a", "master", null);
+
+ stateMChange = new RevisionState(manifestThree, "b", "master", null);
}
/**
@@ -85,6 +89,7 @@ public void testEquality() {
Assert.assertTrue(stateOne.equals(stateOneCopy));
Assert.assertFalse(stateOne.equals(stateTwo));
Assert.assertFalse(stateTwo.equals(stateThree));
+ Assert.assertFalse(stateThree.equals(stateMChange));
}
/**
From be31767e44cd9501a37de8557ce88dd3b840ce5d Mon Sep 17 00:00:00 2001
From: "Arvid E. Picciani"
Date: Fri, 11 Oct 2013 01:04:39 +0200
Subject: [PATCH 031/184] export our properties to the REST api
---
src/main/java/hudson/plugins/repo/RepoScm.java | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index dfbe8d3..7fb91e2 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -44,6 +44,7 @@
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
+import java.io.Serializable;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@@ -55,12 +56,16 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
+import org.kohsuke.stapler.export.ExportedBean;
+import org.kohsuke.stapler.export.Exported;
/**
* The main entrypoint of the plugin. This class contains code to store user
* configuration and to check out the code using a repo binary.
*/
-public class RepoScm extends SCM {
+
+@ExportedBean
+public class RepoScm extends SCM implements Serializable {
private static Logger debug = Logger
.getLogger("hudson.plugins.repo.RepoScm");
@@ -82,6 +87,7 @@ public class RepoScm extends SCM {
/**
* Returns the manifest repository URL.
*/
+ @Exported
public String getManifestRepositoryUrl() {
return manifestRepositoryUrl;
}
@@ -90,6 +96,7 @@ public String getManifestRepositoryUrl() {
* Returns the manifest branch name. By default, this is null and repo
* defaults to "master".
*/
+ @Exported
public String getManifestBranch() {
return manifestBranch;
}
@@ -98,6 +105,7 @@ public String getManifestBranch() {
* Returns the initial manifest file name. By default, this is null and repo
* defaults to "default.xml"
*/
+ @Exported
public String getManifestFile() {
return manifestFile;
}
@@ -106,6 +114,7 @@ public String getManifestFile() {
* Returns the group of projects to fetch. By default, this is null and
* repo will fetch the default group.
*/
+ @Exported
public String getManifestGroup() {
return manifestGroup;
}
@@ -114,6 +123,7 @@ public String getManifestGroup() {
* Returns the repo url. by default, this is null and
* repo is fetched from aosp
*/
+ @Exported
public String getRepoUrl() {
return repoUrl;
}
@@ -121,6 +131,7 @@ public String getRepoUrl() {
* Returns the name of the mirror directory. By default, this is null and
* repo does not use a mirror.
*/
+ @Exported
public String getMirrorDir() {
return mirrorDir;
}
@@ -129,6 +140,7 @@ public String getMirrorDir() {
* Returns the number of jobs used for sync. By default, this is null and
* repo does not use concurrent jobs.
*/
+ @Exported
public int getJobs() {
return jobs;
}
@@ -137,6 +149,7 @@ public int getJobs() {
* Returns the contents of the local_manifest.xml. By default, this is null
* and a local_manifest.xml is neither created nor modified.
*/
+ @Exported
public String getLocalManifest() {
return localManifest;
}
@@ -145,6 +158,7 @@ public String getLocalManifest() {
* Returns the destination directory. By default, this is null and the
* source is synced to the root of the workspace.
*/
+ @Exported
public String getDestinationDir() {
return destinationDir;
}
@@ -152,6 +166,7 @@ public String getDestinationDir() {
/**
* Returns the value of currentBranch.
*/
+ @Exported
public boolean isCurrentBranch() {
return currentBranch;
}
@@ -159,6 +174,7 @@ public boolean isCurrentBranch() {
/**
* Returns the value of quiet.
*/
+ @Exported
public boolean isQuiet() {
return quiet;
}
From 9fabbd896637d5c6847c47ac433c37cc88c58b6e Mon Sep 17 00:00:00 2001
From: "Arvid E. Picciani"
Date: Mon, 21 Oct 2013 11:58:10 +0200
Subject: [PATCH 032/184] modifiedFiles may be null
---
src/main/java/hudson/plugins/repo/ChangeLogEntry.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/main/java/hudson/plugins/repo/ChangeLogEntry.java b/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
index 1087047..324e9df 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
@@ -294,6 +294,9 @@ public void setParent(
@Override
public Collection getAffectedPaths() {
+ if (modifiedFiles == null) {
+ return null;
+ }
return new AbstractList() {
@Override
public String get(final int index) {
From 0e8f96f7e69ddd5c376371b3f40179bf5110a4e6 Mon Sep 17 00:00:00 2001
From: Rainer Burgstaller
Date: Thu, 8 Aug 2013 14:29:32 +0200
Subject: [PATCH 033/184] partial fix for JENKINS-17913 expand variables for
branch
JENKINS-17913 asked for being able to expand variables for certain
configuration properties I have added expansion for the specified branch
which allows users to choose a branch to checkout and pass it in as a
variable
---
.../java/hudson/plugins/repo/RepoScm.java | 89 +++++++++++--------
1 file changed, 53 insertions(+), 36 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index cf3f79d..3c8ce61 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -23,28 +23,7 @@
*/
package hudson.plugins.repo;
-import hudson.Extension;
-import hudson.FilePath;
-import hudson.Launcher;
-import hudson.Util;
-import hudson.model.BuildListener;
-import hudson.model.TaskListener;
-import hudson.model.AbstractBuild;
-import hudson.model.AbstractProject;
-import hudson.model.Run;
-import hudson.scm.ChangeLogParser;
-import hudson.scm.PollingResult;
-import hudson.scm.SCM;
-import hudson.scm.SCMDescriptor;
-import hudson.scm.SCMRevisionState;
-import hudson.scm.PollingResult.Change;
-import hudson.util.FormValidation;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Serializable;
+import java.io.*;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@@ -57,8 +36,14 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
-import org.kohsuke.stapler.export.ExportedBean;
import org.kohsuke.stapler.export.Exported;
+import org.kohsuke.stapler.export.ExportedBean;
+
+import hudson.*;
+import hudson.model.*;
+import hudson.scm.*;
+import hudson.scm.PollingResult.Change;
+import hudson.util.FormValidation;
/**
* The main entrypoint of the plugin. This class contains code to store user
@@ -102,6 +87,29 @@ public String getManifestBranch() {
return manifestBranch;
}
+ private String getManifestBranch(EnvVars env) {
+ return manifestBranch == null ? "master" : env.expand(manifestBranch);
+ }
+
+ /**
+ * Same as {@link #getManifestBranch()} but with default values of parameters expanded.
+ */
+ private String getManifestBranchExpanded(AbstractProject,?> project) {
+ final EnvVars env = new EnvVars();
+ final ParametersDefinitionProperty params = project.getProperty(ParametersDefinitionProperty.class);
+ if (params != null) {
+ for (ParameterDefinition param : params.getParameterDefinitions()) {
+ if (param instanceof StringParameterDefinition) {
+ String dflt = ((StringParameterDefinition) param).getDefaultValue();
+ if (dflt != null) {
+ env.put(param.getName(), dflt);
+ }
+ }
+ }
+ }
+ return getManifestBranch(env);
+ }
+
/**
* Returns the initial manifest file name. By default, this is null and repo
* defaults to "default.xml"
@@ -260,9 +268,12 @@ protected PollingResult compareRemoteRevisionWith(
final SCMRevisionState baseline) throws IOException,
InterruptedException {
SCMRevisionState myBaseline = baseline;
- if (myBaseline == null) {
+ final String expandedManifestBranch = getManifestBranchExpanded(project);
+ final AbstractBuild, ?> lastBuild = project.getLastBuild();
+
+ if (myBaseline == null) {
// Probably the first build, or possibly an aborted build.
- myBaseline = getLastState(project.getLastBuild());
+ myBaseline = getLastState(lastBuild, expandedManifestBranch);
if (myBaseline == null) {
return PollingResult.BUILD_NOW;
}
@@ -278,7 +289,8 @@ protected PollingResult compareRemoteRevisionWith(
repoDir = workspace;
}
- if (!checkoutCode(launcher, repoDir, listener.getLogger())) {
+ if (!checkoutCode(launcher, repoDir, expandedManifestBranch,
+ listener.getLogger())) {
// Some error occurred, try a build now so it gets logged.
return new PollingResult(myBaseline, myBaseline,
Change.INCOMPARABLE);
@@ -287,7 +299,7 @@ protected PollingResult compareRemoteRevisionWith(
final RevisionState currentState = new RevisionState(
getStaticManifest(launcher, repoDir, listener.getLogger()),
getManifestRevision(launcher, repoDir, listener.getLogger()),
- manifestBranch, listener.getLogger());
+ expandedManifestBranch, listener.getLogger());
final Change change;
if (currentState.equals(myBaseline)) {
change = Change.NONE;
@@ -314,7 +326,8 @@ public boolean checkout(
repoDir = workspace;
}
- if (!checkoutCode(launcher, repoDir, listener.getLogger())) {
+ final String expandedBranch = getManifestBranchExpanded(build.getProject());
+ if (!checkoutCode(launcher, repoDir, expandedBranch, listener.getLogger())) {
return false;
}
final String manifest =
@@ -322,11 +335,13 @@ public boolean checkout(
final String manifestRevision =
getManifestRevision(launcher, repoDir, listener.getLogger());
final RevisionState currentState =
- new RevisionState(manifest, manifestRevision, manifestBranch,
+ new RevisionState(manifest, manifestRevision, expandedBranch,
listener.getLogger());
build.addAction(currentState);
+
+ final Run previousBuild = build.getPreviousBuild();
final RevisionState previousState =
- getLastState(build.getPreviousBuild());
+ getLastState(previousBuild, expandedBranch);
ChangeLog.saveChangeLog(currentState, previousState, changelogFile,
launcher, repoDir);
@@ -359,7 +374,8 @@ private int doSync(final Launcher launcher, final FilePath workspace,
}
private boolean checkoutCode(final Launcher launcher,
- final FilePath workspace, final OutputStream logger)
+ final FilePath workspace, final String expandedManifestBranch,
+ final OutputStream logger)
throws IOException, InterruptedException {
final List commands = new ArrayList(4);
@@ -369,9 +385,9 @@ private boolean checkoutCode(final Launcher launcher,
commands.add("init");
commands.add("-u");
commands.add(manifestRepositoryUrl);
- if (manifestBranch != null) {
+ if (expandedManifestBranch != null) {
commands.add("-b");
- commands.add(manifestBranch);
+ commands.add(expandedManifestBranch);
}
if (manifestFile != null) {
commands.add("-m");
@@ -460,17 +476,18 @@ private String getManifestRevision(final Launcher launcher,
return manifestText;
}
- private RevisionState getLastState(final Run, ?> lastBuild) {
+ private RevisionState getLastState(final Run, ?> lastBuild,
+ final String expandedManifestBranch) {
if (lastBuild == null) {
return null;
}
final RevisionState lastState =
lastBuild.getAction(RevisionState.class);
if (lastState != null
- && StringUtils.equals(lastState.getBranch(), manifestBranch)) {
+ && StringUtils.equals(lastState.getBranch(), expandedManifestBranch)) {
return lastState;
}
- return getLastState(lastBuild.getPreviousBuild());
+ return getLastState(lastBuild.getPreviousBuild(), expandedManifestBranch);
}
@Override
From c2a966a11fcf98cc62bb34f005d67f017c102c32 Mon Sep 17 00:00:00 2001
From: Rainer Burgstaller
Date: Mon, 21 Oct 2013 14:04:24 +0200
Subject: [PATCH 034/184] fixed issue where selecting a branch for manual build
no longer worked
---
.../java/hudson/plugins/repo/RepoScm.java | 25 +++++++++++--------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 3c8ce61..b0bd26f 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -94,15 +94,17 @@ private String getManifestBranch(EnvVars env) {
/**
* Same as {@link #getManifestBranch()} but with default values of parameters expanded.
*/
- private String getManifestBranchExpanded(AbstractProject,?> project) {
- final EnvVars env = new EnvVars();
- final ParametersDefinitionProperty params = project.getProperty(ParametersDefinitionProperty.class);
- if (params != null) {
- for (ParameterDefinition param : params.getParameterDefinitions()) {
- if (param instanceof StringParameterDefinition) {
- String dflt = ((StringParameterDefinition) param).getDefaultValue();
- if (dflt != null) {
- env.put(param.getName(), dflt);
+ private String getManifestBranchExpanded(EnvVars env, AbstractProject, ?> project) {
+ if (env == null) {
+ env = new EnvVars();
+ final ParametersDefinitionProperty params = project.getProperty(ParametersDefinitionProperty.class);
+ if (params != null) {
+ for (ParameterDefinition param : params.getParameterDefinitions()) {
+ if (param instanceof StringParameterDefinition) {
+ String dflt = ((StringParameterDefinition) param).getDefaultValue();
+ if (dflt != null) {
+ env.put(param.getName(), dflt);
+ }
}
}
}
@@ -268,7 +270,7 @@ protected PollingResult compareRemoteRevisionWith(
final SCMRevisionState baseline) throws IOException,
InterruptedException {
SCMRevisionState myBaseline = baseline;
- final String expandedManifestBranch = getManifestBranchExpanded(project);
+ final String expandedManifestBranch = getManifestBranchExpanded(null, project);
final AbstractBuild, ?> lastBuild = project.getLastBuild();
if (myBaseline == null) {
@@ -326,7 +328,8 @@ public boolean checkout(
repoDir = workspace;
}
- final String expandedBranch = getManifestBranchExpanded(build.getProject());
+ EnvVars env = build.getEnvironment(listener);
+ final String expandedBranch = getManifestBranchExpanded(env, build.getProject());
if (!checkoutCode(launcher, repoDir, expandedBranch, listener.getLogger())) {
return false;
}
From 31f99293e70c08937a64506e5fffe338fd5c61be Mon Sep 17 00:00:00 2001
From: Rainer Burgstaller
Date: Mon, 21 Oct 2013 14:38:13 +0200
Subject: [PATCH 035/184] fixed check style issues
---
.../java/hudson/plugins/repo/RepoScm.java | 60 ++++++++++++++-----
1 file changed, 45 insertions(+), 15 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index b0bd26f..aac0f8b 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -23,13 +23,35 @@
*/
package hudson.plugins.repo;
-import java.io.*;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Serializable;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
+import hudson.EnvVars;
+import hudson.Extension;
+import hudson.FilePath;
+import hudson.Launcher;
+import hudson.Util;
+import hudson.model.AbstractBuild;
+import hudson.model.AbstractProject;
+import hudson.model.BuildListener;
+import hudson.model.ParameterDefinition;
+import hudson.model.ParametersDefinitionProperty;
+import hudson.model.Run;
+import hudson.model.StringParameterDefinition;
+import hudson.model.TaskListener;
+import hudson.scm.ChangeLogParser;
+import hudson.scm.PollingResult;
+import hudson.scm.SCM;
+import hudson.scm.SCMDescriptor;
+import hudson.scm.SCMRevisionState;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
@@ -39,9 +61,6 @@
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;
-import hudson.*;
-import hudson.model.*;
-import hudson.scm.*;
import hudson.scm.PollingResult.Change;
import hudson.util.FormValidation;
@@ -87,21 +106,27 @@ public String getManifestBranch() {
return manifestBranch;
}
- private String getManifestBranch(EnvVars env) {
+ private String getManifestBranch(final EnvVars env) {
return manifestBranch == null ? "master" : env.expand(manifestBranch);
}
/**
- * Same as {@link #getManifestBranch()} but with default values of parameters expanded.
+ * Same as {@link #getManifestBranch()} but with default
+ * values of parameters expanded.
*/
- private String getManifestBranchExpanded(EnvVars env, AbstractProject, ?> project) {
+ private String getManifestBranchExpanded(final EnvVars environment,
+ final AbstractProject, ?> project) {
+ EnvVars env = environment;
if (env == null) {
env = new EnvVars();
- final ParametersDefinitionProperty params = project.getProperty(ParametersDefinitionProperty.class);
+ final ParametersDefinitionProperty params = project.getProperty(
+ ParametersDefinitionProperty.class);
if (params != null) {
- for (ParameterDefinition param : params.getParameterDefinitions()) {
+ for (ParameterDefinition param
+ : params.getParameterDefinitions()) {
if (param instanceof StringParameterDefinition) {
- String dflt = ((StringParameterDefinition) param).getDefaultValue();
+ final String dflt =
+ ((StringParameterDefinition) param).getDefaultValue();
if (dflt != null) {
env.put(param.getName(), dflt);
}
@@ -270,7 +295,8 @@ protected PollingResult compareRemoteRevisionWith(
final SCMRevisionState baseline) throws IOException,
InterruptedException {
SCMRevisionState myBaseline = baseline;
- final String expandedManifestBranch = getManifestBranchExpanded(null, project);
+ final String expandedManifestBranch =
+ getManifestBranchExpanded(null, project);
final AbstractBuild, ?> lastBuild = project.getLastBuild();
if (myBaseline == null) {
@@ -329,8 +355,10 @@ public boolean checkout(
}
EnvVars env = build.getEnvironment(listener);
- final String expandedBranch = getManifestBranchExpanded(env, build.getProject());
- if (!checkoutCode(launcher, repoDir, expandedBranch, listener.getLogger())) {
+ final String expandedBranch = getManifestBranchExpanded(
+ env, build.getProject());
+ if (!checkoutCode(launcher, repoDir, expandedBranch,
+ listener.getLogger())) {
return false;
}
final String manifest =
@@ -487,10 +515,12 @@ private RevisionState getLastState(final Run, ?> lastBuild,
final RevisionState lastState =
lastBuild.getAction(RevisionState.class);
if (lastState != null
- && StringUtils.equals(lastState.getBranch(), expandedManifestBranch)) {
+ && StringUtils.equals(lastState.getBranch(),
+ expandedManifestBranch)) {
return lastState;
}
- return getLastState(lastBuild.getPreviousBuild(), expandedManifestBranch);
+ return getLastState(lastBuild.getPreviousBuild(),
+ expandedManifestBranch);
}
@Override
From 1dee753c3ff6af971b0504baa600da051505cbbb Mon Sep 17 00:00:00 2001
From: Rainer Burgstaller
Date: Tue, 29 Oct 2013 21:59:47 +0100
Subject: [PATCH 036/184] improved parameter merging
- now build parameters for the current build will override
defaults from the project configuration
---
.../java/hudson/plugins/repo/RepoScm.java | 137 +++++++++---------
1 file changed, 72 insertions(+), 65 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index aac0f8b..17c715f 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -92,7 +92,7 @@ public class RepoScm extends SCM implements Serializable {
/**
* Returns the manifest repository URL.
*/
- @Exported
+ @Exported
public String getManifestRepositoryUrl() {
return manifestRepositoryUrl;
}
@@ -101,65 +101,72 @@ public String getManifestRepositoryUrl() {
* Returns the manifest branch name. By default, this is null and repo
* defaults to "master".
*/
- @Exported
+ @Exported
public String getManifestBranch() {
return manifestBranch;
}
- private String getManifestBranch(final EnvVars env) {
- return manifestBranch == null ? "master" : env.expand(manifestBranch);
- }
-
- /**
- * Same as {@link #getManifestBranch()} but with default
- * values of parameters expanded.
- */
- private String getManifestBranchExpanded(final EnvVars environment,
- final AbstractProject, ?> project) {
- EnvVars env = environment;
- if (env == null) {
- env = new EnvVars();
- final ParametersDefinitionProperty params = project.getProperty(
- ParametersDefinitionProperty.class);
- if (params != null) {
- for (ParameterDefinition param
- : params.getParameterDefinitions()) {
- if (param instanceof StringParameterDefinition) {
- final String dflt =
- ((StringParameterDefinition) param).getDefaultValue();
- if (dflt != null) {
- env.put(param.getName(), dflt);
- }
- }
- }
- }
- }
- return getManifestBranch(env);
- }
+ private String getManifestBranch(final EnvVars env) {
+ return manifestBranch == null ? null : env.expand(manifestBranch);
+ }
+
+ /**
+ * Same as {@link #getManifestBranch()} but with default
+ * values of parameters expanded.
+ * @param environment an existing environment, which contains already properties from the current build
+ * @param project the project that is being built
+ */
+ private String getManifestBranchExpanded(final EnvVars environment,
+ final AbstractProject, ?> project) {
+ // create an empty vars map
+ final EnvVars finalEnv = new EnvVars();
+ final ParametersDefinitionProperty params = project.getProperty(
+ ParametersDefinitionProperty.class);
+ if (params != null) {
+ for (ParameterDefinition param
+ : params.getParameterDefinitions()) {
+ if (param instanceof StringParameterDefinition) {
+ final String dflt =
+ ((StringParameterDefinition) param).getDefaultValue();
+ if (dflt != null) {
+ finalEnv.put(param.getName(), dflt);
+ }
+ }
+ }
+ }
+ // now merge the settings from the last build environment
+ if (environment != null) {
+ finalEnv.overrideAll(environment);
+ }
+
+ EnvVars.resolve(finalEnv);
+
+ return getManifestBranch(finalEnv);
+ }
/**
* Returns the initial manifest file name. By default, this is null and repo
* defaults to "default.xml"
*/
- @Exported
+ @Exported
public String getManifestFile() {
return manifestFile;
}
- /**
- * Returns the group of projects to fetch. By default, this is null and
- * repo will fetch the default group.
- */
- @Exported
- public String getManifestGroup() {
+ /**
+ * Returns the group of projects to fetch. By default, this is null and
+ * repo will fetch the default group.
+ */
+ @Exported
+ public String getManifestGroup() {
return manifestGroup;
- }
+ }
/**
* Returns the repo url. by default, this is null and
* repo is fetched from aosp
*/
- @Exported
+ @Exported
public String getRepoUrl() {
return repoUrl;
}
@@ -167,7 +174,7 @@ public String getRepoUrl() {
* Returns the name of the mirror directory. By default, this is null and
* repo does not use a mirror.
*/
- @Exported
+ @Exported
public String getMirrorDir() {
return mirrorDir;
}
@@ -176,7 +183,7 @@ public String getMirrorDir() {
* Returns the number of jobs used for sync. By default, this is null and
* repo does not use concurrent jobs.
*/
- @Exported
+ @Exported
public int getJobs() {
return jobs;
}
@@ -185,7 +192,7 @@ public int getJobs() {
* Returns the contents of the local_manifest.xml. By default, this is null
* and a local_manifest.xml is neither created nor modified.
*/
- @Exported
+ @Exported
public String getLocalManifest() {
return localManifest;
}
@@ -194,7 +201,7 @@ public String getLocalManifest() {
* Returns the destination directory. By default, this is null and the
* source is synced to the root of the workspace.
*/
- @Exported
+ @Exported
public String getDestinationDir() {
return destinationDir;
}
@@ -202,7 +209,7 @@ public String getDestinationDir() {
/**
* Returns the value of currentBranch.
*/
- @Exported
+ @Exported
public boolean isCurrentBranch() {
return currentBranch;
}
@@ -210,7 +217,7 @@ public boolean isCurrentBranch() {
/**
* Returns the value of quiet.
*/
- @Exported
+ @Exported
public boolean isQuiet() {
return quiet;
}
@@ -228,10 +235,10 @@ public boolean isQuiet() {
* @param manifestFile
* The file to use as the repository manifest. Typically this is
* null which will cause repo to use the default of "default.xml"
- * @param manifestGroup
- * The group name for the projects that need to be fetched.
- * Typically, this is null and all projects tagged 'default' will
- * be fetched.
+ * @param manifestGroup
+ * The group name for the projects that need to be fetched.
+ * Typically, this is null and all projects tagged 'default' will
+ * be fetched.
* @param mirrorDir
* The path of the mirror directory to reference when
* initializing repo.
@@ -248,7 +255,7 @@ public boolean isQuiet() {
* subdirectory of the workspace.
* @param repoUrl
* If not null then use this url as repo base,
- * instead of the default
+ * instead of the default
* @param currentBranch
* if this value is true,
* add "-c" options when excute "repo sync".
@@ -261,7 +268,7 @@ public RepoScm(final String manifestRepositoryUrl,
final String manifestBranch, final String manifestFile,
final String manifestGroup, final String mirrorDir, final int jobs,
final String localManifest, final String destinationDir,
- final String repoUrl,
+ final String repoUrl,
final boolean currentBranch, final boolean quiet) {
this.manifestRepositoryUrl = manifestRepositoryUrl;
this.manifestBranch = Util.fixEmptyAndTrim(manifestBranch);
@@ -297,9 +304,9 @@ protected PollingResult compareRemoteRevisionWith(
SCMRevisionState myBaseline = baseline;
final String expandedManifestBranch =
getManifestBranchExpanded(null, project);
- final AbstractBuild, ?> lastBuild = project.getLastBuild();
+ final AbstractBuild, ?> lastBuild = project.getLastBuild();
- if (myBaseline == null) {
+ if (myBaseline == null) {
// Probably the first build, or possibly an aborted build.
myBaseline = getLastState(lastBuild, expandedManifestBranch);
if (myBaseline == null) {
@@ -324,10 +331,10 @@ protected PollingResult compareRemoteRevisionWith(
Change.INCOMPARABLE);
}
- final RevisionState currentState = new RevisionState(
- getStaticManifest(launcher, repoDir, listener.getLogger()),
- getManifestRevision(launcher, repoDir, listener.getLogger()),
- expandedManifestBranch, listener.getLogger());
+ final RevisionState currentState = new RevisionState(
+ getStaticManifest(launcher, repoDir, listener.getLogger()),
+ getManifestRevision(launcher, repoDir, listener.getLogger()),
+ expandedManifestBranch, listener.getLogger());
final Change change;
if (currentState.equals(myBaseline)) {
change = Change.NONE;
@@ -354,9 +361,9 @@ public boolean checkout(
repoDir = workspace;
}
- EnvVars env = build.getEnvironment(listener);
- final String expandedBranch = getManifestBranchExpanded(
- env, build.getProject());
+ EnvVars env = build.getEnvironment(listener);
+ final String expandedBranch = getManifestBranchExpanded(
+ env, build.getProject());
if (!checkoutCode(launcher, repoDir, expandedBranch,
listener.getLogger())) {
return false;
@@ -370,7 +377,7 @@ public boolean checkout(
listener.getLogger());
build.addAction(currentState);
- final Run previousBuild = build.getPreviousBuild();
+ final Run previousBuild = build.getPreviousBuild();
final RevisionState previousState =
getLastState(previousBuild, expandedBranch);
@@ -500,7 +507,7 @@ private String getManifestRevision(final Launcher launcher,
commands.add("rev-parse");
commands.add("HEAD");
launcher.launch().stderr(logger).stdout(output).pwd(
- new FilePath(workspace, ".repo/manifests"))
+ new FilePath(workspace, ".repo/manifests"))
.cmds(commands).join();
final String manifestText = output.toString().trim();
debug.log(Level.FINEST, manifestText);
@@ -534,7 +541,7 @@ public DescriptorImpl getDescriptor() {
}
/**
- * A DescriptorImpl contains variables used server-wide. In our case, we
+ * A DescriptorImpl contains variables used server-wide. In our263 case, we
* only store the path to the repo executable, which defaults to just
* "repo". This class also handles some Jenkins housekeeping.
*/
From 4bb781d80d124b8af7400b4c471c73fb3027e1fe Mon Sep 17 00:00:00 2001
From: "Arvid E. Picciani"
Date: Mon, 21 Oct 2013 13:06:00 +0200
Subject: [PATCH 037/184] log: body and subject should be in one field
---
src/main/java/hudson/plugins/repo/ChangeLog.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/ChangeLog.java b/src/main/java/hudson/plugins/repo/ChangeLog.java
index 10e9056..c0bfaf6 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLog.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLog.java
@@ -151,8 +151,7 @@ public static List generateChangeLog(
+ "%cn[[]"
+ "%ce[[]"
+ "%cD[[]"
- + "%s[[]"
- + "%b[[]";
+ + "%s\n%b[[]";
commands.add("--format=\"" + format + "\"");
From 42bc86d48dbfdbebce238262cc2e1999e3947fab Mon Sep 17 00:00:00 2001
From: "Arvid E. Picciani"
Date: Wed, 6 Nov 2013 18:37:17 +0100
Subject: [PATCH 038/184] fix checkstyle issues from #19
---
src/main/java/hudson/plugins/repo/RepoScm.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 17c715f..de35507 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -113,7 +113,8 @@ private String getManifestBranch(final EnvVars env) {
/**
* Same as {@link #getManifestBranch()} but with default
* values of parameters expanded.
- * @param environment an existing environment, which contains already properties from the current build
+ * @param environment an existing environment, which contains already
+ * properties from the current build
* @param project the project that is being built
*/
private String getManifestBranchExpanded(final EnvVars environment,
@@ -126,8 +127,9 @@ private String getManifestBranchExpanded(final EnvVars environment,
for (ParameterDefinition param
: params.getParameterDefinitions()) {
if (param instanceof StringParameterDefinition) {
- final String dflt =
- ((StringParameterDefinition) param).getDefaultValue();
+ final StringParameterDefinition stpd =
+ (StringParameterDefinition) param;
+ final String dflt = stpd.getDefaultValue();
if (dflt != null) {
finalEnv.put(param.getName(), dflt);
}
From 4332a1a34a9f32d7260db942acaac8234a9805e8 Mon Sep 17 00:00:00 2001
From: "Arvid E. Picciani"
Date: Tue, 19 Nov 2013 22:55:14 +0100
Subject: [PATCH 039/184] [maven-release-plugin] prepare release repo-1.6
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index d706d10..c213d83 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.6-SNAPSHOT
+ 1.6
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
From 51937d5c69de69d812413cf45842773c4656a8d7 Mon Sep 17 00:00:00 2001
From: "Arvid E. Picciani"
Date: Tue, 19 Nov 2013 22:55:18 +0100
Subject: [PATCH 040/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index c213d83..c204bb9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.6
+ 1.7-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
From c158d5659ede22d8894eb0f1d36335cbbfae9270 Mon Sep 17 00:00:00 2001
From: David
Date: Tue, 5 Aug 2014 11:00:51 -0400
Subject: [PATCH 041/184] Support for a depth parameter in the repo plugin
---
src/main/java/hudson/plugins/repo/RepoScm.java | 17 +++++++++++++++++
.../hudson/plugins/repo/RepoScm/config.jelly | 4 ++++
src/main/webapp/help-depth.html | 7 +++++++
3 files changed, 28 insertions(+)
create mode 100644 src/main/webapp/help-depth.html
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index de35507..5dfe892 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -84,6 +84,7 @@ public class RepoScm extends SCM implements Serializable {
private final String repoUrl;
private final String mirrorDir;
private final int jobs;
+ private final int depth;
private final String localManifest;
private final String destinationDir;
private final boolean currentBranch;
@@ -190,6 +191,14 @@ public int getJobs() {
return jobs;
}
+ /**
+ * Returns the depth used for sync. By default, this is null and repo
+ * will sync the entire history.
+ */
+ @Exported
+ public int getDepth() {
+ return depth;
+ }
/**
* Returns the contents of the local_manifest.xml. By default, this is null
* and a local_manifest.xml is neither created nor modified.
@@ -247,6 +256,9 @@ public boolean isQuiet() {
* @param jobs
* The number of concurrent jobs to use for the sync command. If
* this is 0 or negative the jobs parameter is not specified.
+ * @param depth
+ * This is the depth to use when syncing. By default this is 0
+ * and the full history is synced.
* @param localManifest
* May be null, a string containing XML, or an URL.
* If XML, this string is written to .repo/local_manifest.xml
@@ -269,6 +281,7 @@ public boolean isQuiet() {
public RepoScm(final String manifestRepositoryUrl,
final String manifestBranch, final String manifestFile,
final String manifestGroup, final String mirrorDir, final int jobs,
+ final int depth,
final String localManifest, final String destinationDir,
final String repoUrl,
final boolean currentBranch, final boolean quiet) {
@@ -278,6 +291,7 @@ public RepoScm(final String manifestRepositoryUrl,
this.manifestFile = Util.fixEmptyAndTrim(manifestFile);
this.mirrorDir = Util.fixEmptyAndTrim(mirrorDir);
this.jobs = jobs;
+ this.depth = depth;
this.localManifest = Util.fixEmptyAndTrim(localManifest);
this.destinationDir = Util.fixEmptyAndTrim(destinationDir);
this.currentBranch = currentBranch;
@@ -444,6 +458,9 @@ private boolean checkoutCode(final Launcher launcher,
commands.add("-g");
commands.add(manifestGroup);
}
+ if (depth != 0) {
+ commands.add("--depth=" + depth);
+ }
int returnCode =
launcher.launch().stdout(logger).pwd(workspace)
.cmds(commands).join();
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index de327d1..182bfd1 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -40,6 +40,10 @@
+
+
+
+
diff --git a/src/main/webapp/help-depth.html b/src/main/webapp/help-depth.html
new file mode 100644
index 0000000..1fed342
--- /dev/null
+++ b/src/main/webapp/help-depth.html
@@ -0,0 +1,7 @@
+
+
+ Specify the depth in history to sync from the source. The default is to sync all of the history.
+ Use 1 to just sync the most recent commit.
+ This is passed to repo as repo init --depth=n.
+
+
From 4888a6ef1dd7aa730c568c043c16e7e7d47e1e91 Mon Sep 17 00:00:00 2001
From: David
Date: Mon, 11 Aug 2014 10:44:06 -0400
Subject: [PATCH 042/184] option to reset first
---
checkstyle.xml | 2 +-
.../java/hudson/plugins/repo/RepoScm.java | 24 +++++++++++++++++--
.../hudson/plugins/repo/RepoScm/config.jelly | 4 ++++
src/main/webapp/help-resetFirst.html | 5 ++++
4 files changed, 32 insertions(+), 3 deletions(-)
create mode 100644 src/main/webapp/help-resetFirst.html
diff --git a/checkstyle.xml b/checkstyle.xml
index 7da48d6..5285edb 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 5dfe892..8257778 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -88,6 +88,7 @@ public class RepoScm extends SCM implements Serializable {
private final String localManifest;
private final String destinationDir;
private final boolean currentBranch;
+ private final boolean resetFirst;
private final boolean quiet;
/**
@@ -224,7 +225,11 @@ public String getDestinationDir() {
public boolean isCurrentBranch() {
return currentBranch;
}
-
+ /**
+ * Returns the value of resetFirst.
+ */
+ @Exported
+ public boolean resetFirst() { return resetFirst; }
/**
* Returns the value of quiet.
*/
@@ -273,6 +278,9 @@ public boolean isQuiet() {
* @param currentBranch
* if this value is true,
* add "-c" options when excute "repo sync".
+ * @param resetFirst
+ * if this value is true, do
+ * "repo forall -c 'git reset --hard'" first.
* @param quiet
* if this value is true,
* add "-q" options when excute "repo sync".
@@ -284,7 +292,9 @@ public RepoScm(final String manifestRepositoryUrl,
final int depth,
final String localManifest, final String destinationDir,
final String repoUrl,
- final boolean currentBranch, final boolean quiet) {
+ final boolean currentBranch,
+ final boolean resetFirst,
+ final boolean quiet) {
this.manifestRepositoryUrl = manifestRepositoryUrl;
this.manifestBranch = Util.fixEmptyAndTrim(manifestBranch);
this.manifestGroup = Util.fixEmptyAndTrim(manifestGroup);
@@ -295,6 +305,7 @@ public RepoScm(final String manifestRepositoryUrl,
this.localManifest = Util.fixEmptyAndTrim(localManifest);
this.destinationDir = Util.fixEmptyAndTrim(destinationDir);
this.currentBranch = currentBranch;
+ this.resetFirst = resetFirst;
this.quiet = quiet;
this.repoUrl = Util.fixEmptyAndTrim(repoUrl);
}
@@ -409,6 +420,15 @@ private int doSync(final Launcher launcher, final FilePath workspace,
final List commands = new ArrayList(4);
debug.log(Level.FINE, "Syncing out code in: " + workspace.getName());
commands.clear();
+ if (resetFirst) {
+ commands.add(getDescriptor().getExecutable());
+ commands.add("forall");
+ commands.add("-c");
+ commands.add("git reset --hard");
+ int syncCode = launcher.launch().stdout(logger).pwd(workspace)
+ .cmds(commands).join();
+ commands.clear();
+ }
commands.add(getDescriptor().getExecutable());
commands.add("sync");
commands.add("-d");
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index 182bfd1..9c4e452 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -48,6 +48,10 @@
+
+
+
+
+ When this is checked the first thing to do will be a
repo forall -c "git reset --hard"
+
+
From 15b9c85527c7e53bdb0cb0bb637b17ffc283abad Mon Sep 17 00:00:00 2001
From: David Warburton
Date: Mon, 29 Sep 2014 12:14:01 -0400
Subject: [PATCH 043/184] Acknowledge failures of repo resetFirst option
---
.../java/hudson/plugins/repo/RepoScm.java | 52 ++++++++++---------
1 file changed, 28 insertions(+), 24 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 8257778..a81d363 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -88,7 +88,7 @@ public class RepoScm extends SCM implements Serializable {
private final String localManifest;
private final String destinationDir;
private final boolean currentBranch;
- private final boolean resetFirst;
+ private final boolean resetFirst;
private final boolean quiet;
/**
@@ -116,7 +116,7 @@ private String getManifestBranch(final EnvVars env) {
* Same as {@link #getManifestBranch()} but with default
* values of parameters expanded.
* @param environment an existing environment, which contains already
- * properties from the current build
+ * properties from the current build
* @param project the project that is being built
*/
private String getManifestBranchExpanded(final EnvVars environment,
@@ -129,8 +129,8 @@ private String getManifestBranchExpanded(final EnvVars environment,
for (ParameterDefinition param
: params.getParameterDefinitions()) {
if (param instanceof StringParameterDefinition) {
- final StringParameterDefinition stpd =
- (StringParameterDefinition) param;
+ final StringParameterDefinition stpd =
+ (StringParameterDefinition) param;
final String dflt = stpd.getDefaultValue();
if (dflt != null) {
finalEnv.put(param.getName(), dflt);
@@ -225,11 +225,11 @@ public String getDestinationDir() {
public boolean isCurrentBranch() {
return currentBranch;
}
- /**
- * Returns the value of resetFirst.
- */
- @Exported
- public boolean resetFirst() { return resetFirst; }
+ /**
+ * Returns the value of resetFirst.
+ */
+ @Exported
+ public boolean resetFirst() { return resetFirst; }
/**
* Returns the value of quiet.
*/
@@ -278,9 +278,9 @@ public boolean isQuiet() {
* @param currentBranch
* if this value is true,
* add "-c" options when excute "repo sync".
- * @param resetFirst
- * if this value is true, do
- * "repo forall -c 'git reset --hard'" first.
+ * @param resetFirst
+ * if this value is true, do
+ * "repo forall -c 'git reset --hard'" first.
* @param quiet
* if this value is true,
* add "-q" options when excute "repo sync".
@@ -293,8 +293,8 @@ public RepoScm(final String manifestRepositoryUrl,
final String localManifest, final String destinationDir,
final String repoUrl,
final boolean currentBranch,
- final boolean resetFirst,
- final boolean quiet) {
+ final boolean resetFirst,
+ final boolean quiet) {
this.manifestRepositoryUrl = manifestRepositoryUrl;
this.manifestBranch = Util.fixEmptyAndTrim(manifestBranch);
this.manifestGroup = Util.fixEmptyAndTrim(manifestGroup);
@@ -305,7 +305,7 @@ public RepoScm(final String manifestRepositoryUrl,
this.localManifest = Util.fixEmptyAndTrim(localManifest);
this.destinationDir = Util.fixEmptyAndTrim(destinationDir);
this.currentBranch = currentBranch;
- this.resetFirst = resetFirst;
+ this.resetFirst = resetFirst;
this.quiet = quiet;
this.repoUrl = Util.fixEmptyAndTrim(repoUrl);
}
@@ -420,15 +420,19 @@ private int doSync(final Launcher launcher, final FilePath workspace,
final List commands = new ArrayList(4);
debug.log(Level.FINE, "Syncing out code in: " + workspace.getName());
commands.clear();
- if (resetFirst) {
- commands.add(getDescriptor().getExecutable());
- commands.add("forall");
- commands.add("-c");
- commands.add("git reset --hard");
- int syncCode = launcher.launch().stdout(logger).pwd(workspace)
- .cmds(commands).join();
- commands.clear();
- }
+ if (resetFirst) {
+ commands.add(getDescriptor().getExecutable());
+ commands.add("forall");
+ commands.add("-c");
+ commands.add("git reset --hard");
+ int syncCode = launcher.launch().stdout(logger)
+ .stderr(logger).pwd(workspace).cmds(commands).join();
+
+ if (syncCode != 0) {
+ debug.log(Level.WARNING, "Failed to reset first.");
+ }
+ commands.clear();
+ }
commands.add(getDescriptor().getExecutable());
commands.add("sync");
commands.add("-d");
From fc2c8d1ec64707cbfe4cf2e3aa9a872679ab3d7c Mon Sep 17 00:00:00 2001
From: Scott Anderson
Date: Fri, 24 Oct 2014 16:20:41 -0400
Subject: [PATCH 044/184] [FIXED JENKINS-17913] Expand variables
---
.../java/hudson/plugins/repo/RepoScm.java | 42 +++++++++----------
1 file changed, 19 insertions(+), 23 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index a81d363..0e84caa 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -108,10 +108,6 @@ public String getManifestBranch() {
return manifestBranch;
}
- private String getManifestBranch(final EnvVars env) {
- return manifestBranch == null ? null : env.expand(manifestBranch);
- }
-
/**
* Same as {@link #getManifestBranch()} but with default
* values of parameters expanded.
@@ -119,7 +115,7 @@ private String getManifestBranch(final EnvVars env) {
* properties from the current build
* @param project the project that is being built
*/
- private String getManifestBranchExpanded(final EnvVars environment,
+ private EnvVars getEnvVars(final EnvVars environment,
final AbstractProject, ?> project) {
// create an empty vars map
final EnvVars finalEnv = new EnvVars();
@@ -144,8 +140,7 @@ private String getManifestBranchExpanded(final EnvVars environment,
}
EnvVars.resolve(finalEnv);
-
- return getManifestBranch(finalEnv);
+ return finalEnv;
}
/**
@@ -174,6 +169,7 @@ public String getManifestGroup() {
public String getRepoUrl() {
return repoUrl;
}
+
/**
* Returns the name of the mirror directory. By default, this is null and
* repo does not use a mirror.
@@ -329,8 +325,8 @@ protected PollingResult compareRemoteRevisionWith(
final SCMRevisionState baseline) throws IOException,
InterruptedException {
SCMRevisionState myBaseline = baseline;
- final String expandedManifestBranch =
- getManifestBranchExpanded(null, project);
+ final EnvVars env = getEnvVars(null, project);
+ final String expandedManifestBranch = env.expand(manifestBranch);
final AbstractBuild, ?> lastBuild = project.getLastBuild();
if (myBaseline == null) {
@@ -351,8 +347,7 @@ protected PollingResult compareRemoteRevisionWith(
repoDir = workspace;
}
- if (!checkoutCode(launcher, repoDir, expandedManifestBranch,
- listener.getLogger())) {
+ if (!checkoutCode(launcher, repoDir, env, listener.getLogger())) {
// Some error occurred, try a build now so it gets logged.
return new PollingResult(myBaseline, myBaseline,
Change.INCOMPARABLE);
@@ -388,17 +383,17 @@ public boolean checkout(
repoDir = workspace;
}
+ AbstractProject, ?> proj = build.getProject();
EnvVars env = build.getEnvironment(listener);
- final String expandedBranch = getManifestBranchExpanded(
- env, build.getProject());
- if (!checkoutCode(launcher, repoDir, expandedBranch,
- listener.getLogger())) {
+ env = getEnvVars(env, proj);
+ if (!checkoutCode(launcher, repoDir, env, listener.getLogger())) {
return false;
}
final String manifest =
getStaticManifest(launcher, repoDir, listener.getLogger());
final String manifestRevision =
getManifestRevision(launcher, repoDir, listener.getLogger());
+ final String expandedBranch = env.expand(manifestBranch);
final RevisionState currentState =
new RevisionState(manifest, manifestRevision, expandedBranch,
listener.getLogger());
@@ -452,7 +447,8 @@ private int doSync(final Launcher launcher, final FilePath workspace,
}
private boolean checkoutCode(final Launcher launcher,
- final FilePath workspace, final String expandedManifestBranch,
+ final FilePath workspace,
+ final EnvVars env,
final OutputStream logger)
throws IOException, InterruptedException {
final List commands = new ArrayList(4);
@@ -462,25 +458,25 @@ private boolean checkoutCode(final Launcher launcher,
commands.add(getDescriptor().getExecutable());
commands.add("init");
commands.add("-u");
- commands.add(manifestRepositoryUrl);
- if (expandedManifestBranch != null) {
+ commands.add(env.expand(manifestRepositoryUrl));
+ if (manifestBranch != null) {
commands.add("-b");
- commands.add(expandedManifestBranch);
+ commands.add(env.expand(manifestBranch));
}
if (manifestFile != null) {
commands.add("-m");
- commands.add(manifestFile);
+ commands.add(env.expand(manifestFile));
}
if (mirrorDir != null) {
- commands.add("--reference=" + mirrorDir);
+ commands.add("--reference=" + env.expand(mirrorDir));
}
if (repoUrl != null) {
- commands.add("--repo-url=" + repoUrl);
+ commands.add("--repo-url=" + env.expand(repoUrl));
commands.add("--no-repo-verify");
}
if (manifestGroup != null) {
commands.add("-g");
- commands.add(manifestGroup);
+ commands.add(env.expand(manifestGroup));
}
if (depth != 0) {
commands.add("--depth=" + depth);
From 748908075349649c217112bf598df50b4fb71b99 Mon Sep 17 00:00:00 2001
From: Scott Anderson
Date: Mon, 27 Oct 2014 12:31:18 -0400
Subject: [PATCH 045/184] Add --trace option
---
checkstyle.xml | 2 +-
.../java/hudson/plugins/repo/RepoScm.java | 26 ++++++++++----
.../hudson/plugins/repo/RepoScm/config.jelly | 36 ++++++++++---------
src/main/webapp/help-trace.html | 6 ++++
4 files changed, 45 insertions(+), 25 deletions(-)
create mode 100644 src/main/webapp/help-trace.html
diff --git a/checkstyle.xml b/checkstyle.xml
index 5285edb..920c371 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 0e84caa..e2bd907 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -90,6 +90,7 @@ public class RepoScm extends SCM implements Serializable {
private final boolean currentBranch;
private final boolean resetFirst;
private final boolean quiet;
+ private final boolean trace;
/**
* Returns the manifest repository URL.
@@ -272,14 +273,17 @@ public boolean isQuiet() {
* If not null then use this url as repo base,
* instead of the default
* @param currentBranch
- * if this value is true,
- * add "-c" options when excute "repo sync".
+ * If this value is true, add the "-c" option when executing
+ * "repo sync".
* @param resetFirst
- * if this value is true, do
- * "repo forall -c 'git reset --hard'" first.
+ * If this value is true, do "repo forall -c 'git reset --hard'"
+ * before syncing.
* @param quiet
- * if this value is true,
- * add "-q" options when excute "repo sync".
+ * If this value is true, add the "-q" option when executing
+ * "repo sync".
+ * @param trace
+ * If this value is true, add the "--trace" option when
+ * executing "repo init" and "repo sync".
*/
@DataBoundConstructor
public RepoScm(final String manifestRepositoryUrl,
@@ -290,7 +294,8 @@ public RepoScm(final String manifestRepositoryUrl,
final String repoUrl,
final boolean currentBranch,
final boolean resetFirst,
- final boolean quiet) {
+ final boolean quiet,
+ final boolean trace) {
this.manifestRepositoryUrl = manifestRepositoryUrl;
this.manifestBranch = Util.fixEmptyAndTrim(manifestBranch);
this.manifestGroup = Util.fixEmptyAndTrim(manifestGroup);
@@ -303,6 +308,7 @@ public RepoScm(final String manifestRepositoryUrl,
this.currentBranch = currentBranch;
this.resetFirst = resetFirst;
this.quiet = quiet;
+ this.trace = trace;
this.repoUrl = Util.fixEmptyAndTrim(repoUrl);
}
@@ -429,6 +435,9 @@ private int doSync(final Launcher launcher, final FilePath workspace,
commands.clear();
}
commands.add(getDescriptor().getExecutable());
+ if (trace) {
+ commands.add("--trace");
+ }
commands.add("sync");
commands.add("-d");
if (isCurrentBranch()) {
@@ -456,6 +465,9 @@ private boolean checkoutCode(final Launcher launcher,
debug.log(Level.INFO, "Checking out code in: " + workspace.getName());
commands.add(getDescriptor().getExecutable());
+ if (trace) {
+ commands.add("--trace");
+ }
commands.add("init");
commands.add("-u");
commands.add(env.expand(manifestRepositoryUrl));
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index 9c4e452..50e694c 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -7,55 +7,57 @@
xmlns:f="/lib/form">
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
+
diff --git a/src/main/webapp/help-trace.html b/src/main/webapp/help-trace.html
new file mode 100644
index 0000000..04eb903
--- /dev/null
+++ b/src/main/webapp/help-trace.html
@@ -0,0 +1,6 @@
+
+
+ Trace git command execution. This is passed to repo as
+ repo --trace <subcommand>.
+
+
From 12d723a0b24218f8a77f97d38f398c0847b9e0e3 Mon Sep 17 00:00:00 2001
From: Scott Anderson
Date: Mon, 27 Oct 2014 18:08:32 -0400
Subject: [PATCH 046/184] Preserve environment variables
In particular, this is useful with the SSH agent plugin
---
src/main/java/hudson/plugins/repo/RepoScm.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index e2bd907..55dd30a 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -416,7 +416,7 @@ public boolean checkout(
}
private int doSync(final Launcher launcher, final FilePath workspace,
- final OutputStream logger)
+ final OutputStream logger, final EnvVars env)
throws IOException, InterruptedException {
final List commands = new ArrayList(4);
debug.log(Level.FINE, "Syncing out code in: " + workspace.getName());
@@ -451,7 +451,7 @@ private int doSync(final Launcher launcher, final FilePath workspace,
}
int returnCode =
launcher.launch().stdout(logger).pwd(workspace)
- .cmds(commands).join();
+ .cmds(commands).envs(env).join();
return returnCode;
}
@@ -495,7 +495,7 @@ private boolean checkoutCode(final Launcher launcher,
}
int returnCode =
launcher.launch().stdout(logger).pwd(workspace)
- .cmds(commands).join();
+ .cmds(commands).envs(env).join();
if (returnCode != 0) {
return false;
}
@@ -513,7 +513,7 @@ private boolean checkoutCode(final Launcher launcher,
}
}
- returnCode = doSync(launcher, workspace, logger);
+ returnCode = doSync(launcher, workspace, logger, env);
if (returnCode != 0) {
debug.log(Level.WARNING, "Sync failed. Resetting repository");
commands.clear();
@@ -522,8 +522,8 @@ private boolean checkoutCode(final Launcher launcher,
commands.add("-c");
commands.add("git reset --hard");
launcher.launch().stdout(logger).pwd(workspace).cmds(commands)
- .join();
- returnCode = doSync(launcher, workspace, logger);
+ .envs(env).join();
+ returnCode = doSync(launcher, workspace, logger, env);
if (returnCode != 0) {
return false;
}
From ba9e448e755deb2cacc9ca4100577a945d25d863 Mon Sep 17 00:00:00 2001
From: Jacob Willoughby
Date: Thu, 8 Jan 2015 11:20:04 -0700
Subject: [PATCH 047/184] Add option for --first-parent in changelog
This adds an option to select whether or not --first-parent is
passed to "git log" when determining the changelog. The default
value is to include it.
---
checkstyle.xml | 2 +-
src/main/java/hudson/plugins/repo/ChangeLog.java | 16 ++++++++++++----
src/main/java/hudson/plugins/repo/RepoScm.java | 15 +++++++++++++--
.../hudson/plugins/repo/RepoScm/config.jelly | 4 ++++
src/main/webapp/help-firstParent.html | 6 ++++++
5 files changed, 36 insertions(+), 7 deletions(-)
create mode 100644 src/main/webapp/help-firstParent.html
diff --git a/checkstyle.xml b/checkstyle.xml
index 920c371..059f0e7 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/ChangeLog.java b/src/main/java/hudson/plugins/repo/ChangeLog.java
index c0bfaf6..302fda1 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLog.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLog.java
@@ -95,6 +95,8 @@ public RepoChangeLogSet parse(
* @param workspace
* The FilePath of the workspace to use when computing
* differences. This path might be on a slave machine.
+ * @param firstParent
+ * Add --first-parent to "git log"
* @throws IOException
* is thrown if we have problems writing to the changelogFile
* @throws InterruptedException
@@ -104,7 +106,8 @@ public RepoChangeLogSet parse(
public static List generateChangeLog(
final RevisionState currentState,
final RevisionState previousState, final Launcher launcher,
- final FilePath workspace) throws IOException,
+ final FilePath workspace, final boolean firstParent)
+ throws IOException,
InterruptedException {
final List changes =
currentState.whatChanged(previousState);
@@ -141,7 +144,9 @@ public static List generateChangeLog(
commands.add("git");
commands.add("log");
commands.add("--raw");
- commands.add("--first-parent");
+ if (firstParent) {
+ commands.add("--first-parent");
+ }
final String format = "[[]]"
+ "%H[[]"
@@ -225,6 +230,8 @@ public static List generateChangeLog(
* @param workspace
* The FilePath of the workspace to use when computing
* differences. This path might be on a slave machine.
+ * @param firstParent
+ * Add --first-parent to "git log"
* @throws IOException
* is thrown if we have problems writing to the changelogFile
* @throws InterruptedException
@@ -233,11 +240,12 @@ public static List generateChangeLog(
*/
public static void saveChangeLog(final RevisionState currentState,
final RevisionState previousState, final File changelogFile,
- final Launcher launcher, final FilePath workspace)
+ final Launcher launcher, final FilePath workspace,
+ final boolean firstParent)
throws IOException, InterruptedException {
List logs =
generateChangeLog(currentState, previousState, launcher,
- workspace);
+ workspace, firstParent);
if (logs == null) {
debug.info("No logs found");
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 55dd30a..b9b6c35 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -91,6 +91,7 @@ public class RepoScm extends SCM implements Serializable {
private final boolean resetFirst;
private final boolean quiet;
private final boolean trace;
+ private final boolean firstParent;
/**
* Returns the manifest repository URL.
@@ -227,6 +228,11 @@ public boolean isCurrentBranch() {
*/
@Exported
public boolean resetFirst() { return resetFirst; }
+ /**
+ * Returns the value of firstParent.
+ */
+ @Exported
+ public boolean firstParent() { return firstParent; }
/**
* Returns the value of quiet.
*/
@@ -284,6 +290,9 @@ public boolean isQuiet() {
* @param trace
* If this value is true, add the "--trace" option when
* executing "repo init" and "repo sync".
+ * @param firstParent
+ * If this value is true, add the "--first-parent" option to
+ * "git log" when determining changesets.
*/
@DataBoundConstructor
public RepoScm(final String manifestRepositoryUrl,
@@ -295,7 +304,8 @@ public RepoScm(final String manifestRepositoryUrl,
final boolean currentBranch,
final boolean resetFirst,
final boolean quiet,
- final boolean trace) {
+ final boolean trace,
+ final boolean firstParent) {
this.manifestRepositoryUrl = manifestRepositoryUrl;
this.manifestBranch = Util.fixEmptyAndTrim(manifestBranch);
this.manifestGroup = Util.fixEmptyAndTrim(manifestGroup);
@@ -309,6 +319,7 @@ public RepoScm(final String manifestRepositoryUrl,
this.resetFirst = resetFirst;
this.quiet = quiet;
this.trace = trace;
+ this.firstParent = firstParent;
this.repoUrl = Util.fixEmptyAndTrim(repoUrl);
}
@@ -410,7 +421,7 @@ public boolean checkout(
getLastState(previousBuild, expandedBranch);
ChangeLog.saveChangeLog(currentState, previousState, changelogFile,
- launcher, repoDir);
+ launcher, repoDir, firstParent);
build.addAction(new TagAction(build));
return true;
}
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index 50e694c..a6541d4 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -60,6 +60,10 @@
+
+
+
+
diff --git a/src/main/webapp/help-firstParent.html b/src/main/webapp/help-firstParent.html
new file mode 100644
index 0000000..c332bc1
--- /dev/null
+++ b/src/main/webapp/help-firstParent.html
@@ -0,0 +1,6 @@
+
+
+ When this is checked --first-parent is passed to git
+ log when determining changesets.
+
+
From 2abb1c394ab0af995e46b99f990337bd428be5a7 Mon Sep 17 00:00:00 2001
From: Jacob Willoughby
Date: Wed, 4 Feb 2015 13:40:01 -0700
Subject: [PATCH 048/184] Rename firstParent to showAllChanges
Renaming this option and reversing the logic effectively allows
backwards compatibility with the existing plugin behavior.
---
src/main/java/hudson/plugins/repo/ChangeLog.java | 12 ++++++------
src/main/java/hudson/plugins/repo/RepoScm.java | 14 +++++++-------
.../hudson/plugins/repo/RepoScm/config.jelly | 4 ++--
src/main/webapp/help-firstParent.html | 6 ------
src/main/webapp/help-showAllChanges.html | 6 ++++++
5 files changed, 21 insertions(+), 21 deletions(-)
delete mode 100644 src/main/webapp/help-firstParent.html
create mode 100644 src/main/webapp/help-showAllChanges.html
diff --git a/src/main/java/hudson/plugins/repo/ChangeLog.java b/src/main/java/hudson/plugins/repo/ChangeLog.java
index 302fda1..17c3e10 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLog.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLog.java
@@ -95,7 +95,7 @@ public RepoChangeLogSet parse(
* @param workspace
* The FilePath of the workspace to use when computing
* differences. This path might be on a slave machine.
- * @param firstParent
+ * @param showAllChanges
* Add --first-parent to "git log"
* @throws IOException
* is thrown if we have problems writing to the changelogFile
@@ -106,7 +106,7 @@ public RepoChangeLogSet parse(
public static List generateChangeLog(
final RevisionState currentState,
final RevisionState previousState, final Launcher launcher,
- final FilePath workspace, final boolean firstParent)
+ final FilePath workspace, final boolean showAllChanges)
throws IOException,
InterruptedException {
final List changes =
@@ -144,7 +144,7 @@ public static List generateChangeLog(
commands.add("git");
commands.add("log");
commands.add("--raw");
- if (firstParent) {
+ if (!showAllChanges) {
commands.add("--first-parent");
}
@@ -230,7 +230,7 @@ public static List generateChangeLog(
* @param workspace
* The FilePath of the workspace to use when computing
* differences. This path might be on a slave machine.
- * @param firstParent
+ * @param showAllChanges
* Add --first-parent to "git log"
* @throws IOException
* is thrown if we have problems writing to the changelogFile
@@ -241,11 +241,11 @@ public static List generateChangeLog(
public static void saveChangeLog(final RevisionState currentState,
final RevisionState previousState, final File changelogFile,
final Launcher launcher, final FilePath workspace,
- final boolean firstParent)
+ final boolean showAllChanges)
throws IOException, InterruptedException {
List logs =
generateChangeLog(currentState, previousState, launcher,
- workspace, firstParent);
+ workspace, showAllChanges);
if (logs == null) {
debug.info("No logs found");
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index b9b6c35..c739985 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -91,7 +91,7 @@ public class RepoScm extends SCM implements Serializable {
private final boolean resetFirst;
private final boolean quiet;
private final boolean trace;
- private final boolean firstParent;
+ private final boolean showAllChanges;
/**
* Returns the manifest repository URL.
@@ -229,10 +229,10 @@ public boolean isCurrentBranch() {
@Exported
public boolean resetFirst() { return resetFirst; }
/**
- * Returns the value of firstParent.
+ * Returns the value of showAllChanges.
*/
@Exported
- public boolean firstParent() { return firstParent; }
+ public boolean showAllChanges() { return showAllChanges; }
/**
* Returns the value of quiet.
*/
@@ -290,7 +290,7 @@ public boolean isQuiet() {
* @param trace
* If this value is true, add the "--trace" option when
* executing "repo init" and "repo sync".
- * @param firstParent
+ * @param showAllChanges
* If this value is true, add the "--first-parent" option to
* "git log" when determining changesets.
*/
@@ -305,7 +305,7 @@ public RepoScm(final String manifestRepositoryUrl,
final boolean resetFirst,
final boolean quiet,
final boolean trace,
- final boolean firstParent) {
+ final boolean showAllChanges) {
this.manifestRepositoryUrl = manifestRepositoryUrl;
this.manifestBranch = Util.fixEmptyAndTrim(manifestBranch);
this.manifestGroup = Util.fixEmptyAndTrim(manifestGroup);
@@ -319,7 +319,7 @@ public RepoScm(final String manifestRepositoryUrl,
this.resetFirst = resetFirst;
this.quiet = quiet;
this.trace = trace;
- this.firstParent = firstParent;
+ this.showAllChanges = showAllChanges;
this.repoUrl = Util.fixEmptyAndTrim(repoUrl);
}
@@ -421,7 +421,7 @@ public boolean checkout(
getLastState(previousBuild, expandedBranch);
ChangeLog.saveChangeLog(currentState, previousState, changelogFile,
- launcher, repoDir, firstParent);
+ launcher, repoDir, showAllChanges);
build.addAction(new TagAction(build));
return true;
}
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index a6541d4..22bbb13 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -60,8 +60,8 @@
-
-
+
+
diff --git a/src/main/webapp/help-firstParent.html b/src/main/webapp/help-firstParent.html
deleted file mode 100644
index c332bc1..0000000
--- a/src/main/webapp/help-firstParent.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- When this is checked --first-parent is passed to git
- log when determining changesets.
-
-
diff --git a/src/main/webapp/help-showAllChanges.html b/src/main/webapp/help-showAllChanges.html
new file mode 100644
index 0000000..18bcd6f
--- /dev/null
+++ b/src/main/webapp/help-showAllChanges.html
@@ -0,0 +1,6 @@
+
+
+ When this is checked --first-parent is no longer passed
+ to git log when determining changesets.
+
+
From 9c6f8794af61edcbd01d422b14b480df69c52e1c Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Thu, 23 Apr 2015 11:54:02 +0200
Subject: [PATCH 049/184] Make it simpler to release
---
pom.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/pom.xml b/pom.xml
index c204bb9..9362ec9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,6 +60,7 @@
org.apache.maven.plugins
maven-release-plugin
+ 2.5.1
deploy
From 962e4d8da709e5da10846e5578a5669d6a955fec Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Thu, 23 Apr 2015 11:55:06 +0200
Subject: [PATCH 050/184] [maven-release-plugin] prepare release repo-1.7
---
pom.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 9362ec9..af3b958 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.7-SNAPSHOT
+ 1.7
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -118,6 +118,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
+ repo-1.7
From a18bffad27f81fae83095fab6239c32ba30a27d8 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Thu, 23 Apr 2015 11:55:12 +0200
Subject: [PATCH 051/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index af3b958..29c59d3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.7
+ 1.8-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -118,7 +118,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.7
+ HEAD
From 80837bd75c1ac908a060ef9d71566524680d7aed Mon Sep 17 00:00:00 2001
From: Makson Lee
Date: Thu, 23 Apr 2015 20:50:32 +0800
Subject: [PATCH 052/184] Fix some options can't be shown properly in
configureation page
---
src/main/java/hudson/plugins/repo/RepoScm.java | 9 +++++++--
.../resources/hudson/plugins/repo/RepoScm/config.jelly | 2 +-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index c739985..a6211c7 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -227,12 +227,12 @@ public boolean isCurrentBranch() {
* Returns the value of resetFirst.
*/
@Exported
- public boolean resetFirst() { return resetFirst; }
+ public boolean isResetFirst() { return resetFirst; }
/**
* Returns the value of showAllChanges.
*/
@Exported
- public boolean showAllChanges() { return showAllChanges; }
+ public boolean isShowAllChanges() { return showAllChanges; }
/**
* Returns the value of quiet.
*/
@@ -240,6 +240,11 @@ public boolean isCurrentBranch() {
public boolean isQuiet() {
return quiet;
}
+ /**
+ * Returns the value of trace.
+ */
+ @Exported
+ public boolean isTrace() { return trace; }
/**
* The constructor takes in user parameters and sets them. Each job using
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index 22bbb13..86b37ab 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -61,7 +61,7 @@
-
+
From 3eee94158945c971c9d1cfd0bbc3286794f39cbf Mon Sep 17 00:00:00 2001
From: rsandell
Date: Wed, 6 May 2015 14:46:35 +0200
Subject: [PATCH 053/184] [maven-release-plugin] prepare release repo-1.7.1
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 29c59d3..db8b106 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.8-SNAPSHOT
+ 1.7.1
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -118,7 +118,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.7.1
From 295e079dcfa3e6cdfffdf82d654791c7a5f1d0f8 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Wed, 6 May 2015 14:46:39 +0200
Subject: [PATCH 054/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index db8b106..ab2641f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.7.1
+ 1.7.2-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -118,7 +118,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.7.1
+ HEAD
From 1f4c85efad38581c154e15fba0b7640f457b1b80 Mon Sep 17 00:00:00 2001
From: Andrew Goktepe
Date: Thu, 6 Aug 2015 16:00:48 -0700
Subject: [PATCH 055/184] add option to enable the force-sync option to repo
sync
---
src/main/java/hudson/plugins/repo/RepoScm.java | 16 ++++++++++++++++
.../hudson/plugins/repo/RepoScm/config.jelly | 4 ++++
src/main/webapp/help-forceSync.html | 6 ++++++
3 files changed, 26 insertions(+)
create mode 100644 src/main/webapp/help-forceSync.html
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index a6211c7..57d4549 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -90,6 +90,7 @@ public class RepoScm extends SCM implements Serializable {
private final boolean currentBranch;
private final boolean resetFirst;
private final boolean quiet;
+ private final boolean forceSync;
private final boolean trace;
private final boolean showAllChanges;
@@ -240,6 +241,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.
*/
@@ -298,6 +306,9 @@ public boolean isQuiet() {
* @param showAllChanges
* If this value is true, add the "--first-parent" option to
* "git log" when determining changesets.
+ * @param forceSync
+ * If this value is true, add the "-f" option when executing
+ * "repo sync".
*/
@DataBoundConstructor
public RepoScm(final String manifestRepositoryUrl,
@@ -309,6 +320,7 @@ public RepoScm(final String manifestRepositoryUrl,
final boolean currentBranch,
final boolean resetFirst,
final boolean quiet,
+ final boolean forceSync,
final boolean trace,
final boolean showAllChanges) {
this.manifestRepositoryUrl = manifestRepositoryUrl;
@@ -323,6 +335,7 @@ public RepoScm(final String manifestRepositoryUrl,
this.currentBranch = currentBranch;
this.resetFirst = resetFirst;
this.quiet = quiet;
+ this.forceSync = forceSync;
this.trace = trace;
this.showAllChanges = showAllChanges;
this.repoUrl = Util.fixEmptyAndTrim(repoUrl);
@@ -462,6 +475,9 @@ private int doSync(final Launcher launcher, final FilePath workspace,
if (isQuiet()) {
commands.add("-q");
}
+ if (isForceSync()) {
+ commands.add("-f");
+ }
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..5fc1710 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..65865ab
--- /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 -f.
+
+
From c4a5b3bbd70a65aad1de69c88ddcab3bae9052c5 Mon Sep 17 00:00:00 2001
From: Andrew Goktepe
Date: Thu, 6 Aug 2015 16:47:40 -0700
Subject: [PATCH 056/184] force sync option that works is --force-sync, not -f
---
src/main/java/hudson/plugins/repo/RepoScm.java | 4 ++--
src/main/webapp/help-forceSync.html | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 57d4549..97e099a 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -307,7 +307,7 @@ public boolean isForceSync() {
* If this value is true, add the "--first-parent" option to
* "git log" when determining changesets.
* @param forceSync
- * If this value is true, add the "-f" option when executing
+ * If this value is true, add the "--force-sync" option when executing
* "repo sync".
*/
@DataBoundConstructor
@@ -476,7 +476,7 @@ private int doSync(final Launcher launcher, final FilePath workspace,
commands.add("-q");
}
if (isForceSync()) {
- commands.add("-f");
+ commands.add("--force-sync");
}
if (jobs > 0) {
commands.add("--jobs=" + jobs);
diff --git a/src/main/webapp/help-forceSync.html b/src/main/webapp/help-forceSync.html
index 65865ab..85264a5 100644
--- a/src/main/webapp/help-forceSync.html
+++ b/src/main/webapp/help-forceSync.html
@@ -1,6 +1,6 @@
Continue sync even if a project fails to sync
- This is passed to repo as repo sync -f.
+ This is passed to repo as repo sync --force-sync.
From 676fc198541b741f3e188a4c0b716661dee7bbb3 Mon Sep 17 00:00:00 2001
From: Andrew Goktepe
Date: Tue, 22 Sep 2015 07:53:39 -0700
Subject: [PATCH 057/184] move forceSync out of constructor and into a setter
method fix other checkstyle errors
---
pom.xml | 2 +-
.../java/hudson/plugins/repo/RepoScm.java | 19 +++++++++++++------
2 files changed, 14 insertions(+), 7 deletions(-)
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 97e099a..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,7 +91,7 @@ public class RepoScm extends SCM implements Serializable {
private final boolean currentBranch;
private final boolean resetFirst;
private final boolean quiet;
- private final boolean forceSync;
+ private boolean forceSync;
private final boolean trace;
private final boolean showAllChanges;
@@ -306,9 +307,6 @@ public boolean isForceSync() {
* @param showAllChanges
* If this value is true, add the "--first-parent" option to
* "git log" when determining changesets.
- * @param forceSync
- * If this value is true, add the "--force-sync" option when executing
- * "repo sync".
*/
@DataBoundConstructor
public RepoScm(final String manifestRepositoryUrl,
@@ -320,7 +318,6 @@ public RepoScm(final String manifestRepositoryUrl,
final boolean currentBranch,
final boolean resetFirst,
final boolean quiet,
- final boolean forceSync,
final boolean trace,
final boolean showAllChanges) {
this.manifestRepositoryUrl = manifestRepositoryUrl;
@@ -335,12 +332,22 @@ public RepoScm(final String manifestRepositoryUrl,
this.currentBranch = currentBranch;
this.resetFirst = resetFirst;
this.quiet = quiet;
- this.forceSync = forceSync;
this.trace = trace;
this.showAllChanges = showAllChanges;
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,
From b4a140b919f891342da5a10bed468265321be899 Mon Sep 17 00:00:00 2001
From: Andrew Goktepe
Date: Tue, 22 Sep 2015 07:55:42 -0700
Subject: [PATCH 058/184] do not default forceSync to true
---
src/main/resources/hudson/plugins/repo/RepoScm/config.jelly | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index 5fc1710..202cf01 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -57,7 +57,7 @@
-
+
From 2844357593257e7015aaa87af36983f4d87c595d Mon Sep 17 00:00:00 2001
From: Mika Kaukoranta
Date: Mon, 21 Sep 2015 22:23:53 +0300
Subject: [PATCH 059/184] 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 060/184] 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.
+
+
From 9d846a961a1c21026d00a4aa6706142573e63448 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Fri, 25 Sep 2015 15:18:09 +0200
Subject: [PATCH 061/184] Adding idea project files to ignore
---
.gitignore | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.gitignore b/.gitignore
index 34b3584..ae06f45 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,5 @@ work
.classpath
.project
.settings
+*.iml
+.idea
From d7b74fdde6d58869d173a630eb86161975ffbdd2 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Fri, 25 Sep 2015 15:49:10 +0200
Subject: [PATCH 062/184] [maven-release-plugin] prepare release repo-1.8.0
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 6653ab4..d1182c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.7.2-SNAPSHOT
+ 1.8.0
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -118,7 +118,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.8.0
From cf2e3ab12c8209da18e53a4b2508a124852d964f Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Fri, 25 Sep 2015 15:49:15 +0200
Subject: [PATCH 063/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index d1182c1..e0420fc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.8.0
+ 1.8.1-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -118,7 +118,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.8.0
+ HEAD
From 45dd2f9a5a64c505fcea28d5db9bf64df6d53fc1 Mon Sep 17 00:00:00 2001
From: Francois Ferrand
Date: Fri, 18 Dec 2015 17:24:33 +0100
Subject: [PATCH 064/184] [JENKINS-26836] Support use from Workflow.
---
checkstyle.xml | 1 +
.../java/hudson/plugins/repo/RepoScm.java | 422 +++++++++++++-----
2 files changed, 308 insertions(+), 115 deletions(-)
diff --git a/checkstyle.xml b/checkstyle.xml
index 3c35ea1..cb4ef41 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -47,6 +47,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 acfbfe9..8f10b39 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -39,9 +39,7 @@
import hudson.FilePath;
import hudson.Launcher;
import hudson.Util;
-import hudson.model.AbstractBuild;
-import hudson.model.AbstractProject;
-import hudson.model.BuildListener;
+import hudson.model.Job;
import hudson.model.ParameterDefinition;
import hudson.model.ParametersDefinitionProperty;
import hudson.model.Run;
@@ -65,6 +63,10 @@
import hudson.scm.PollingResult.Change;
import hudson.util.FormValidation;
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
/**
* The main entrypoint of the plugin. This class contains code to store user
* configuration and to check out the code using a repo binary.
@@ -79,22 +81,22 @@ public class RepoScm extends SCM implements Serializable {
private final String manifestRepositoryUrl;
// Advanced Fields:
- private final String manifestBranch;
- private final String manifestFile;
- private final String manifestGroup;
- private final String repoUrl;
- private final String mirrorDir;
- private final int jobs;
- private final int depth;
- private final String localManifest;
- private final String destinationDir;
- private final boolean currentBranch;
- private final boolean resetFirst;
- private final boolean quiet;
- private boolean forceSync;
- private final boolean trace;
- private final boolean showAllChanges;
- private boolean noTags;
+ @CheckForNull private String manifestFile;
+ @CheckForNull private String manifestGroup;
+ @CheckForNull private String repoUrl;
+ @CheckForNull private String mirrorDir;
+ @CheckForNull private String manifestBranch;
+ @CheckForNull private int jobs;
+ @CheckForNull private int depth;
+ @CheckForNull private String localManifest;
+ @CheckForNull private String destinationDir;
+ @CheckForNull private boolean currentBranch;
+ @CheckForNull private boolean resetFirst;
+ @CheckForNull private boolean quiet;
+ @CheckForNull private boolean forceSync;
+ @CheckForNull private boolean trace;
+ @CheckForNull private boolean showAllChanges;
+ @CheckForNull private boolean noTags;
/**
* Returns the manifest repository URL.
@@ -121,7 +123,7 @@ public String getManifestBranch() {
* @param project the project that is being built
*/
private EnvVars getEnvVars(final EnvVars environment,
- final AbstractProject, ?> project) {
+ final Job, ?> project) {
// create an empty vars map
final EnvVars finalEnv = new EnvVars();
final ParametersDefinitionProperty params = project.getProperty(
@@ -227,7 +229,7 @@ public boolean isCurrentBranch() {
return currentBranch;
}
/**
- * Returns the value of resetFirst.
+ * Returns the value of resetFirst.the initial manifest file name.
*/
@Exported
public boolean isResetFirst() { return resetFirst; }
@@ -265,94 +267,263 @@ public boolean isForceSync() {
* The constructor takes in user parameters and sets them. Each job using
* the RepoSCM will call this constructor.
*
- * @param manifestRepositoryUrl
- * The URL for the manifest repository.
- * @param manifestBranch
- * The branch of the manifest repository. Typically this is null
- * or the empty string, which will cause repo to default to
- * "master".
- * @param manifestFile
- * The file to use as the repository manifest. Typically this is
- * null which will cause repo to use the default of "default.xml"
- * @param manifestGroup
- * The group name for the projects that need to be fetched.
- * Typically, this is null and all projects tagged 'default' will
- * be fetched.
- * @param mirrorDir
- * The path of the mirror directory to reference when
- * initializing repo.
- * @param jobs
- * The number of concurrent jobs to use for the sync command. If
- * this is 0 or negative the jobs parameter is not specified.
- * @param depth
- * This is the depth to use when syncing. By default this is 0
- * and the full history is synced.
- * @param localManifest
- * May be null, a string containing XML, or an URL.
- * If XML, this string is written to .repo/local_manifest.xml
- * If an URL, the URL is fetched and the content is written
- * to .repo/local_manifest.xml
- * @param destinationDir
- * If not null then the source is synced to the destinationDir
- * subdirectory of the workspace.
- * @param repoUrl
- * If not null then use this url as repo base,
- * instead of the default
- * @param currentBranch
- * If this value is true, add the "-c" option when executing
- * "repo sync".
- * @param resetFirst
- * If this value is true, do "repo forall -c 'git reset --hard'"
- * before syncing.
- * @param quiet
- * If this value is true, add the "-q" option when executing
- * "repo sync".
- * @param trace
- * If this value is true, add the "--trace" option when
- * executing "repo init" and "repo sync".
- * @param showAllChanges
- * If this value is true, add the "--first-parent" option to
- * "git log" when determining changesets.
+ * @param manifestRepositoryUrl The URL for the manifest repository.
+ * @param manifestBranch The branch of the manifest repository. Typically this is null
+ * or the empty string, which will cause repo to default to
+ * "master".
+ * @param manifestFile The file to use as the repository manifest. Typically this is
+ * null which will cause repo to use the default of "default.xml"
+ * @param manifestGroup The group name for the projects that need to be fetched.
+ * Typically, this is null and all projects tagged 'default' will
+ * be fetched.
+ * @param mirrorDir The path of the mirror directory to reference when
+ * initializing repo.
+ * @param jobs The number of concurrent jobs to use for the sync command. If
+ * this is 0 or negative the jobs parameter is not specified.
+ * @param depth This is the depth to use when syncing. By default this is 0
+ * and the full history is synced.
+ * @param localManifest May be null, a string containing XML, or an URL.
+ * If XML, this string is written to .repo/local_manifest.xml
+ * If an URL, the URL is fetched and the content is written
+ * to .repo/local_manifest.xml
+ * @param destinationDir If not null then the source is synced to the destinationDir
+ * subdirectory of the workspace.
+ * @param repoUrl If not null then use this url as repo base,
+ * instead of the default
+ * @param currentBranch If this value is true, add the "-c" option when executing
+ * "repo sync".
+ * @param resetFirst If this value is true, do "repo forall -c 'git reset --hard'"
+ * before syncing.
+ * @param quiet If this value is true, add the "-q" option when executing
+ * "repo sync".
+ * @param trace If this value is true, add the "--trace" option when
+ * executing "repo init" and "repo sync".
+ * @param showAllChanges If this value is true, add the "--first-parent" option to
+ * "git log" when determining changesets.
*/
- @DataBoundConstructor
+ @Deprecated
public RepoScm(final String manifestRepositoryUrl,
- final String manifestBranch, final String manifestFile,
- final String manifestGroup, final String mirrorDir, final int jobs,
- final int depth,
- final String localManifest, final String destinationDir,
- final String repoUrl,
- final boolean currentBranch,
- final boolean resetFirst,
- final boolean quiet,
- final boolean trace,
- final boolean showAllChanges) {
+ final String manifestBranch, final String manifestFile,
+ final String manifestGroup, final String mirrorDir, final int jobs,
+ final int depth,
+ final String localManifest, final String destinationDir,
+ final String repoUrl,
+ final boolean currentBranch,
+ final boolean resetFirst,
+ final boolean quiet,
+ final boolean trace,
+ final boolean showAllChanges) {
+ this(manifestRepositoryUrl);
+ setManifestBranch(manifestBranch);
+ setManifestGroup(manifestGroup);
+ setManifestFile(manifestFile);
+ setMirrorDir(mirrorDir);
+ setJobs(jobs);
+ setDepth(depth);
+ setLocalManifest(localManifest);
+ setDestinationDir(destinationDir);
+ setCurrentBranch(currentBranch);
+ setResetFirst(resetFirst);
+ setQuiet(quiet);
+ setTrace(trace);
+ setShowAllChanges(showAllChanges);
+ setRepoUrl(repoUrl);
+ }
+
+ /**
+ * The constructor takes in user parameters and sets them. Each job using
+ * the RepoSCM will call this constructor.
+ *
+ * @param manifestRepositoryUrl The URL for the manifest repository.
+ */
+ @DataBoundConstructor
+ public RepoScm(final String manifestRepositoryUrl) {
this.manifestRepositoryUrl = manifestRepositoryUrl;
+ }
+
+ /**
+ * Set the manifest branch name.
+ *
+ * @param manifestBranch
+ * The branch of the manifest repository. Typically this is null
+ * or the empty string, which will cause repo to default to
+ * "master".
+ */
+ @DataBoundSetter
+ public void setManifestBranch(@CheckForNull final String manifestBranch) {
this.manifestBranch = Util.fixEmptyAndTrim(manifestBranch);
- this.manifestGroup = Util.fixEmptyAndTrim(manifestGroup);
+ }
+
+ /**
+ * Set the initial manifest file name.
+ *
+ * @param manifestFile
+ * The file to use as the repository manifest. Typically this is
+ * null which will cause repo to use the default of "default.xml"
+ */
+ @DataBoundSetter
+ public void setManifestFile(@CheckForNull final String manifestFile) {
this.manifestFile = Util.fixEmptyAndTrim(manifestFile);
+ }
+
+ /**
+ * Set the group of projects to fetch.
+ *
+ * @param manifestGroup
+ * The group name for the projects that need to be fetched.
+ * Typically, this is null and all projects tagged 'default' will
+ * be fetched.
+ */
+ @DataBoundSetter
+ public void setManifestGroup(@CheckForNull final String manifestGroup) {
+ this.manifestGroup = Util.fixEmptyAndTrim(manifestGroup);
+ }
+
+ /**
+ * Set the name of the mirror directory.
+ *
+ * @param mirrorDir
+ * The path of the mirror directory to reference when
+ * initializing repo.
+ */
+ @DataBoundSetter
+ public void setMirrorDir(@CheckForNull final String mirrorDir) {
this.mirrorDir = Util.fixEmptyAndTrim(mirrorDir);
+ }
+
+ /**
+ * Set the number of jobs used for sync.
+ *
+ * @param jobs
+ * The number of concurrent jobs to use for the sync command. If
+ * this is 0 or negative the jobs parameter is not specified.
+ */
+ @DataBoundSetter
+ public void setJobs(@CheckForNull final int jobs) {
this.jobs = jobs;
+ }
+
+ /**
+ * Set the depth used for sync.
+ *
+ * @param depth
+ * This is the depth to use when syncing. By default this is 0
+ * and the full history is synced.
+ */
+ @DataBoundSetter
+ public void setDepth(@CheckForNull final int depth) {
this.depth = depth;
+ }
+
+ /**
+ * Set the content of the local manifest.
+ *
+ * @param localManifest
+ * May be null, a string containing XML, or an URL.
+ * If XML, this string is written to .repo/local_manifest.xml
+ * If an URL, the URL is fetched and the content is written
+ * to .repo/local_manifest.xml
+ */
+ @DataBoundSetter
+ public void setLocalManifest(@CheckForNull final String localManifest) {
this.localManifest = Util.fixEmptyAndTrim(localManifest);
+ }
+
+ /**
+ * Set the destination directory.
+ *
+ * @param destinationDir
+ * If not null then the source is synced to the destinationDir
+ * subdirectory of the workspace.
+ */
+ @DataBoundSetter
+ public void setDestinationDir(@CheckForNull final String destinationDir) {
this.destinationDir = Util.fixEmptyAndTrim(destinationDir);
+ }
+
+ /**
+ * Set currentBranch.
+ *
+ * @param currentBranch
+ * If this value is true, add the "-c" option when executing
+ * "repo sync".
+ */
+ @DataBoundSetter
+ public void setCurrentBranch(@CheckForNull final boolean currentBranch) {
this.currentBranch = currentBranch;
+ }
+
+ /**
+ * Set resetFirst.
+ *
+ * @param resetFirst
+ * If this value is true, do "repo forall -c 'git reset --hard'"
+ * before syncing.
+ */
+ @DataBoundSetter
+ public void setResetFirst(@CheckForNull final boolean resetFirst) {
this.resetFirst = resetFirst;
+ }
+
+ /**
+ * Set quiet.
+ *
+ * @param quiet
+ * * If this value is true, add the "-q" option when executing
+ * "repo sync".
+ */
+ @DataBoundSetter
+ public void setQuiet(@CheckForNull final boolean quiet) {
this.quiet = quiet;
+ }
+
+ /**
+ * Set trace.
+ *
+ * @param trace
+ * If this value is true, add the "--trace" option when
+ * executing "repo init" and "repo sync".
+ */
+
+ @DataBoundSetter
+ public void setTrace(@CheckForNull final boolean trace) {
this.trace = trace;
+ }
+
+ /**
+ * Set showAllChanges.
+ *
+ * @param showAllChanges
+ * If this value is true, add the "--first-parent" option to
+ * "git log" when determining changesets.
+ */
+ @DataBoundSetter
+ public void setShowAllChanges(@CheckForNull final boolean showAllChanges) {
this.showAllChanges = showAllChanges;
+ }
+
+ /**
+ * Set the repo url.
+ *
+ * @param repoUrl
+ * If not null then use this url as repo base,
+ * instead of the default
+ */
+ @DataBoundSetter
+ public void setRepoUrl(@CheckForNull final String repoUrl) {
this.repoUrl = Util.fixEmptyAndTrim(repoUrl);
}
- /**
- * Enables --force-sync option on repo sync command.
+ /**
+ * 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;
- }
+ * executing "repo sync".
+ */
+ @DataBoundSetter
+ public void setForceSync(@CheckForNull final boolean forceSync) {
+ this.forceSync = forceSync;
+ }
/**
* Set noTags.
@@ -368,9 +539,9 @@ public final void setNoTags(final boolean noTags) {
@Override
public SCMRevisionState calcRevisionsFromBuild(
- final AbstractBuild, ?> build, final Launcher launcher,
- final TaskListener listener) throws IOException,
- InterruptedException {
+ @Nonnull final Run, ?> build, @Nullable final FilePath workspace,
+ @Nullable final Launcher launcher, @Nonnull final TaskListener listener
+ ) throws IOException, InterruptedException {
// We add our SCMRevisionState from within checkout, so this shouldn't
// be called often. However it will be called if this is the first
// build, if a build was aborted before it reported the repository
@@ -379,19 +550,19 @@ public SCMRevisionState calcRevisionsFromBuild(
}
@Override
- protected PollingResult compareRemoteRevisionWith(
- final AbstractProject, ?> project, final Launcher launcher,
- final FilePath workspace, final TaskListener listener,
- final SCMRevisionState baseline) throws IOException,
+ public PollingResult compareRemoteRevisionWith(
+ @Nonnull final Job, ?> job, @Nullable final Launcher launcher,
+ @Nullable final FilePath workspace, @Nonnull final TaskListener listener,
+ @Nonnull final SCMRevisionState baseline) throws IOException,
InterruptedException {
SCMRevisionState myBaseline = baseline;
- final EnvVars env = getEnvVars(null, project);
+ final EnvVars env = getEnvVars(null, job);
final String expandedManifestBranch = env.expand(manifestBranch);
- final AbstractBuild, ?> lastBuild = project.getLastBuild();
+ final Run, ?> lastRun = job.getLastBuild();
if (myBaseline == null) {
// Probably the first build, or possibly an aborted build.
- myBaseline = getLastState(lastBuild, expandedManifestBranch);
+ myBaseline = getLastState(lastRun, expandedManifestBranch);
if (myBaseline == null) {
return PollingResult.BUILD_NOW;
}
@@ -400,13 +571,14 @@ protected PollingResult compareRemoteRevisionWith(
FilePath repoDir;
if (destinationDir != null) {
repoDir = workspace.child(destinationDir);
- if (!repoDir.isDirectory()) {
- repoDir.mkdirs();
- }
} else {
repoDir = workspace;
}
+ if (!repoDir.isDirectory()) {
+ repoDir.mkdirs();
+ }
+
if (!checkoutCode(launcher, repoDir, env, listener.getLogger())) {
// Some error occurred, try a build now so it gets logged.
return new PollingResult(myBaseline, myBaseline,
@@ -427,27 +599,28 @@ protected PollingResult compareRemoteRevisionWith(
}
@Override
- public boolean checkout(
- @SuppressWarnings("rawtypes") final AbstractBuild build,
- final Launcher launcher, final FilePath workspace,
- final BuildListener listener, final File changelogFile)
+ public void checkout(
+ @Nonnull final Run, ?> build, @Nonnull final Launcher launcher,
+ @Nonnull final FilePath workspace, @Nonnull final TaskListener listener,
+ @CheckForNull final File changelogFile, @CheckForNull final SCMRevisionState baseline)
throws IOException, InterruptedException {
FilePath repoDir;
if (destinationDir != null) {
repoDir = workspace.child(destinationDir);
- if (!repoDir.isDirectory()) {
- repoDir.mkdirs();
- }
} else {
repoDir = workspace;
}
- AbstractProject, ?> proj = build.getProject();
+ if (!repoDir.isDirectory()) {
+ repoDir.mkdirs();
+ }
+
+ Job, ?> job = build.getParent();
EnvVars env = build.getEnvironment(listener);
- env = getEnvVars(env, proj);
+ env = getEnvVars(env, job);
if (!checkoutCode(launcher, repoDir, env, listener.getLogger())) {
- return false;
+ return;
}
final String manifest =
getStaticManifest(launcher, repoDir, listener.getLogger());
@@ -463,10 +636,11 @@ public boolean checkout(
final RevisionState previousState =
getLastState(previousBuild, expandedBranch);
- ChangeLog.saveChangeLog(currentState, previousState, changelogFile,
- launcher, repoDir, showAllChanges);
+ if (changelogFile != null) {
+ ChangeLog.saveChangeLog(currentState, previousState, changelogFile,
+ launcher, repoDir, showAllChanges);
+ }
build.addAction(new TagAction(build));
- return true;
}
private int doSync(final Launcher launcher, final FilePath workspace,
@@ -652,6 +826,19 @@ public DescriptorImpl getDescriptor() {
return (DescriptorImpl) super.getDescriptor();
}
+ @Nonnull
+ @Override
+ public String getKey() {
+ return new StringBuilder("repo")
+ .append(' ')
+ .append(getManifestRepositoryUrl())
+ .append(' ')
+ .append(getManifestFile())
+ .append(' ')
+ .append(getManifestBranch())
+ .toString();
+ }
+
/**
* A DescriptorImpl contains variables used server-wide. In our263 case, we
* only store the path to the repo executable, which defaults to just
@@ -709,5 +896,10 @@ public String getExecutable() {
return repoExecutable;
}
}
+
+ @Override
+ public boolean isApplicable(final Job project) {
+ return true;
+ }
}
}
From cf19c9febaf8b8e389a1502a78a475700ad73a30 Mon Sep 17 00:00:00 2001
From: Francois Ferrand
Date: Tue, 22 Dec 2015 11:44:26 +0100
Subject: [PATCH 065/184] Throw exception to report checkout error.
This is required to properly report failure from Workflow.
---
src/main/java/hudson/plugins/repo/RepoScm.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 8f10b39..23f552e 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -620,7 +620,7 @@ public void checkout(
EnvVars env = build.getEnvironment(listener);
env = getEnvVars(env, job);
if (!checkoutCode(launcher, repoDir, env, listener.getLogger())) {
- return;
+ throw new IOException("Could not checkout");
}
final String manifest =
getStaticManifest(launcher, repoDir, listener.getLogger());
From b03ca0ca414e57cb4230c1749c373786a7087c01 Mon Sep 17 00:00:00 2001
From: Francois Ferrand
Date: Wed, 6 Jan 2016 16:59:10 +0100
Subject: [PATCH 066/184] Remove unnecessary @CheckForNull annotation.
---
src/main/java/hudson/plugins/repo/RepoScm.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 23f552e..44e7745 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -399,7 +399,7 @@ public void setMirrorDir(@CheckForNull final String mirrorDir) {
* this is 0 or negative the jobs parameter is not specified.
*/
@DataBoundSetter
- public void setJobs(@CheckForNull final int jobs) {
+ public void setJobs(final int jobs) {
this.jobs = jobs;
}
@@ -411,7 +411,7 @@ public void setJobs(@CheckForNull final int jobs) {
* and the full history is synced.
*/
@DataBoundSetter
- public void setDepth(@CheckForNull final int depth) {
+ public void setDepth(final int depth) {
this.depth = depth;
}
@@ -449,7 +449,7 @@ public void setDestinationDir(@CheckForNull final String destinationDir) {
* "repo sync".
*/
@DataBoundSetter
- public void setCurrentBranch(@CheckForNull final boolean currentBranch) {
+ public void setCurrentBranch(final boolean currentBranch) {
this.currentBranch = currentBranch;
}
@@ -461,7 +461,7 @@ public void setCurrentBranch(@CheckForNull final boolean currentBranch) {
* before syncing.
*/
@DataBoundSetter
- public void setResetFirst(@CheckForNull final boolean resetFirst) {
+ public void setResetFirst(final boolean resetFirst) {
this.resetFirst = resetFirst;
}
@@ -473,7 +473,7 @@ public void setResetFirst(@CheckForNull final boolean resetFirst) {
* "repo sync".
*/
@DataBoundSetter
- public void setQuiet(@CheckForNull final boolean quiet) {
+ public void setQuiet(final boolean quiet) {
this.quiet = quiet;
}
@@ -486,7 +486,7 @@ public void setQuiet(@CheckForNull final boolean quiet) {
*/
@DataBoundSetter
- public void setTrace(@CheckForNull final boolean trace) {
+ public void setTrace(final boolean trace) {
this.trace = trace;
}
@@ -498,7 +498,7 @@ public void setTrace(@CheckForNull final boolean trace) {
* "git log" when determining changesets.
*/
@DataBoundSetter
- public void setShowAllChanges(@CheckForNull final boolean showAllChanges) {
+ public void setShowAllChanges(final boolean showAllChanges) {
this.showAllChanges = showAllChanges;
}
@@ -521,7 +521,7 @@ public void setRepoUrl(@CheckForNull final String repoUrl) {
* executing "repo sync".
*/
@DataBoundSetter
- public void setForceSync(@CheckForNull final boolean forceSync) {
+ public void setForceSync(final boolean forceSync) {
this.forceSync = forceSync;
}
From 12adcba6bb3ba2222113cf44be15fb097afb1897 Mon Sep 17 00:00:00 2001
From: Francois Ferrand
Date: Tue, 19 Jan 2016 16:30:25 +0100
Subject: [PATCH 067/184] Explicitely set default values in constructor.
---
src/main/java/hudson/plugins/repo/RepoScm.java | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 44e7745..4e13898 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -339,6 +339,22 @@ public RepoScm(final String manifestRepositoryUrl,
@DataBoundConstructor
public RepoScm(final String manifestRepositoryUrl) {
this.manifestRepositoryUrl = manifestRepositoryUrl;
+ manifestFile = null;
+ manifestGroup = null;
+ repoUrl = null;
+ mirrorDir = null;
+ manifestBranch = null;
+ jobs = 0;
+ depth = 0;
+ localManifest = null;
+ destinationDir = null;
+ currentBranch = false;
+ resetFirst = false;
+ quiet = false;
+ forceSync = false;
+ trace = false;
+ showAllChanges = false;
+ noTags = false;
}
/**
From e2eaff628e1d28f1b244a7982819484f3db55cb5 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Thu, 21 Jan 2016 16:36:23 +0100
Subject: [PATCH 068/184] [maven-release-plugin] prepare release repo-1.9.0
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index e0420fc..b566c13 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.8.1-SNAPSHOT
+ 1.9.0
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -118,7 +118,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.9.0
From 71446a3b94d7f287bcc0eaf72fd3fced600db4ac Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Thu, 21 Jan 2016 16:36:28 +0100
Subject: [PATCH 069/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index b566c13..9090a80 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.9.0
+ 1.9.1-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -118,7 +118,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.9.0
+ HEAD
From fd0763a74f06fcfefde9fefe9e26252a29652105 Mon Sep 17 00:00:00 2001
From: Alexander Solganik
Date: Fri, 13 Mar 2015 11:22:23 +0200
Subject: [PATCH 070/184] adding an option to ignore specific projects on scm
poll.
---
.../java/hudson/plugins/repo/RepoScm.java | 60 ++++++++++++++++++-
.../hudson/plugins/repo/RepoScm/config.jelly | 4 ++
src/main/webapp/help-ignoreChanges.html | 6 ++
.../java/hudson/plugins/repo/TestRepoScm.java | 53 ++++++++++++++++
4 files changed, 122 insertions(+), 1 deletion(-)
create mode 100644 src/main/webapp/help-ignoreChanges.html
create mode 100644 src/test/java/hudson/plugins/repo/TestRepoScm.java
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 4e13898..bce8951 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -30,7 +30,11 @@
import java.io.Serializable;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -97,6 +101,7 @@ public class RepoScm extends SCM implements Serializable {
@CheckForNull private boolean trace;
@CheckForNull private boolean showAllChanges;
@CheckForNull private boolean noTags;
+ @CheckForNull private Set ignoreProjects;
/**
* Returns the manifest repository URL.
@@ -221,6 +226,14 @@ public String getDestinationDir() {
return destinationDir;
}
+ /**
+ * returns list of ignore projects.
+ */
+ @Exported
+ public String getIgnoreProjects() {
+ return StringUtils.join(ignoreProjects, '\n');
+ }
+
/**
* Returns the value of currentBranch.
*/
@@ -300,6 +313,7 @@ public boolean isForceSync() {
* executing "repo init" and "repo sync".
* @param showAllChanges If this value is true, add the "--first-parent" option to
* "git log" when determining changesets.
+ *
*/
@Deprecated
public RepoScm(final String manifestRepositoryUrl,
@@ -328,6 +342,7 @@ public RepoScm(final String manifestRepositoryUrl,
setTrace(trace);
setShowAllChanges(showAllChanges);
setRepoUrl(repoUrl);
+ ignoreProjects = Collections.emptySet();
}
/**
@@ -355,6 +370,7 @@ public RepoScm(final String manifestRepositoryUrl) {
trace = false;
showAllChanges = false;
noTags = false;
+ ignoreProjects = Collections.emptySet();
}
/**
@@ -553,6 +569,23 @@ public final void setNoTags(final boolean noTags) {
this.noTags = noTags;
}
+ /**
+ * Sets list of projects which changes will be ignored when
+ * calculating whether job needs to be rebuild. This field corresponds
+ * to serverpath i.e. "name" section of the manifest.
+ * @param ignoreProjects
+ * String representing project names separated by " ".
+ */
+ @DataBoundSetter
+ public final void setIgnoreProjects(final String ignoreProjects) {
+ if (ignoreProjects == null) {
+ this.ignoreProjects = Collections.emptySet();
+ return;
+ }
+ this.ignoreProjects = new LinkedHashSet(
+ Arrays.asList(ignoreProjects.split("\\s+")));
+ }
+
@Override
public SCMRevisionState calcRevisionsFromBuild(
@Nonnull final Run, ?> build, @Nullable final FilePath workspace,
@@ -565,6 +598,26 @@ public SCMRevisionState calcRevisionsFromBuild(
return null;
}
+ private boolean shouldIgnoreChanges(final RevisionState current, final RevisionState baseline) {
+ List changedProjects = current.whatChanged(baseline);
+ if ((changedProjects == null) || (ignoreProjects == null)) {
+ return false;
+ }
+ if (ignoreProjects.isEmpty()) {
+ return false;
+ }
+
+
+ // Check for every changed item if it is not contained in the
+ // ignored setting .. project must be rebuilt
+ for (ProjectState changed : changedProjects) {
+ if (!ignoreProjects.contains(changed.getServerPath())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
@Override
public PollingResult compareRemoteRevisionWith(
@Nonnull final Job, ?> job, @Nullable final Launcher launcher,
@@ -605,11 +658,16 @@ public PollingResult compareRemoteRevisionWith(
getStaticManifest(launcher, repoDir, listener.getLogger()),
getManifestRevision(launcher, repoDir, listener.getLogger()),
expandedManifestBranch, listener.getLogger());
+
final Change change;
if (currentState.equals(myBaseline)) {
change = Change.NONE;
} else {
- change = Change.SIGNIFICANT;
+ if (shouldIgnoreChanges(currentState, (RevisionState) myBaseline)) {
+ change = Change.NONE;
+ } else {
+ change = Change.SIGNIFICANT;
+ }
}
return new PollingResult(myBaseline, currentState, change);
}
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index f09d440..a866851 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -23,6 +23,10 @@
+
+
+
+
diff --git a/src/main/webapp/help-ignoreChanges.html b/src/main/webapp/help-ignoreChanges.html
new file mode 100644
index 0000000..f358ce9
--- /dev/null
+++ b/src/main/webapp/help-ignoreChanges.html
@@ -0,0 +1,6 @@
+
+
+ Specify projects changes in which would not be considered a change that requires project rebuild when polling scm.
+ Project should be specified as the name in the name section of the project declaration in manifest separated by spaces.
+
+
diff --git a/src/test/java/hudson/plugins/repo/TestRepoScm.java b/src/test/java/hudson/plugins/repo/TestRepoScm.java
new file mode 100644
index 0000000..6342651
--- /dev/null
+++ b/src/test/java/hudson/plugins/repo/TestRepoScm.java
@@ -0,0 +1,53 @@
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2011, Brad Larson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package hudson.plugins.repo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+
+import junit.framework.TestCase;
+
+/**
+ * Test cases for the {@link RevisionState} class.
+ */
+public class TestRepoScm extends TestCase {
+
+
+ public void testSetIgnoredProjects() {
+ RepoScm scm = new RepoScm("http://manifesturl");
+ scm.setIgnoreProjects("");
+ assertEquals("", scm.getIgnoreProjects());
+
+ }
+
+ public void testSetIgnoredProjectsKeepsOrder() {
+ RepoScm scm = new RepoScm("http://manifesturl");
+ scm.setIgnoreProjects("projecta projectb");
+ assertEquals("projecta\nprojectb", scm.getIgnoreProjects());
+ scm.setIgnoreProjects("projectb projecta");
+ assertEquals("projectb\nprojecta", scm.getIgnoreProjects());
+ }
+}
From 72a7ce10b3986027e7bed7082ee9dd75e927a423 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Mon, 22 Feb 2016 11:51:58 +0100
Subject: [PATCH 071/184] [maven-release-plugin] prepare release repo-1.10.0
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 9090a80..899b026 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.9.1-SNAPSHOT
+ 1.10.0
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -118,7 +118,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.10.0
From 1d51aad4c1aea8943e4915fbf82d29b482849cbf Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Mon, 22 Feb 2016 11:52:04 +0100
Subject: [PATCH 072/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 899b026..f8a97f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.10.0
+ 1.10.1-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -118,7 +118,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.10.0
+ HEAD
From 57d3cd94ac028f4d928bba00052ad239ca72b06a Mon Sep 17 00:00:00 2001
From: "Kevin D. Lee"
Date: Fri, 8 Jul 2016 08:44:01 -0700
Subject: [PATCH 073/184] Fix issue with Email Ext plugin where full name was
returned instead of email
The Email Ext plugin tries to send email to the commits and the repo plugin
returns the committers full name instead of the email address. This
causes the Email Ext to send emails for "John Doe " to
"John@jenkins.com" and "Doe@jenkins.com" instead of jdoe@jenkins.com.
Fixes JENKINS-14539.
---
src/main/java/hudson/plugins/repo/ChangeLogEntry.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/hudson/plugins/repo/ChangeLogEntry.java b/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
index 324e9df..b5580e8 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
@@ -279,7 +279,7 @@ public User getAuthor() {
if (authorName == null) {
return User.getUnknown();
}
- return User.get(authorName);
+ return User.get(authorEmail);
}
@Override
From c466c96229aaab4d042bc6af858d451ec1646a31 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Mon, 11 Jul 2016 11:07:06 +0200
Subject: [PATCH 074/184] [maven-release-plugin] prepare release repo-1.10.1
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index f8a97f9..f2272e7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.10.1-SNAPSHOT
+ 1.10.1
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -118,7 +118,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.10.1
From 9ba3c47913fb7a0e17e164d4cd5688e645cb3bf7 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Mon, 11 Jul 2016 11:07:11 +0200
Subject: [PATCH 075/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index f2272e7..5f0ca1f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.10.1
+ 1.10.2-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -118,7 +118,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.10.1
+ HEAD
From 48b20863cfa4189f0bf697a5e2915e63e39e29ac Mon Sep 17 00:00:00 2001
From: Makson Lee
Date: Wed, 13 Jul 2016 11:20:43 +0800
Subject: [PATCH 076/184] Override the newer overload of parse
---
src/main/java/hudson/plugins/repo/ChangeLog.java | 10 +++++-----
.../java/hudson/plugins/repo/RepoChangeLogSet.java | 11 +++++++----
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/ChangeLog.java b/src/main/java/hudson/plugins/repo/ChangeLog.java
index 17c3e10..7406cb1 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLog.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLog.java
@@ -25,9 +25,10 @@
import hudson.FilePath;
import hudson.Launcher;
-import hudson.model.AbstractBuild;
+import hudson.model.Run;
import hudson.plugins.repo.ChangeLogEntry.ModifiedFile;
import hudson.scm.ChangeLogParser;
+import hudson.scm.RepositoryBrowser;
import hudson.util.AtomicFileWriter;
import hudson.util.IOException2;
import hudson.util.XStream2;
@@ -62,11 +63,10 @@ public class ChangeLog extends ChangeLogParser {
// require creating git commits, which will be tricky. See the git plugin
// for some possibilities.
- @SuppressWarnings("unchecked")
@Override
public RepoChangeLogSet parse(
- @SuppressWarnings("rawtypes") final AbstractBuild build,
- final File changelogFile) throws IOException, SAXException {
+ final Run build, final RepositoryBrowser> browser, final File changelogFile)
+ throws IOException, SAXException {
final List r;
final XStream2 xs = new XStream2();
final Reader reader =
@@ -79,7 +79,7 @@ public RepoChangeLogSet parse(
reader.close();
}
- return new RepoChangeLogSet(build, r);
+ return new RepoChangeLogSet(build, browser, r);
}
/**
diff --git a/src/main/java/hudson/plugins/repo/RepoChangeLogSet.java b/src/main/java/hudson/plugins/repo/RepoChangeLogSet.java
index 5f8d65a..1fd00b4 100644
--- a/src/main/java/hudson/plugins/repo/RepoChangeLogSet.java
+++ b/src/main/java/hudson/plugins/repo/RepoChangeLogSet.java
@@ -23,8 +23,9 @@
*/
package hudson.plugins.repo;
-import hudson.model.AbstractBuild;
+import hudson.model.Run;
import hudson.scm.ChangeLogSet;
+import hudson.scm.RepositoryBrowser;
import java.util.Iterator;
import java.util.List;
@@ -42,13 +43,15 @@ public class RepoChangeLogSet extends ChangeLogSet {
*
* @param build
* The build which caused this change log.
+ * @param browser
+ * Repository browser.
* @param logs
* a list of RepoChangeLogEntry, containing every change (commit)
* which has occurred since the last build.
*/
- protected RepoChangeLogSet(final AbstractBuild, ?> build,
- final List logs) {
- super(build);
+ protected RepoChangeLogSet(final Run build,
+ final RepositoryBrowser> browser, final List logs) {
+ super(build, browser);
this.logs = logs;
for (final ChangeLogEntry log : logs) {
log.setParent(this);
From 8c014ab3ee894d6aefc59b39ded1cac83bba562a Mon Sep 17 00:00:00 2001
From: Makson Lee
Date: Wed, 13 Jul 2016 14:25:05 +0800
Subject: [PATCH 077/184] Replace deprecated method for pipeline compability
---
src/main/java/hudson/plugins/repo/TagAction.java | 2 +-
src/main/resources/hudson/plugins/repo/TagAction/tagForm.jelly | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/TagAction.java b/src/main/java/hudson/plugins/repo/TagAction.java
index 1b80287..13c8110 100644
--- a/src/main/java/hudson/plugins/repo/TagAction.java
+++ b/src/main/java/hudson/plugins/repo/TagAction.java
@@ -84,7 +84,7 @@ public boolean isTagged() {
*/
public String getManifest() {
final RevisionState revisionState =
- getBuild().getAction(RevisionState.class);
+ getRun().getAction(RevisionState.class);
final String manifest = revisionState.getManifest();
return manifest;
}
diff --git a/src/main/resources/hudson/plugins/repo/TagAction/tagForm.jelly b/src/main/resources/hudson/plugins/repo/TagAction/tagForm.jelly
index f701fee..5e07cb5 100644
--- a/src/main/resources/hudson/plugins/repo/TagAction/tagForm.jelly
+++ b/src/main/resources/hudson/plugins/repo/TagAction/tagForm.jelly
@@ -7,7 +7,7 @@
xmlns:f="/lib/form">
-
+
Repo Manifest - Build #${it.build.number}
To recreate this build, copy the below manifest and past it to .repo/manifest.xml, then run 'repo sync'.
From 0c76194476e4ea74183a0a00f805f80fc18c14e6 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Wed, 13 Jul 2016 11:11:38 +0200
Subject: [PATCH 078/184] Update maintainers
---
pom.xml | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
index 5f0ca1f..9680dd1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,6 +23,15 @@
+
+ rsandell
+ Robert Sandell
+ rsandell@cloudbees.com
+
+ babysitter
+
+ +1
+
aep
Arvid E. Picciani
@@ -92,7 +101,7 @@
-
+
UTF-8
UTF-8
@@ -113,7 +122,7 @@
http://maven.jenkins-ci.org:8081/content/repositories/releases/
-
+
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
@@ -135,6 +144,4 @@
http://repo.jenkins-ci.org/public/
-
-
-
+
From 10ed50104a8348e931b60acc5abfeb3106c5b5d9 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Wed, 13 Jul 2016 11:15:26 +0200
Subject: [PATCH 079/184] [maven-release-plugin] prepare release repo-1.10.2
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 9680dd1..2e51bee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.10.2-SNAPSHOT
+ 1.10.2
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.10.2
From 5e75ad4ae106bbaac73bedb39c15d4f228743b0b Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Wed, 13 Jul 2016 11:15:31 +0200
Subject: [PATCH 080/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 2e51bee..c317b7f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.10.2
+ 1.10.3-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.10.2
+ HEAD
From 1c38924c9c4a874c010920bb18485cea62b5c553 Mon Sep 17 00:00:00 2001
From: Martin Nonnenmacher
Date: Mon, 15 Aug 2016 16:20:32 +0200
Subject: [PATCH 081/184] Fix Javadoc of RepoScm#getEnvVars
The Javadoc was not updated when the method was changed in fc2c8d1.
---
src/main/java/hudson/plugins/repo/RepoScm.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index bce8951..9c8c3dc 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -121,8 +121,9 @@ public String getManifestBranch() {
}
/**
- * Same as {@link #getManifestBranch()} but with default
- * values of parameters expanded.
+ * Merge the provided environment with the default values of
+ * the project parameters. The values from the provided environment
+ * take precedence.
* @param environment an existing environment, which contains already
* properties from the current build
* @param project the project that is being built
From e8dc1122e9c5ec96f1780b9b1c3eca6af42cf79f Mon Sep 17 00:00:00 2001
From: Martin Nonnenmacher
Date: Mon, 15 Aug 2016 16:30:13 +0200
Subject: [PATCH 082/184] [FIXED JENKINS-37416] Expand local manifest value
Apply the variable expansion added in fc2c8d1 also to the local manifest.
---
src/main/java/hudson/plugins/repo/RepoScm.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 9c8c3dc..527a774 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -814,10 +814,11 @@ private boolean checkoutCode(final Launcher launcher,
FilePath lm = rdir.child("local_manifest.xml");
lm.delete();
if (localManifest != null) {
- if (localManifest.startsWith("
Date: Thu, 18 Aug 2016 13:10:55 +0200
Subject: [PATCH 083/184] update distribution management
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index c317b7f..46f0cce 100644
--- a/pom.xml
+++ b/pom.xml
@@ -119,7 +119,7 @@
maven.jenkins-ci.org
- http://maven.jenkins-ci.org:8081/content/repositories/releases/
+ https://repo.jenkins-ci.org/releases
From 3a52e23a687926d7dd79e381ef2c727fc59f9f29 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Thu, 18 Aug 2016 13:12:30 +0200
Subject: [PATCH 084/184] [maven-release-plugin] prepare release repo-1.10.3
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 46f0cce..bd33ea6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.10.3-SNAPSHOT
+ 1.10.3
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.10.3
From 3383a75d9aaf308d93d6196b5a9750dbff33fa67 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Thu, 18 Aug 2016 13:12:36 +0200
Subject: [PATCH 085/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index bd33ea6..264c6f0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.10.3
+ 1.10.4-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.10.3
+ HEAD
From 62e2b677da3d1d101383f90e98c48132560490c3 Mon Sep 17 00:00:00 2001
From: Martin Nonnenmacher
Date: Wed, 14 Sep 2016 13:51:08 +0200
Subject: [PATCH 086/184] Fix typos in local manifest help
---
src/main/webapp/help-localManifest.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/webapp/help-localManifest.html b/src/main/webapp/help-localManifest.html
index 13f3dcf..dc59983 100644
--- a/src/main/webapp/help-localManifest.html
+++ b/src/main/webapp/help-localManifest.html
@@ -1,7 +1,7 @@
The contents of .repo/local_manifest.xml. This is written prior to
-callinging sync. The default is to not use a local_manifest.txt file.
+calling sync. The default is to not use a local_manifest.xml file.
The contents may be given here literally, as XML; see the example below.
Such literal content must start with the
From b760e06a9db62e6f1f2ce7d564b642959411a32f Mon Sep 17 00:00:00 2001
From: Thomas Keller
Date: Fri, 28 Oct 2016 17:47:13 +0200
Subject: [PATCH 087/184] JENKINS-36703: Fix polling behaviour
Properly return SCMRevisionState.NONE and handle the cases when
we get this back from the API.
---
.../java/hudson/plugins/repo/RepoScm.java | 25 ++++++++++++-------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 527a774..8fa29c6 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -596,7 +596,7 @@ public SCMRevisionState calcRevisionsFromBuild(
// be called often. However it will be called if this is the first
// build, if a build was aborted before it reported the repository
// state, etc.
- return null;
+ return SCMRevisionState.NONE;
}
private boolean shouldIgnoreChanges(final RevisionState current, final RevisionState baseline) {
@@ -630,10 +630,10 @@ public PollingResult compareRemoteRevisionWith(
final String expandedManifestBranch = env.expand(manifestBranch);
final Run, ?> lastRun = job.getLastBuild();
- if (myBaseline == null) {
+ if (myBaseline == SCMRevisionState.NONE) {
// Probably the first build, or possibly an aborted build.
myBaseline = getLastState(lastRun, expandedManifestBranch);
- if (myBaseline == null) {
+ if (myBaseline == SCMRevisionState.NONE) {
return PollingResult.BUILD_NOW;
}
}
@@ -664,7 +664,8 @@ public PollingResult compareRemoteRevisionWith(
if (currentState.equals(myBaseline)) {
change = Change.NONE;
} else {
- if (shouldIgnoreChanges(currentState, (RevisionState) myBaseline)) {
+ if (shouldIgnoreChanges(currentState,
+ myBaseline instanceof RevisionState ? (RevisionState) myBaseline : null)) {
change = Change.NONE;
} else {
change = Change.SIGNIFICANT;
@@ -708,12 +709,17 @@ public void checkout(
build.addAction(currentState);
final Run previousBuild = build.getPreviousBuild();
- final RevisionState previousState =
+ final SCMRevisionState previousState =
getLastState(previousBuild, expandedBranch);
if (changelogFile != null) {
- ChangeLog.saveChangeLog(currentState, previousState, changelogFile,
- launcher, repoDir, showAllChanges);
+ ChangeLog.saveChangeLog(
+ currentState,
+ previousState == SCMRevisionState.NONE ? null : (RevisionState) previousState,
+ changelogFile,
+ launcher,
+ repoDir,
+ showAllChanges);
}
build.addAction(new TagAction(build));
}
@@ -876,10 +882,11 @@ private String getManifestRevision(final Launcher launcher,
return manifestText;
}
- private RevisionState getLastState(final Run, ?> lastBuild,
+ @Nonnull
+ private SCMRevisionState getLastState(final Run, ?> lastBuild,
final String expandedManifestBranch) {
if (lastBuild == null) {
- return null;
+ return RevisionState.NONE;
}
final RevisionState lastState =
lastBuild.getAction(RevisionState.class);
From ae08c754dd451a16f735a9173178b84932769c1d Mon Sep 17 00:00:00 2001
From: Thomas Keller
Date: Fri, 28 Oct 2016 17:49:07 +0200
Subject: [PATCH 088/184] Some stylistic / NPE / safeguard changes.
---
.../java/hudson/plugins/repo/ChangeLog.java | 23 +++++++++++--------
.../hudson/plugins/repo/ChangeLogEntry.java | 20 ++++++++--------
.../hudson/plugins/repo/ProjectState.java | 8 +++----
.../hudson/plugins/repo/RepoChangeLogSet.java | 6 ++---
.../java/hudson/plugins/repo/RepoScm.java | 6 ++---
.../hudson/plugins/repo/RevisionState.java | 18 +++++++++------
.../java/hudson/plugins/repo/TagAction.java | 3 +--
7 files changed, 44 insertions(+), 40 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/ChangeLog.java b/src/main/java/hudson/plugins/repo/ChangeLog.java
index 7406cb1..259c2ee 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLog.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLog.java
@@ -30,7 +30,6 @@
import hudson.scm.ChangeLogParser;
import hudson.scm.RepositoryBrowser;
import hudson.util.AtomicFileWriter;
-import hudson.util.IOException2;
import hudson.util.XStream2;
import java.io.BufferedReader;
@@ -50,11 +49,14 @@
import com.thoughtworks.xstream.io.StreamException;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
/**
* Utility functions to generate and parse a file listing the differences
* between builds. Differences are saved as a list of ChangeLogEntry.
*/
-public class ChangeLog extends ChangeLogParser {
+class ChangeLog extends ChangeLogParser {
private static Logger debug =
Logger.getLogger("hudson.plugins.repo.ChangeLog");
@@ -64,6 +66,7 @@ public class ChangeLog extends ChangeLogParser {
// for some possibilities.
@Override
+ @SuppressWarnings("unchecked")
public RepoChangeLogSet parse(
final Run build, final RepositoryBrowser> browser, final File changelogFile)
throws IOException, SAXException {
@@ -103,9 +106,9 @@ public RepoChangeLogSet parse(
* is thrown if we are interrupted while waiting on the git
* commands to run in a forked process.
*/
- public static List generateChangeLog(
- final RevisionState currentState,
- final RevisionState previousState, final Launcher launcher,
+ private static List generateChangeLog(
+ @Nonnull final RevisionState currentState,
+ @Nullable final RevisionState previousState, final Launcher launcher,
final FilePath workspace, final boolean showAllChanges)
throws IOException,
InterruptedException {
@@ -238,10 +241,10 @@ public static List generateChangeLog(
* is thrown if we are interrupted while waiting on the git
* commands to run in a forked process.
*/
- public static void saveChangeLog(final RevisionState currentState,
- final RevisionState previousState, final File changelogFile,
- final Launcher launcher, final FilePath workspace,
- final boolean showAllChanges)
+ static void saveChangeLog(@Nonnull final RevisionState currentState,
+ @Nullable final RevisionState previousState, final File changelogFile,
+ final Launcher launcher, final FilePath workspace,
+ final boolean showAllChanges)
throws IOException, InterruptedException {
List logs =
generateChangeLog(currentState, previousState, launcher,
@@ -259,7 +262,7 @@ public static void saveChangeLog(final RevisionState currentState,
xs.toXML(logs, w);
w.commit();
} catch (final StreamException e) {
- throw new IOException2(e);
+ throw new IOException("Could not save changelog", e);
} finally {
w.close();
}
diff --git a/src/main/java/hudson/plugins/repo/ChangeLogEntry.java b/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
index b5580e8..12aa8f1 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
@@ -36,21 +36,21 @@
* A POJO containing information about a single change (git commit) in a git
* repository. These objects are used to build the change log page.
*/
-public class ChangeLogEntry extends ChangeLogSet.Entry {
+class ChangeLogEntry extends ChangeLogSet.Entry {
/**
* A POJO containing information about a modified file. A RepoChangeLogEntry
* contains a list of ModifiedFiles. We track the file path and how it was
* modified (added, edited, removed, etc).
*/
- public static class ModifiedFile implements AffectedFile {
+ static class ModifiedFile implements AffectedFile {
/**
* An EditType for a Renamed file. Most version control systems don't
* support file renames, so this EditType isn't in the default set
* provided by Hudson.
*/
- public static final EditType RENAME = new EditType("rename",
+ static final EditType RENAME = new EditType("rename",
"The file was renamed");
private final String path;
@@ -65,7 +65,7 @@ public static class ModifiedFile implements AffectedFile {
* the action performed on the file, as reported by Git (A
* for add, D for delete, M for modified, etc)
*/
- public ModifiedFile(final String path, final char action) {
+ ModifiedFile(final String path, final char action) {
this.path = path;
this.action = action;
}
@@ -145,12 +145,12 @@ public EditType getEditType() {
// CS IGNORE ParameterNumber FOR NEXT 16 LINES. REASON: I've got no
// better ideas. Passing in all the variables here makes sense to me, even
// if it is ugly.
- public ChangeLogEntry(final String path, final String serverPath,
- final String revision, final String authorName,
- final String authorEmail, final String authorDate,
- final String committerName, final String committerEmail,
- final String committerDate, final String commitText,
- final List modifiedFiles) {
+ ChangeLogEntry(final String path, final String serverPath,
+ final String revision, final String authorName,
+ final String authorEmail, final String authorDate,
+ final String committerName, final String committerEmail,
+ final String committerDate, final String commitText,
+ final List modifiedFiles) {
this.path = path;
this.serverPath = serverPath;
this.revision = revision;
diff --git a/src/main/java/hudson/plugins/repo/ProjectState.java b/src/main/java/hudson/plugins/repo/ProjectState.java
index d41fb9c..8557bd7 100644
--- a/src/main/java/hudson/plugins/repo/ProjectState.java
+++ b/src/main/java/hudson/plugins/repo/ProjectState.java
@@ -33,7 +33,7 @@
* when projects have changed. A repo manifest contains a list of projects, and
* a build in Hudson has a list of ProjectStates.
*/
-public final class ProjectState {
+final class ProjectState {
private final String path;
private final String serverPath;
@@ -57,7 +57,7 @@ public final class ProjectState {
* @param revision
* The SHA-1 revision of the project
*/
- public static synchronized ProjectState constructCachedInstance(
+ static synchronized ProjectState constructCachedInstance(
final String path, final String serverPath, final String revision) {
ProjectState projectState
= projectStateCache.get(
@@ -156,8 +156,8 @@ public int hashCode() {
* @param revision
* The SHA-1 revision of the project
*/
- public static int calculateHashCode(final String path,
- final String serverPath, final String revision) {
+ private static int calculateHashCode(final String path,
+ final String serverPath, final String revision) {
return 23 + (path == null ? 37 : path.hashCode())
+ (serverPath == null ? 97 : serverPath.hashCode())
+ (revision == null ? 389 : revision.hashCode());
diff --git a/src/main/java/hudson/plugins/repo/RepoChangeLogSet.java b/src/main/java/hudson/plugins/repo/RepoChangeLogSet.java
index 1fd00b4..9e92122 100644
--- a/src/main/java/hudson/plugins/repo/RepoChangeLogSet.java
+++ b/src/main/java/hudson/plugins/repo/RepoChangeLogSet.java
@@ -34,7 +34,7 @@
* A ChangeLogSet, which is used when generating the list of changes from one
* build to the next.
*/
-public class RepoChangeLogSet extends ChangeLogSet {
+class RepoChangeLogSet extends ChangeLogSet {
private final List logs;
/**
@@ -49,8 +49,8 @@ public class RepoChangeLogSet extends ChangeLogSet {
* a list of RepoChangeLogEntry, containing every change (commit)
* which has occurred since the last build.
*/
- protected RepoChangeLogSet(final Run build,
- final RepositoryBrowser> browser, final List logs) {
+ RepoChangeLogSet(final Run build,
+ final RepositoryBrowser> browser, final List logs) {
super(build, browser);
this.logs = logs;
for (final ChangeLogEntry log : logs) {
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 8fa29c6..1116618 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -765,10 +765,8 @@ private int doSync(final Launcher launcher, final FilePath workspace,
commands.add("--no-tags");
}
- int returnCode =
- launcher.launch().stdout(logger).pwd(workspace)
- .cmds(commands).envs(env).join();
- return returnCode;
+ return launcher.launch().stdout(logger).pwd(workspace)
+ .cmds(commands).envs(env).join();
}
private boolean checkoutCode(final Launcher launcher,
diff --git a/src/main/java/hudson/plugins/repo/RevisionState.java b/src/main/java/hudson/plugins/repo/RevisionState.java
index c96cb49..928558e 100644
--- a/src/main/java/hudson/plugins/repo/RevisionState.java
+++ b/src/main/java/hudson/plugins/repo/RevisionState.java
@@ -38,6 +38,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+import javax.annotation.Nullable;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
@@ -50,7 +51,7 @@
* It is used to see what changed from build to build.
*/
@SuppressWarnings("serial")
-public class RevisionState extends SCMRevisionState implements Serializable {
+class RevisionState extends SCMRevisionState implements Serializable {
private final String manifest;
private final Map projects =
@@ -72,8 +73,8 @@ public class RevisionState extends SCMRevisionState implements Serializable {
* @param logger
* A PrintStream for logging errors
*/
- public RevisionState(final String manifest, final String manifestRevision,
- final String branch, final PrintStream logger) {
+ RevisionState(final String manifest, final String manifestRevision,
+ final String branch, @Nullable final PrintStream logger) {
this.manifest = manifest;
this.branch = branch;
try {
@@ -84,7 +85,9 @@ public RevisionState(final String manifest, final String manifestRevision,
.parse(xmlSource);
if (!doc.getDocumentElement().getNodeName().equals("manifest")) {
- logger.println("Error - malformed manifest");
+ if (logger != null) {
+ logger.println("Error - malformed manifest");
+ }
return;
}
final NodeList projectNodes = doc.getElementsByTagName("project");
@@ -124,8 +127,9 @@ public RevisionState(final String manifest, final String manifestRevision,
} catch (final Exception e) {
- logger.println(e);
- return;
+ if (logger != null) {
+ logger.println(e);
+ }
}
}
@@ -187,7 +191,7 @@ public String getRevision(final String path) {
* @return A List of ProjectStates from the previous repo state which have
* since been updated.
*/
- public List whatChanged(final RevisionState previousState) {
+ List whatChanged(@Nullable final RevisionState previousState) {
final List changes = new ArrayList();
if (previousState == null) {
// Everything is new. The change log would include every change,
diff --git a/src/main/java/hudson/plugins/repo/TagAction.java b/src/main/java/hudson/plugins/repo/TagAction.java
index 13c8110..27dab29 100644
--- a/src/main/java/hudson/plugins/repo/TagAction.java
+++ b/src/main/java/hudson/plugins/repo/TagAction.java
@@ -85,7 +85,6 @@ public boolean isTagged() {
public String getManifest() {
final RevisionState revisionState =
getRun().getAction(RevisionState.class);
- final String manifest = revisionState.getManifest();
- return manifest;
+ return revisionState.getManifest();
}
}
From 55a7e73a47b5d5c9c4381a18f1aa0be4daff3bf0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Mennetrier?=
Date: Mon, 28 Nov 2016 14:55:58 +0100
Subject: [PATCH 089/184] Fix some repo commands
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Commands 'repo forall -c "git reset --hard"' and "repo manifest"
didn't work because environnement was not injected when command
was executed
Signed-off-by: Sébastien Mennetrier
---
.../java/hudson/plugins/repo/RepoScm.java | 20 ++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 1116618..d272ac2 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -656,8 +656,8 @@ public PollingResult compareRemoteRevisionWith(
}
final RevisionState currentState = new RevisionState(
- getStaticManifest(launcher, repoDir, listener.getLogger()),
- getManifestRevision(launcher, repoDir, listener.getLogger()),
+ getStaticManifest(launcher, repoDir, listener.getLogger(), env),
+ getManifestRevision(launcher, repoDir, listener.getLogger(), env),
expandedManifestBranch, listener.getLogger());
final Change change;
@@ -699,9 +699,9 @@ public void checkout(
throw new IOException("Could not checkout");
}
final String manifest =
- getStaticManifest(launcher, repoDir, listener.getLogger());
+ getStaticManifest(launcher, repoDir, listener.getLogger(), env);
final String manifestRevision =
- getManifestRevision(launcher, repoDir, listener.getLogger());
+ getManifestRevision(launcher, repoDir, listener.getLogger(), env);
final String expandedBranch = env.expand(manifestBranch);
final RevisionState currentState =
new RevisionState(manifest, manifestRevision, expandedBranch,
@@ -736,7 +736,7 @@ private int doSync(final Launcher launcher, final FilePath workspace,
commands.add("-c");
commands.add("git reset --hard");
int syncCode = launcher.launch().stdout(logger)
- .stderr(logger).pwd(workspace).cmds(commands).join();
+ .stderr(logger).pwd(workspace).cmds(commands).envs(env).join();
if (syncCode != 0) {
debug.log(Level.WARNING, "Failed to reset first.");
@@ -847,7 +847,8 @@ private boolean checkoutCode(final Launcher launcher,
}
private String getStaticManifest(final Launcher launcher,
- final FilePath workspace, final OutputStream logger)
+ final FilePath workspace, final OutputStream logger,
+ final EnvVars env)
throws IOException, InterruptedException {
final ByteArrayOutputStream output = new ByteArrayOutputStream();
final List commands = new ArrayList(6);
@@ -858,14 +859,15 @@ private String getStaticManifest(final Launcher launcher,
commands.add("-r");
// TODO: should we pay attention to the output from this?
launcher.launch().stderr(logger).stdout(output).pwd(workspace)
- .cmds(commands).join();
+ .cmds(commands).envs(env).join();
final String manifestText = output.toString();
debug.log(Level.FINEST, manifestText);
return manifestText;
}
private String getManifestRevision(final Launcher launcher,
- final FilePath workspace, final OutputStream logger)
+ final FilePath workspace, final OutputStream logger,
+ final EnvVars env)
throws IOException, InterruptedException {
final ByteArrayOutputStream output = new ByteArrayOutputStream();
final List commands = new ArrayList(6);
@@ -874,7 +876,7 @@ private String getManifestRevision(final Launcher launcher,
commands.add("HEAD");
launcher.launch().stderr(logger).stdout(output).pwd(
new FilePath(workspace, ".repo/manifests"))
- .cmds(commands).join();
+ .cmds(commands).envs(env).join();
final String manifestText = output.toString().trim();
debug.log(Level.FINEST, manifestText);
return manifestText;
From 9e06236565e9fe5cf6af8be52438cb9197be8144 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Tue, 29 Nov 2016 13:15:56 +0100
Subject: [PATCH 090/184] [maven-release-plugin] prepare release repo-1.10.4
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 264c6f0..f32d9fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.10.4-SNAPSHOT
+ 1.10.4
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.10.4
From 9d40fd7f68fc7e02f110b04c5c0bb9d59e737fe9 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Tue, 29 Nov 2016 13:16:02 +0100
Subject: [PATCH 091/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index f32d9fe..3d154a4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.10.4
+ 1.10.5-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.10.4
+ HEAD
From 9542a6adb40c4d68a2552d19bb34c0eaa81bc3df Mon Sep 17 00:00:00 2001
From: Makson Lee
Date: Wed, 30 Nov 2016 12:05:33 +0800
Subject: [PATCH 092/184] Make class ChangeLogEntry public so that it can be
accessed from outside the package
---
.../java/hudson/plugins/repo/ChangeLogEntry.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/ChangeLogEntry.java b/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
index 12aa8f1..c4db9a1 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
@@ -36,7 +36,7 @@
* A POJO containing information about a single change (git commit) in a git
* repository. These objects are used to build the change log page.
*/
-class ChangeLogEntry extends ChangeLogSet.Entry {
+public class ChangeLogEntry extends ChangeLogSet.Entry {
/**
* A POJO containing information about a modified file. A RepoChangeLogEntry
@@ -145,12 +145,12 @@ public EditType getEditType() {
// CS IGNORE ParameterNumber FOR NEXT 16 LINES. REASON: I've got no
// better ideas. Passing in all the variables here makes sense to me, even
// if it is ugly.
- ChangeLogEntry(final String path, final String serverPath,
- final String revision, final String authorName,
- final String authorEmail, final String authorDate,
- final String committerName, final String committerEmail,
- final String committerDate, final String commitText,
- final List modifiedFiles) {
+ public ChangeLogEntry(final String path, final String serverPath,
+ final String revision, final String authorName,
+ final String authorEmail, final String authorDate,
+ final String committerName, final String committerEmail,
+ final String committerDate, final String commitText,
+ final List modifiedFiles) {
this.path = path;
this.serverPath = serverPath;
this.revision = revision;
From a5ec11f30a7af388a4703dd4b553b2fd9256be88 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Wed, 30 Nov 2016 14:36:47 +0100
Subject: [PATCH 093/184] [maven-release-plugin] prepare release repo-1.10.5
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 3d154a4..bf13fcf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.10.5-SNAPSHOT
+ 1.10.5
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.10.5
From 3a1f82de09f18c5737158023f2d5c914865987b5 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Wed, 30 Nov 2016 14:36:52 +0100
Subject: [PATCH 094/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index bf13fcf..b02c2ff 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.10.5
+ 1.10.6-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.10.5
+ HEAD
From 44b1577b5143cf2fb930c62b08675f99d89b663e Mon Sep 17 00:00:00 2001
From: Allen Wild
Date: Fri, 6 Jan 2017 23:25:01 -0500
Subject: [PATCH 095/184] Use local_manifests/local.xml rather than
local_manifest.xml
Using .repo/local_manifest.xml has been deprecated for a while, and
prints a warning which dirtys the build log, so adopt the new convention
of .repo/local_manifests/*.xml. I arbitrarily chose "local.xml" for the
file name.
Change-Id: Iaef7077312ce8a1cb195143011ca4ebcaf9e209b
---
.../java/hudson/plugins/repo/RepoScm.java | 24 ++++++++++++-------
src/main/webapp/help-localManifest.html | 4 ++--
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index d272ac2..e423d21 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -210,8 +210,8 @@ public int getDepth() {
return depth;
}
/**
- * Returns the contents of the local_manifest.xml. By default, this is null
- * and a local_manifest.xml is neither created nor modified.
+ * Returns the contents of the local_manifests/local.xml. By default, this is null
+ * and a local_manifests/local.xml is neither created nor modified.
*/
@Exported
public String getLocalManifest() {
@@ -297,9 +297,10 @@ public boolean isForceSync() {
* @param depth This is the depth to use when syncing. By default this is 0
* and the full history is synced.
* @param localManifest May be null, a string containing XML, or an URL.
- * If XML, this string is written to .repo/local_manifest.xml
+ * If XML, this string is written to
+ * .repo/local_manifests/local.xml
* If an URL, the URL is fetched and the content is written
- * to .repo/local_manifest.xml
+ * to .repo/local_manifests/local.xml
* @param destinationDir If not null then the source is synced to the destinationDir
* subdirectory of the workspace.
* @param repoUrl If not null then use this url as repo base,
@@ -453,9 +454,9 @@ public void setDepth(final int depth) {
*
* @param localManifest
* May be null, a string containing XML, or an URL.
- * If XML, this string is written to .repo/local_manifest.xml
+ * If XML, this string is written to .repo/local_manifests/local.xml
* If an URL, the URL is fetched and the content is written
- * to .repo/local_manifest.xml
+ * to .repo/local_manifests/local.xml
*/
@DataBoundSetter
public void setLocalManifest(@CheckForNull final String localManifest) {
@@ -815,9 +816,16 @@ private boolean checkoutCode(final Launcher launcher,
}
if (workspace != null) {
FilePath rdir = workspace.child(".repo");
- FilePath lm = rdir.child("local_manifest.xml");
- lm.delete();
+ FilePath lmdir = rdir.child("local_manifests");
+ // Delete the legacy local_manifest.xml in case it exists from a previous build
+ rdir.child("local_manifest.xml").delete();
+ if (lmdir.exists()) {
+ lmdir.deleteContents();
+ } else {
+ lmdir.mkdirs();
+ }
if (localManifest != null) {
+ FilePath lm = lmdir.child("local.xml");
String expandedLocalManifest = env.expand(localManifest);
if (expandedLocalManifest.startsWith("
- The contents of .repo/local_manifest.xml. This is written prior to
-calling sync. The default is to not use a local_manifest.xml file.
+ The contents of .repo/local_manifests/local.xml. This is written prior to
+calling sync. The default is to not use a local.xml file.
The contents may be given here literally, as XML; see the example below.
Such literal content must start with the
From 268fdbf4fe9872a2f540a7819f698e8410bd6e23 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Tue, 10 Jan 2017 13:35:24 +0100
Subject: [PATCH 096/184] [maven-release-plugin] prepare release repo-1.10.6
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index b02c2ff..8d534f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.10.6-SNAPSHOT
+ 1.10.6
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.10.6
From 67e9a6aa5d5410e24174e130bb32797cd2c18edc Mon Sep 17 00:00:00 2001
From: rsandell
Date: Tue, 10 Jan 2017 13:35:32 +0100
Subject: [PATCH 097/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 8d534f9..5bd60d6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.10.6
+ 1.10.7-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.10.6
+ HEAD
From 631868e9019872dccef5a4b1ca290a05a8eb8af6 Mon Sep 17 00:00:00 2001
From: Mike Nicholson
Date: Mon, 27 Feb 2017 10:57:15 -0500
Subject: [PATCH 098/184] Update URLs to valid locations in help html.
Old URLs pointed to nonexistent locations.
---
src/main/webapp/help-executable.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/webapp/help-executable.html b/src/main/webapp/help-executable.html
index ca07b2f..36abadd 100644
--- a/src/main/webapp/help-executable.html
+++ b/src/main/webapp/help-executable.html
@@ -1,10 +1,10 @@
This is the path to the repo executable which will be called whenever repo commands
- are ran. Repo can be installed by running curl https://android.git.kernel.org/repo > ~/bin/repo
+ are ran. Repo can be installed by running curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
See more documentation about installing
- and using repo.
+ and using repo.
From b445b3d704eff6d1dc7eb40dd398966f0bba6116 Mon Sep 17 00:00:00 2001
From: Fredrik Svedberg
Date: Thu, 2 Mar 2017 15:32:15 +0100
Subject: [PATCH 099/184] Support for evaluating ${param} in destination dir
Added support for evaluating ${param} in destination dir just like
it is done for the other configuration parameters.
---
src/main/java/hudson/plugins/repo/RepoScm.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index e423d21..ce3a0df 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -641,7 +641,7 @@ public PollingResult compareRemoteRevisionWith(
FilePath repoDir;
if (destinationDir != null) {
- repoDir = workspace.child(destinationDir);
+ repoDir = workspace.child(env.expand(destinationDir));
} else {
repoDir = workspace;
}
@@ -682,9 +682,13 @@ public void checkout(
@CheckForNull final File changelogFile, @CheckForNull final SCMRevisionState baseline)
throws IOException, InterruptedException {
+ Job, ?> job = build.getParent();
+ EnvVars env = build.getEnvironment(listener);
+ env = getEnvVars(env, job);
+
FilePath repoDir;
if (destinationDir != null) {
- repoDir = workspace.child(destinationDir);
+ repoDir = workspace.child(env.expand(destinationDir));
} else {
repoDir = workspace;
}
@@ -693,9 +697,6 @@ public void checkout(
repoDir.mkdirs();
}
- Job, ?> job = build.getParent();
- EnvVars env = build.getEnvironment(listener);
- env = getEnvVars(env, job);
if (!checkoutCode(launcher, repoDir, env, listener.getLogger())) {
throw new IOException("Could not checkout");
}
From edbc588ff3499e8ae52e3e2d902a388d08b66465 Mon Sep 17 00:00:00 2001
From: Preetam D'Souza
Date: Thu, 2 Mar 2017 10:21:57 -0500
Subject: [PATCH 100/184] Fix --force-sync help description
From the repo sync help page as of the latest release v1.12.37, the
--force-sync option is used to overwrite an existing project git
directory if it needs to point to a different object directory.
Currently, the help uses the description for -f, --force-broken instead
of --force-sync.
---
src/main/webapp/help-forceSync.html | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/webapp/help-forceSync.html b/src/main/webapp/help-forceSync.html
index 85264a5..0e91f52 100644
--- a/src/main/webapp/help-forceSync.html
+++ b/src/main/webapp/help-forceSync.html
@@ -1,6 +1,7 @@
- Continue sync even if a project fails to sync
+ Overwrite an existing git directory if it needs to point to a different
+ object directory. WARNING: this may cause loss of data.
This is passed to repo as repo sync --force-sync.
From 4b04538dec48eb8af7d8b2429bc02e9b4a751cdd Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 3 Mar 2017 12:12:23 +0100
Subject: [PATCH 101/184] [maven-release-plugin] prepare release repo-1.10.7
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 5bd60d6..8115d4e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.10.7-SNAPSHOT
+ 1.10.7
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.10.7
From dc5247e34bb430de05a9c4ce25b03666c1e752e9 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 3 Mar 2017 12:12:30 +0100
Subject: [PATCH 102/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 8115d4e..33ddb94 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.jenkins-ci.plugins
repo
- 1.10.7
+ 1.10.8-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.10.7
+ HEAD
From cb54699ceafa7442c0c0522931cbaf5afb251949 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Sat, 10 Jun 2017 13:25:52 +0200
Subject: [PATCH 103/184] Change to 2.x parent pom
---
checkstyle.xml | 6 ++--
pom.xml | 29 ++++++++-----------
.../java/hudson/plugins/repo/RepoScm.java | 19 +++++++++---
.../repo/RepoChangeLogSet/digest.jelly | 3 +-
.../plugins/repo/RepoChangeLogSet/index.jelly | 1 +
.../hudson/plugins/repo/RepoScm/config.jelly | 1 +
.../hudson/plugins/repo/RepoScm/global.jelly | 1 +
.../hudson/plugins/repo/TagAction/badge.jelly | 1 +
.../plugins/repo/TagAction/tagForm.jelly | 3 +-
src/main/resources/index.jelly | 1 +
10 files changed, 39 insertions(+), 26 deletions(-)
diff --git a/checkstyle.xml b/checkstyle.xml
index cb4ef41..d589e86 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -69,7 +69,7 @@ Checkstyle configuration that checks coding conventions.
-
+
@@ -83,9 +83,9 @@ Checkstyle configuration that checks coding conventions.
-
+
diff --git a/pom.xml b/pom.xml
index 33ddb94..8283cf2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,8 @@
org.jenkins-ci.plugins
plugin
- 1.580.1
+ 2.30
+
org.jenkins-ci.plugins
@@ -14,6 +15,13 @@
Integrates Jenkins with REPO SCM
http://wiki.jenkins-ci.org/display/JENKINS/Repo+Plugin
+
+ 1.580.1
+ 6
+ UTF-8
+ UTF-8
+
+
MIT
@@ -66,18 +74,10 @@
-
- org.apache.maven.plugins
- maven-release-plugin
- 2.5.1
-
- deploy
-
-
org.apache.maven.plugins
maven-checkstyle-plugin
- 2.6
+ 2.17
checkstyle.xml
true
@@ -102,18 +102,13 @@
-
- UTF-8
- UTF-8
-
-
-
+
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index ce3a0df..7f7dd02 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -246,12 +246,18 @@ public boolean isCurrentBranch() {
* Returns the value of resetFirst.the initial manifest file name.
*/
@Exported
- public boolean isResetFirst() { return resetFirst; }
+ public boolean isResetFirst() {
+ return resetFirst;
+ }
+
/**
* Returns the value of showAllChanges.
*/
@Exported
- public boolean isShowAllChanges() { return showAllChanges; }
+ public boolean isShowAllChanges() {
+ return showAllChanges;
+ }
+
/**
* Returns the value of quiet.
*/
@@ -266,16 +272,21 @@ public boolean isQuiet() {
public boolean isForceSync() {
return forceSync;
}
+
/**
* Returns the value of trace.
*/
@Exported
- public boolean isTrace() { return trace; }
+ public boolean isTrace() {
+ return trace;
+ }
/**
* Returns the value of noTags.
*/
@Exported
- public boolean isNoTags() { return noTags; }
+ public boolean isNoTags() {
+ return noTags;
+ }
/**
* The constructor takes in user parameters and sets them. Each job using
diff --git a/src/main/resources/hudson/plugins/repo/RepoChangeLogSet/digest.jelly b/src/main/resources/hudson/plugins/repo/RepoChangeLogSet/digest.jelly
index aa7caf2..2cf7313 100644
--- a/src/main/resources/hudson/plugins/repo/RepoChangeLogSet/digest.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoChangeLogSet/digest.jelly
@@ -1,3 +1,4 @@
+
- ${cs.msgAnnotated}
+
-- ${cs.author} /
detail
diff --git a/src/main/resources/hudson/plugins/repo/RepoChangeLogSet/index.jelly b/src/main/resources/hudson/plugins/repo/RepoChangeLogSet/index.jelly
index 1ebfe8b..1f3f752 100644
--- a/src/main/resources/hudson/plugins/repo/RepoChangeLogSet/index.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoChangeLogSet/index.jelly
@@ -1,3 +1,4 @@
+
diff --git a/src/main/resources/hudson/plugins/repo/TagAction/tagForm.jelly b/src/main/resources/hudson/plugins/repo/TagAction/tagForm.jelly
index 5e07cb5..b3df949 100644
--- a/src/main/resources/hudson/plugins/repo/TagAction/tagForm.jelly
+++ b/src/main/resources/hudson/plugins/repo/TagAction/tagForm.jelly
@@ -1,4 +1,5 @@
-
+
This plugin allows use of
repo as
an SCM tool. A repo binary is required.
From 9ac9af8bc57639e53f6ff33664bbf30aa772a098 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Sat, 10 Jun 2017 13:35:57 +0200
Subject: [PATCH 104/184] Bump minimum core to last 1.x lts
At least we move to somewhat newer core and we want java 7
---
pom.xml | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/pom.xml b/pom.xml
index 8283cf2..7e5d924 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,8 +16,8 @@
http://wiki.jenkins-ci.org/display/JENKINS/Repo+Plugin
- 1.580.1
- 6
+ 1.651.3
+ 7
UTF-8
UTF-8
@@ -103,12 +103,7 @@
-
+
From 9c7e81cbf0f0ff6414df31a5b782805c8725012a Mon Sep 17 00:00:00 2001
From: Florent Vial
Date: Tue, 23 May 2017 17:04:02 +0200
Subject: [PATCH 105/184] Add cleanup functionality
If the check box 'Clean first' is activated, repo forall 'git clean -fdx' will be executed first.
* added unit tests
* fixed typos in code
---
.../java/hudson/plugins/repo/RepoScm.java | 39 +++++++++++++++++--
.../hudson/plugins/repo/RepoScm/config.jelly | 3 ++
src/main/webapp/help-cleanFirst.html | 5 +++
.../java/hudson/plugins/repo/TestRepoScm.java | 14 +++++++
4 files changed, 58 insertions(+), 3 deletions(-)
create mode 100644 src/main/webapp/help-cleanFirst.html
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index ce3a0df..3920303 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -96,6 +96,7 @@ public class RepoScm extends SCM implements Serializable {
@CheckForNull private String destinationDir;
@CheckForNull private boolean currentBranch;
@CheckForNull private boolean resetFirst;
+ @CheckForNull private boolean cleanFirst;
@CheckForNull private boolean quiet;
@CheckForNull private boolean forceSync;
@CheckForNull private boolean trace;
@@ -243,10 +244,15 @@ public boolean isCurrentBranch() {
return currentBranch;
}
/**
- * Returns the value of resetFirst.the initial manifest file name.
+ * Returns the value of resetFirst.
*/
@Exported
public boolean isResetFirst() { return resetFirst; }
+ /**
+ * Returns the value of cleanFirst.
+ */
+ @Exported
+ public boolean isCleanFirst() { return cleanFirst; }
/**
* Returns the value of showAllChanges.
*/
@@ -340,6 +346,7 @@ public RepoScm(final String manifestRepositoryUrl,
setDestinationDir(destinationDir);
setCurrentBranch(currentBranch);
setResetFirst(resetFirst);
+ setCleanFirst(false);
setQuiet(quiet);
setTrace(trace);
setShowAllChanges(showAllChanges);
@@ -367,6 +374,7 @@ public RepoScm(final String manifestRepositoryUrl) {
destinationDir = null;
currentBranch = false;
resetFirst = false;
+ cleanFirst = false;
quiet = false;
forceSync = false;
trace = false;
@@ -499,6 +507,18 @@ public void setResetFirst(final boolean resetFirst) {
this.resetFirst = resetFirst;
}
+ /**
+ * Set cleanFirst.
+ *
+ * @param cleanFirst
+ * If this value is true, do "repo forall -c 'git clean -fdx'"
+ * before syncing.
+ */
+ @DataBoundSetter
+ public void setCleanFirst(final boolean cleanFirst) {
+ this.cleanFirst = cleanFirst;
+ }
+
/**
* Set quiet.
*
@@ -737,14 +757,27 @@ private int doSync(final Launcher launcher, final FilePath workspace,
commands.add("forall");
commands.add("-c");
commands.add("git reset --hard");
- int syncCode = launcher.launch().stdout(logger)
+ int resetCode = launcher.launch().stdout(logger)
.stderr(logger).pwd(workspace).cmds(commands).envs(env).join();
- if (syncCode != 0) {
+ if (resetCode != 0) {
debug.log(Level.WARNING, "Failed to reset first.");
}
commands.clear();
}
+ if (cleanFirst) {
+ commands.add(getDescriptor().getExecutable());
+ commands.add("forall");
+ commands.add("-c");
+ commands.add("git clean -fdx");
+ int cleanCode = launcher.launch().stdout(logger)
+ .stderr(logger).pwd(workspace).cmds(commands).envs(env).join();
+
+ if (cleanCode != 0) {
+ debug.log(Level.WARNING, "Failed to clean first.");
+ }
+ commands.clear();
+ }
commands.add(getDescriptor().getExecutable());
if (trace) {
commands.add("--trace");
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index a866851..7494d57 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -55,6 +55,9 @@
+
+
+
diff --git a/src/main/webapp/help-cleanFirst.html b/src/main/webapp/help-cleanFirst.html
new file mode 100644
index 0000000..a5683cb
--- /dev/null
+++ b/src/main/webapp/help-cleanFirst.html
@@ -0,0 +1,5 @@
+
+
+ When this is checked the first thing to do will be a
repo forall -c "git clean -fdx"
+
+
diff --git a/src/test/java/hudson/plugins/repo/TestRepoScm.java b/src/test/java/hudson/plugins/repo/TestRepoScm.java
index 6342651..2c1381e 100644
--- a/src/test/java/hudson/plugins/repo/TestRepoScm.java
+++ b/src/test/java/hudson/plugins/repo/TestRepoScm.java
@@ -50,4 +50,18 @@ public void testSetIgnoredProjectsKeepsOrder() {
scm.setIgnoreProjects("projectb projecta");
assertEquals("projectb\nprojecta", scm.getIgnoreProjects());
}
+
+ public void testResetFirst() {
+ RepoScm scm = new RepoScm("http://manifesturl");
+ assertEquals(false, scm.isResetFirst());
+ scm.setResetFirst(true);
+ assertEquals(true, scm.isResetFirst());
+ }
+
+ public void testCleanFirst() {
+ RepoScm scm = new RepoScm("http://manifesturl");
+ assertEquals(false, scm.isCleanFirst());
+ scm.setCleanFirst(true);
+ assertEquals(true, scm.isCleanFirst());
+ }
}
From 39d9fdf6edbbb57013e5afd485b26bc89e23fb59 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Wed, 28 Jun 2017 16:55:55 +0200
Subject: [PATCH 106/184] Created Jenkinsfile
---
Jenkinsfile | 1 +
1 file changed, 1 insertion(+)
create mode 100644 Jenkinsfile
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..5b60d43
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1 @@
+buildPlugin(platforms: ['linux'])
From 85021884930612084ef7f4b74e599534c3171225 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Thu, 29 Jun 2017 12:23:33 +0200
Subject: [PATCH 107/184] Findbugs fixes
---
.../java/hudson/plugins/repo/ChangeLog.java | 6 +++---
.../java/hudson/plugins/repo/ProjectState.java | 3 ++-
src/main/java/hudson/plugins/repo/RepoScm.java | 16 +++++++++-------
.../java/hudson/plugins/repo/RevisionState.java | 17 ++++++++---------
4 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/ChangeLog.java b/src/main/java/hudson/plugins/repo/ChangeLog.java
index 259c2ee..c3e4a16 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLog.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLog.java
@@ -38,8 +38,8 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.io.OutputStream;
import java.io.Reader;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
@@ -170,10 +170,10 @@ private static List generateChangeLog(
// is definitely preferable. Most of the code can probably be copied
// from Gerrit. It might be tricky with master/slave setup.
commands.add(change.getRevision() + ".." + newRevision);
- final OutputStream gitOutput = new ByteArrayOutputStream();
+ final ByteArrayOutputStream gitOutput = new ByteArrayOutputStream();
launcher.launch().stdout(gitOutput).pwd(gitdir).cmds(commands)
.join();
- final String o = gitOutput.toString();
+ final String o = new String(gitOutput.toByteArray(), Charset.defaultCharset());
final String[] changelogs = o.split(
"\\[\\[\\]\\]");
debug.log(Level.INFO, o);
diff --git a/src/main/java/hudson/plugins/repo/ProjectState.java b/src/main/java/hudson/plugins/repo/ProjectState.java
index 8557bd7..861dde4 100644
--- a/src/main/java/hudson/plugins/repo/ProjectState.java
+++ b/src/main/java/hudson/plugins/repo/ProjectState.java
@@ -23,6 +23,7 @@
*/
package hudson.plugins.repo;
+import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
@@ -33,7 +34,7 @@
* when projects have changed. A repo manifest contains a list of projects, and
* a build in Hudson has a list of ProjectStates.
*/
-final class ProjectState {
+final class ProjectState implements Serializable {
private final String path;
private final String serverPath;
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 7f7dd02..8181e48 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -29,6 +29,7 @@
import java.io.OutputStream;
import java.io.Serializable;
import java.net.URL;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -737,7 +738,7 @@ public void checkout(
build.addAction(new TagAction(build));
}
- private int doSync(final Launcher launcher, final FilePath workspace,
+ private int doSync(final Launcher launcher, @Nonnull final FilePath workspace,
final OutputStream logger, final EnvVars env)
throws IOException, InterruptedException {
final List commands = new ArrayList(4);
@@ -783,13 +784,13 @@ private int doSync(final Launcher launcher, final FilePath workspace,
}
private boolean checkoutCode(final Launcher launcher,
- final FilePath workspace,
+ @Nonnull final FilePath workspace,
final EnvVars env,
final OutputStream logger)
throws IOException, InterruptedException {
final List commands = new ArrayList(4);
- debug.log(Level.INFO, "Checking out code in: " + workspace.getName());
+ debug.log(Level.INFO, "Checking out code in: {0}", workspace.getName());
commands.add(getDescriptor().getExecutable());
if (trace) {
@@ -826,7 +827,7 @@ private boolean checkoutCode(final Launcher launcher,
if (returnCode != 0) {
return false;
}
- if (workspace != null) {
+ //{
FilePath rdir = workspace.child(".repo");
FilePath lmdir = rdir.child("local_manifests");
// Delete the legacy local_manifest.xml in case it exists from a previous build
@@ -846,7 +847,7 @@ private boolean checkoutCode(final Launcher launcher,
lm.copyFrom(url);
}
}
- }
+ //}
returnCode = doSync(launcher, workspace, logger, env);
if (returnCode != 0) {
@@ -880,7 +881,7 @@ private String getStaticManifest(final Launcher launcher,
// TODO: should we pay attention to the output from this?
launcher.launch().stderr(logger).stdout(output).pwd(workspace)
.cmds(commands).envs(env).join();
- final String manifestText = output.toString();
+ final String manifestText = new String(output.toByteArray(), Charset.defaultCharset());
debug.log(Level.FINEST, manifestText);
return manifestText;
}
@@ -897,7 +898,8 @@ private String getManifestRevision(final Launcher launcher,
launcher.launch().stderr(logger).stdout(output).pwd(
new FilePath(workspace, ".repo/manifests"))
.cmds(commands).envs(env).join();
- final String manifestText = output.toString().trim();
+ final String manifestText = new String(output.toByteArray(),
+ Charset.defaultCharset()).trim();
debug.log(Level.FINEST, manifestText);
return manifestText;
}
diff --git a/src/main/java/hudson/plugins/repo/RevisionState.java b/src/main/java/hudson/plugins/repo/RevisionState.java
index 928558e..b01ce53 100644
--- a/src/main/java/hudson/plugins/repo/RevisionState.java
+++ b/src/main/java/hudson/plugins/repo/RevisionState.java
@@ -33,7 +33,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -200,22 +199,22 @@ List whatChanged(@Nullable final RevisionState previousState) {
debug.log(Level.FINE, "Everything is new");
return null;
}
- final Set keys = projects.keySet();
+ //final Set keys = projects.keySet();
HashMap previousStateCopy =
new HashMap(previousState.projects);
- for (final String key : keys) {
- final ProjectState status = previousStateCopy.get(key);
+ for (final Map.Entry entry : projects.entrySet()) {
+ final ProjectState status = previousStateCopy.get(entry.getKey());
if (status == null) {
// This is a new project, just added to the manifest.
- final ProjectState newProject = projects.get(key);
- debug.log(Level.FINE, "New project: " + key);
+ final ProjectState newProject = entry.getValue();
+ debug.log(Level.FINE, "New project: {0}", entry.getKey());
changes.add(ProjectState.constructCachedInstance(
newProject.getPath(), newProject.getServerPath(),
null));
- } else if (!status.equals(projects.get(key))) {
- changes.add(previousStateCopy.get(key));
+ } else if (!status.equals(entry.getValue())) {
+ changes.add(previousStateCopy.get(entry.getKey()));
}
- previousStateCopy.remove(key);
+ previousStateCopy.remove(entry.getKey());
}
changes.addAll(previousStateCopy.values());
return changes;
From 46a7f48ebbbc9f242e80e6f835b1fbd2a9f04374 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 30 Jun 2017 16:20:25 +0200
Subject: [PATCH 108/184] Jenkinsfile run checkstyle and findbugs
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 5b60d43..d78857d 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1 +1 @@
-buildPlugin(platforms: ['linux'])
+buildPlugin(platforms: ['linux'], findbugs: [run: true, archive:true, unstableTotalAll: '0'], checkstyle: [run: true, archive:true, unstableTotalAll: '0'])
From 4b0a8543f251ed8736690b57589b62ea72422bd8 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 30 Jun 2017 16:26:09 +0200
Subject: [PATCH 109/184] Jenkinsfile run both jdk 7 and 8
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index d78857d..eacf253 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1 +1 @@
-buildPlugin(platforms: ['linux'], findbugs: [run: true, archive:true, unstableTotalAll: '0'], checkstyle: [run: true, archive:true, unstableTotalAll: '0'])
+buildPlugin(platforms: ['linux'], jdkVersions: [8,7], findbugs: [run: true, archive:true, unstableTotalAll: '0'], checkstyle: [run: true, archive:true, unstableTotalAll: '0'])
From 29180897b463cf41138ac56e895b45325be0a580 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 30 Jun 2017 16:37:12 +0200
Subject: [PATCH 110/184] Revert "Jenkinsfile run both jdk 7 and 8"
The hpi maven mojo seems to not be runnable in ldk 7 any more
This reverts commit 4b0a8543f251ed8736690b57589b62ea72422bd8.
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index eacf253..d78857d 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1 +1 @@
-buildPlugin(platforms: ['linux'], jdkVersions: [8,7], findbugs: [run: true, archive:true, unstableTotalAll: '0'], checkstyle: [run: true, archive:true, unstableTotalAll: '0'])
+buildPlugin(platforms: ['linux'], findbugs: [run: true, archive:true, unstableTotalAll: '0'], checkstyle: [run: true, archive:true, unstableTotalAll: '0'])
From d0f99713ae94c2bf13544c76792cdab3e92bf55c Mon Sep 17 00:00:00 2001
From: Magnus Ericmats
Date: Wed, 20 Dec 2017 16:53:15 +0100
Subject: [PATCH 111/184] Fix problem with populating values from config when
using pipeline
When loading the job config into the job configuration GUI, the
repo-plugin properties are empty. The config file contains the values,
but the plugin is unable to populate config values from the file.
If the user edits anything at job configuration page and saves, the
empty repo-plugin properties are written to file and are cleared!
This patch fixes the problem by populating the values from the config
file to the GUI.
---
.../hudson/plugins/repo/RepoScm/config.jelly | 72 +++++++++----------
1 file changed, 36 insertions(+), 36 deletions(-)
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index 7494d57..4695954 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -6,81 +6,81 @@
xmlns:t="/lib/hudson"
xmlns:f="/lib/form">
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
From 9e24ecffc7d0fa8a44d3d3ddcb3ac3cb9a930b40 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 20 Apr 2018 17:43:37 +0200
Subject: [PATCH 112/184] Fix checkstyle
---
src/main/java/hudson/plugins/repo/RepoScm.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index d7ed1d7..76831f4 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -256,7 +256,10 @@ public boolean isResetFirst() {
* Returns the value of cleanFirst.
*/
@Exported
- public boolean isCleanFirst() { return cleanFirst; }
+ public boolean isCleanFirst() {
+ return cleanFirst;
+ }
+
/**
* Returns the value of showAllChanges.
*/
From 9ea3e06bcc21260af31f8aedfaae08d6c87a55b0 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 20 Apr 2018 17:47:34 +0200
Subject: [PATCH 113/184] checkstyle check during test phase
---
pom.xml | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 7e5d924..63cba6e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -84,10 +84,20 @@
true
-
- check
- compile
-
+
+ compile-checkstyle
+
+ checkstyle
+
+ compile
+
+
+ test-check
+
+ check
+
+ test
+
From 48755c7118b9602bde86849cdb31deaa19e13f14 Mon Sep 17 00:00:00 2001
From: David Emett
Date: Thu, 20 Sep 2018 18:22:09 +0100
Subject: [PATCH 114/184] Fix raw diff parsing
---
.../java/hudson/plugins/repo/ChangeLog.java | 53 +++++++++++++++++--
.../hudson/plugins/repo/ChangeLogEntry.java | 43 +++------------
2 files changed, 58 insertions(+), 38 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/ChangeLog.java b/src/main/java/hudson/plugins/repo/ChangeLog.java
index c3e4a16..14bf6d0 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLog.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLog.java
@@ -28,6 +28,7 @@
import hudson.model.Run;
import hudson.plugins.repo.ChangeLogEntry.ModifiedFile;
import hudson.scm.ChangeLogParser;
+import hudson.scm.EditType;
import hudson.scm.RepositoryBrowser;
import hudson.util.AtomicFileWriter;
import hudson.util.XStream2;
@@ -197,12 +198,58 @@ private static List generateChangeLog(
final List modifiedFiles =
new ArrayList();
for (final String fileLine : fileLines) {
+ // Format of these lines is described in the "RAW OUTPUT
+ // FORMAT" section of "git diff --help"...
+ //
+ // An output line is formatted this way:
+ // in-place edit :100644 100644 bcd1234... 0123456... M file0
+ // copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2
+ // rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3
+ // create :000000 100644 0000000... 1234567... A file4
+ // delete :100644 000000 1234567... 0000000... D file5
+ // unmerged :000000 000000 0000000... 0000000... U file6
+ //
+ // Note that the filenames are preceded by tabs rather than spaces.
+
if (!fileLine.startsWith(":")) {
continue;
}
- final char action = fileLine.substring(37, 38).charAt(0);
- final String path = fileLine.substring(39);
- modifiedFiles.add(new ModifiedFile(path, action));
+
+ final String[] spaceParts = fileLine.split(" ", 5);
+ if (spaceParts.length != 5) {
+ continue;
+ }
+
+ final String[] tabParts = spaceParts[4].split("\t");
+ if (tabParts[0].isEmpty()) {
+ continue;
+ }
+ final char action = tabParts[0].charAt(0);
+ final int expectedLen = ((action == 'C') || (action == 'R')) ? 3 : 2;
+ if (tabParts.length != expectedLen) {
+ continue;
+ }
+
+ switch (action) {
+ case 'M':
+ modifiedFiles.add(new ModifiedFile(tabParts[1], EditType.EDIT));
+ break;
+ case 'C':
+ modifiedFiles.add(new ModifiedFile(tabParts[2], EditType.ADD));
+ break;
+ case 'R':
+ modifiedFiles.add(new ModifiedFile(tabParts[1], EditType.DELETE));
+ modifiedFiles.add(new ModifiedFile(tabParts[2], EditType.ADD));
+ break;
+ case 'A':
+ modifiedFiles.add(new ModifiedFile(tabParts[1], EditType.ADD));
+ break;
+ case 'D':
+ modifiedFiles.add(new ModifiedFile(tabParts[1], EditType.DELETE));
+ break;
+ default:
+ continue;
+ }
}
ChangeLogEntry nc = new ChangeLogEntry(change.getPath(), change
.getServerPath(), revision, authorName, authorEmail,
diff --git a/src/main/java/hudson/plugins/repo/ChangeLogEntry.java b/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
index c4db9a1..76e9179 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLogEntry.java
@@ -45,29 +45,20 @@ public class ChangeLogEntry extends ChangeLogSet.Entry {
*/
static class ModifiedFile implements AffectedFile {
- /**
- * An EditType for a Renamed file. Most version control systems don't
- * support file renames, so this EditType isn't in the default set
- * provided by Hudson.
- */
- static final EditType RENAME = new EditType("rename",
- "The file was renamed");
-
private final String path;
- private final char action;
+ private final EditType editType;
/**
- * Create a new ModifiedFile object with the given path and action.
+ * Create a new ModifiedFile object with the given path and edit type.
*
* @param path
* the path of the file
- * @param action
- * the action performed on the file, as reported by Git (A
- * for add, D for delete, M for modified, etc)
+ * @param editType
+ * edit type
*/
- ModifiedFile(final String path, final char action) {
+ ModifiedFile(final String path, final EditType editType) {
this.path = path;
- this.action = action;
+ this.editType = editType;
}
/**
@@ -78,28 +69,10 @@ public String getPath() {
}
/**
- * Returns the action performed on the file.
- */
- public char getAction() {
- return action;
- }
-
- /**
- * Returns the EditType performed on the file (based on the action).
+ * Returns the EditType performed on the file.
*/
public EditType getEditType() {
- if (action == 'A') {
- return EditType.ADD;
- } else if (action == 'D') {
- return EditType.DELETE;
- } else if (action == 'M') {
- return EditType.EDIT;
- } else if (action == 'R') {
- return RENAME;
- } else {
- return new EditType("unknown: " + action,
- "An unknown file action");
- }
+ return editType;
}
}
From b8314789cffedd604b0893a8123cca29b59cb58b Mon Sep 17 00:00:00 2001
From: Francois Ferrand
Date: Sat, 14 Sep 2019 16:22:45 +0200
Subject: [PATCH 115/184] RepoScm: Allow setting extra environment variables
This is useful to tweak repo behavior, especially when used from
pipelines. For example, this can be used to tweak git lfs behavior, to
enable extra Git logs or to support using ssh agent.
It is now possible to use ssh agent or withEnv() block with repo
checkout in Jenkins pipelines, like in the following code:
sshAgent(['gerrit-ssh-credentials-id']) {
checkout([$class: 'RepoScm', manifestRepositoryUrl: 'ssh://server/project',
extraEnvVars: getContext(hudson.EnvVars)])
}
---
.../java/hudson/plugins/repo/RepoScm.java | 26 +++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 76831f4..411eab8 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -35,6 +35,7 @@
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -104,6 +105,7 @@ public class RepoScm extends SCM implements Serializable {
@CheckForNull private boolean showAllChanges;
@CheckForNull private boolean noTags;
@CheckForNull private Set ignoreProjects;
+ @CheckForNull private EnvVars extraEnvVars;
/**
* Returns the manifest repository URL.
@@ -154,6 +156,11 @@ private EnvVars getEnvVars(final EnvVars environment,
finalEnv.overrideAll(environment);
}
+ // merge extra env vars, if specified
+ if (extraEnvVars != null) {
+ finalEnv.overrideAll(extraEnvVars);
+ }
+
EnvVars.resolve(finalEnv);
return finalEnv;
}
@@ -298,6 +305,14 @@ public boolean isNoTags() {
return noTags;
}
+ /**
+ * Returns the value of extraEnvVars.
+ */
+ @Exported
+ public Map getExtraEnvVars() {
+ return extraEnvVars;
+ }
+
/**
* The constructor takes in user parameters and sets them. Each job using
* the RepoSCM will call this constructor.
@@ -623,6 +638,17 @@ public final void setIgnoreProjects(final String ignoreProjects) {
Arrays.asList(ignoreProjects.split("\\s+")));
}
+ /**
+ * Set additional environment variables to use. These variables will override
+ * any parameter from the project or variable set in environment already.
+ * @param extraEnvVars
+ * Additional environment variables to set.
+ */
+ @DataBoundSetter
+ public void setExtraEnvVars(@CheckForNull final Map extraEnvVars) {
+ this.extraEnvVars = extraEnvVars != null ? new EnvVars(extraEnvVars) : null;
+ }
+
@Override
public SCMRevisionState calcRevisionsFromBuild(
@Nonnull final Run, ?> build, @Nullable final FilePath workspace,
From cf292c934115168549560f47058a4a7010f24704 Mon Sep 17 00:00:00 2001
From: Francois Ferrand
Date: Sat, 14 Sep 2019 16:26:55 +0200
Subject: [PATCH 116/184] Fix crash when changelog is empty.
When repo is used from pipeline in recent Jenkins, build failed while
loading changelog, with `java.lang.ArrayIndexOutOfBoundsException`
exception. This happens because checkout generates a null changelog,
instead of an empty one.
---
src/main/java/hudson/plugins/repo/ChangeLog.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/java/hudson/plugins/repo/ChangeLog.java b/src/main/java/hudson/plugins/repo/ChangeLog.java
index c3e4a16..462be4a 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLog.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLog.java
@@ -41,6 +41,7 @@
import java.io.Reader;
import java.nio.charset.Charset;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -118,7 +119,7 @@ private static List generateChangeLog(
debug.log(Level.FINEST, "generateChangeLog: changes " + changes);
if (changes == null || changes.size() == 0) {
// No changes or the first job
- return null;
+ return Collections.emptyList();
}
final List commands = new ArrayList(5);
final List logs = new ArrayList();
From 366faf84a3d03f58a90ebf5e4b36b771884d1364 Mon Sep 17 00:00:00 2001
From: Daniel Beck
Date: Fri, 20 Sep 2019 23:05:38 +0200
Subject: [PATCH 117/184] Use HTTPS URLs in pom.xml
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 63cba6e..27c5078 100644
--- a/pom.xml
+++ b/pom.xml
@@ -134,14 +134,14 @@
repo.jenkins-ci.org
- http://repo.jenkins-ci.org/public/
+ https://repo.jenkins-ci.org/public/
repo.jenkins-ci.org
- http://repo.jenkins-ci.org/public/
+ https://repo.jenkins-ci.org/public/
From 3a519f02ce24a249c8946ed9f80d376e8732e33f Mon Sep 17 00:00:00 2001
From: Peter Walls
Date: Tue, 23 Oct 2018 13:25:07 +0200
Subject: [PATCH 118/184] Added support for --no-clone-bundle
Added "No Clone Bundle" setting. If selected the "repo init" and "repo sync"
commands will be run with the --no-clone-bundle option.
---
.../java/hudson/plugins/repo/RepoScm.java | 27 +++++++++++++++++++
.../hudson/plugins/repo/RepoScm/config.jelly | 4 +++
src/main/webapp/help-noCloneBundle.html | 6 +++++
3 files changed, 37 insertions(+)
create mode 100644 src/main/webapp/help-noCloneBundle.html
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 76831f4..16d4fb9 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -104,6 +104,7 @@ public class RepoScm extends SCM implements Serializable {
@CheckForNull private boolean showAllChanges;
@CheckForNull private boolean noTags;
@CheckForNull private Set ignoreProjects;
+ @CheckForNull private boolean noCloneBundle;
/**
* Returns the manifest repository URL.
@@ -297,6 +298,13 @@ public boolean isTrace() {
public boolean isNoTags() {
return noTags;
}
+ /**
+ * Returns the value of noCloneBundle.
+ */
+ @Exported
+ public boolean isNoCloneBundle() {
+ return noCloneBundle;
+ }
/**
* The constructor takes in user parameters and sets them. Each job using
@@ -396,6 +404,7 @@ public RepoScm(final String manifestRepositoryUrl) {
showAllChanges = false;
noTags = false;
ignoreProjects = Collections.emptySet();
+ noCloneBundle = false;
}
/**
@@ -571,6 +580,18 @@ public void setShowAllChanges(final boolean showAllChanges) {
this.showAllChanges = showAllChanges;
}
+ /**
+ * Set noCloneBundle.
+ *
+ * @param noCloneBundle
+ * If this value is true, add the "--no-clone-bundle" option when
+ * running the "repo init" and "repo sync" commands.
+ */
+ @DataBoundSetter
+ public void setNoCloneBundle(final boolean noCloneBundle) {
+ this.noCloneBundle = noCloneBundle;
+ }
+
/**
* Set the repo url.
*
@@ -814,6 +835,9 @@ private int doSync(final Launcher launcher, @Nonnull final FilePath workspace,
if (isNoTags()) {
commands.add("--no-tags");
}
+ if (isNoCloneBundle()) {
+ commands.add("--no-clone-bundle");
+ }
return launcher.launch().stdout(logger).pwd(workspace)
.cmds(commands).envs(env).join();
@@ -857,6 +881,9 @@ private boolean checkoutCode(final Launcher launcher,
if (depth != 0) {
commands.add("--depth=" + depth);
}
+ if (isNoCloneBundle()) {
+ commands.add("--no-clone-bundle");
+ }
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 98e4c82..244f90b 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -84,5 +84,9 @@
+
+
+
+
diff --git a/src/main/webapp/help-noCloneBundle.html b/src/main/webapp/help-noCloneBundle.html
new file mode 100644
index 0000000..8f7cbba
--- /dev/null
+++ b/src/main/webapp/help-noCloneBundle.html
@@ -0,0 +1,6 @@
+
+
+ When this is checked --no-clone-bundle is used when running
+ the repo init and repo sync commands.
+
+
From 5df0ac539970145e0ec71f7579c5aa91d014f365 Mon Sep 17 00:00:00 2001
From: Francois Ferrand
Date: Sat, 14 Sep 2019 16:35:57 +0200
Subject: [PATCH 119/184] Improve changelog formatting.
* Include revision for new projects.
* In detailed view, hide missing fields: e.g. revision, author and
commiter for new or removed projects.
* In compact view, show project name instead of 'unknown' author for new
or removed projects.
---
.../java/hudson/plugins/repo/ChangeLog.java | 5 ++---
.../repo/RepoChangeLogSet/digest.jelly | 13 +++++++++---
.../plugins/repo/RepoChangeLogSet/index.jelly | 20 ++++++++++++-------
3 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/ChangeLog.java b/src/main/java/hudson/plugins/repo/ChangeLog.java
index 462be4a..872fddc 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLog.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLog.java
@@ -124,17 +124,16 @@ private static List generateChangeLog(
final List commands = new ArrayList(5);
final List logs = new ArrayList();
-
for (final ProjectState change : changes) {
debug.log(Level.FINEST, "change: " + change);
+ String newRevision = currentState.getRevision(change.getPath());
if (change.getRevision() == null) {
// This project was just added to the manifest.
logs.add(new ChangeLogEntry(change.getPath(), change
- .getServerPath(), null, null, null, null, null, null,
+ .getServerPath(), newRevision, null, null, null, null, null,
null, "This project was added to the manifest.", null));
continue;
}
- String newRevision = currentState.getRevision(change.getPath());
if (newRevision == null) {
// This project was just removed from the manifest.
logs.add(new ChangeLogEntry(change.getPath(), change
diff --git a/src/main/resources/hudson/plugins/repo/RepoChangeLogSet/digest.jelly b/src/main/resources/hudson/plugins/repo/RepoChangeLogSet/digest.jelly
index 2cf7313..b702c63 100644
--- a/src/main/resources/hudson/plugins/repo/RepoChangeLogSet/digest.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoChangeLogSet/digest.jelly
@@ -17,9 +17,16 @@
diff --git a/src/main/resources/hudson/plugins/repo/RepoChangeLogSet/index.jelly b/src/main/resources/hudson/plugins/repo/RepoChangeLogSet/index.jelly
index 1f3f752..e9f5c0e 100644
--- a/src/main/resources/hudson/plugins/repo/RepoChangeLogSet/index.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoChangeLogSet/index.jelly
@@ -21,14 +21,20 @@
Project: ${cs.path}
- Revision: ${cs.revision}
- Author: ${cs.author}
- <${cs.authorEmail}> on ${cs.authorDate}
- Committer: ${cs.committer}
- <${cs.committerEmail}> on ${cs.committerDate}
-
+
+ Revision: ${cs.revision}
+
+
+ Author: ${cs.author}
+ <${cs.authorEmail}> on ${cs.authorDate}
+
+
+ Committer: ${cs.committer}
+ <${cs.committerEmail}> on ${cs.committerDate}
+
+
-
+
From 2d02d3302d6881586b2156f4e4c26599c48d3283 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Fri, 15 Nov 2019 17:58:53 +0100
Subject: [PATCH 120/184] Create release-drafter.yml
Configure release drafter
---
.github/release-drafter.yml | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 .github/release-drafter.yml
diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml
new file mode 100644
index 0000000..492a40b
--- /dev/null
+++ b/.github/release-drafter.yml
@@ -0,0 +1,4 @@
+_extends: .github
+version-template: $MAJOR.$MINOR.$PATCH
+tag-template: repo-$NEXT_PATCH_VERSION
+name-template: Repo SCM Plugin $NEXT_PATCH_VERSION
From 9d0e42a985eb64dc2bf2bb890ea37123e7b3afb6 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 15 Nov 2019 18:43:23 +0100
Subject: [PATCH 121/184] [maven-release-plugin] prepare release repo-1.11.0
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 27c5078..d4fe533 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.10.8-SNAPSHOT
+ 1.11.0
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.11.0
From d7d657e42195a618b1e922e76396bcdbe82b391c Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 15 Nov 2019 18:43:31 +0100
Subject: [PATCH 122/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index d4fe533..6f6949a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.11.0
+ 1.11.1-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.11.0
+ HEAD
From 6a082dacbba985784d2cffa678b618fa232b2f29 Mon Sep 17 00:00:00 2001
From: williamssi
Date: Tue, 19 Nov 2019 16:07:22 +0000
Subject: [PATCH 123/184] JENKINS-59923: Replaced TagAction with new
ManifestAction including data migration
---
.../hudson/plugins/repo/ManifestAction.java | 107 ++++++++++++++++++
.../java/hudson/plugins/repo/RepoScm.java | 2 +-
.../java/hudson/plugins/repo/TagAction.java | 39 +++++--
.../index.jelly} | 10 +-
.../hudson/plugins/repo/TagAction/badge.jelly | 11 --
5 files changed, 144 insertions(+), 25 deletions(-)
create mode 100644 src/main/java/hudson/plugins/repo/ManifestAction.java
rename src/main/resources/hudson/plugins/repo/{TagAction/tagForm.jelly => ManifestAction/index.jelly} (72%)
delete mode 100644 src/main/resources/hudson/plugins/repo/TagAction/badge.jelly
diff --git a/src/main/java/hudson/plugins/repo/ManifestAction.java b/src/main/java/hudson/plugins/repo/ManifestAction.java
new file mode 100644
index 0000000..9476197
--- /dev/null
+++ b/src/main/java/hudson/plugins/repo/ManifestAction.java
@@ -0,0 +1,107 @@
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2010, Brad Larson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package hudson.plugins.repo;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.kohsuke.stapler.export.ExportedBean;
+
+import hudson.model.Run;
+import jenkins.model.RunAction2;
+
+/**
+ * A Manifest Action displays the static manifest information needed
+ * to recreate the exact state of the repository when the build was run.
+ */
+@ExportedBean(defaultVisibility = 999)
+public class ManifestAction implements RunAction2 {
+
+ private static Logger debug = Logger
+ .getLogger("hudson.plugins.repo.ManifestAction");
+
+ private transient Run, ?> run;
+
+ /**
+ * Constructs the manifest action object.
+ * @param run Build whose manifest we wish to display.
+ */
+ ManifestAction(final Run, ?> run) {
+ this.run = run;
+ }
+
+ @Override
+ public void onAttached(final Run, ?> r) {
+ this.run = r;
+ }
+
+ @Override
+ public void onLoad(final Run, ?> r) {
+ this.run = r;
+ }
+
+ /**
+ * Getter for the run property.
+ */
+ public Run, ?> getRun() {
+ return run;
+ }
+
+ /**
+ * Returns the filename to use as the badge.
+ */
+ public String getIconFileName() {
+ return "star.gif";
+ }
+
+ /**
+ * Returns the display name to use for the action.
+ */
+ public String getDisplayName() {
+ return "Repo Manifest";
+ }
+
+ /**
+ * Returns the name of the Url to use for the action.
+ */
+ public final String getUrlName() {
+ return "repo-manifest";
+ }
+
+ /**
+ * Gets a String representation of the static manifest for this repo snapshot.
+ */
+ public String getManifest() {
+ String result = "";
+ try {
+ final RevisionState revisionState = run.getAction(RevisionState.class);
+ if (revisionState != null) {
+ result = revisionState.getManifest();
+ }
+ } catch (Exception e) {
+ debug.log(Level.WARNING, "Error getting revision state {0}", e.getMessage());
+ }
+ return result;
+ }
+}
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 68ae362..63093ca 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -805,7 +805,7 @@ public void checkout(
repoDir,
showAllChanges);
}
- build.addAction(new TagAction(build));
+ build.addAction(new ManifestAction(build));
}
private int doSync(final Launcher launcher, @Nonnull final FilePath workspace,
diff --git a/src/main/java/hudson/plugins/repo/TagAction.java b/src/main/java/hudson/plugins/repo/TagAction.java
index 27dab29..38d692c 100644
--- a/src/main/java/hudson/plugins/repo/TagAction.java
+++ b/src/main/java/hudson/plugins/repo/TagAction.java
@@ -23,19 +23,28 @@
*/
package hudson.plugins.repo;
+import java.io.ObjectStreamException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.kohsuke.accmod.Restricted;
+import org.kohsuke.accmod.restrictions.NoExternalUse;
+
import hudson.model.Run;
import hudson.scm.AbstractScmTagAction;
-import org.kohsuke.stapler.export.ExportedBean;
-
-/**
+ /**
* A Tag Action allows a user to tag a build. Repo doesn't support a solid tag
* method, so right now we just display the static manifest information needed
* to recreate the exact state of the repository when the build was ran.
+ * @deprecated replaced by {@link ManifestAction} JENKINS-59923
*/
-@ExportedBean(defaultVisibility = 999)
+@Deprecated
+@Restricted(NoExternalUse.class)
public class TagAction extends AbstractScmTagAction {
+ private static Logger debug = Logger.getLogger("hudson.plugins.repo.TagAction");
+
/**
* Constructs the tag action object. Just call the superclass.
*
@@ -54,7 +63,7 @@ public String getIconFileName() {
// TODO: return null if we don't want to show a link (no permissions?)
// TODO: if we later support actual tagging, we can use star-gold.gif
// for already tagged builds
- return "star.gif";
+ return null;
}
/**
@@ -63,7 +72,7 @@ public String getIconFileName() {
*/
public String getDisplayName() {
// TODO: adjust name based on build state (tagged already or not)?
- return "Repo Manifest";
+ return null;
}
@Override
@@ -83,8 +92,20 @@ public boolean isTagged() {
* snapshot.
*/
public String getManifest() {
- final RevisionState revisionState =
- getRun().getAction(RevisionState.class);
- return revisionState.getManifest();
+ return null;
+ }
+
+ @Override
+ public void onAttached(final Run, ?> r) {
+ debug.log(Level.SEVERE, "Unexpected attach of TagAction class");
+ }
+
+ /**
+ * Migrate to a new ManifestAction.
+ * @return
+ * @throws ObjectStreamException if there is an issue
+ */
+ Object readResolve() throws ObjectStreamException {
+ return new ManifestAction(build);
}
}
diff --git a/src/main/resources/hudson/plugins/repo/TagAction/tagForm.jelly b/src/main/resources/hudson/plugins/repo/ManifestAction/index.jelly
similarity index 72%
rename from src/main/resources/hudson/plugins/repo/TagAction/tagForm.jelly
rename to src/main/resources/hudson/plugins/repo/ManifestAction/index.jelly
index b3df949..4b4b2ec 100644
--- a/src/main/resources/hudson/plugins/repo/TagAction/tagForm.jelly
+++ b/src/main/resources/hudson/plugins/repo/ManifestAction/index.jelly
@@ -8,13 +8,15 @@
xmlns:f="/lib/form">
-
+
+
+
- Repo Manifest - Build #${it.build.number}
+ Repo Manifest - Build #${it.run.number}
To recreate this build, copy the below manifest and past it to .repo/manifest.xml, then run 'repo sync'.
When done, be sure to undo changes to the .repo/manifest.xml file and repo sync again.
-
- Manifest File:
+
+ Manifest File:
diff --git a/src/main/resources/hudson/plugins/repo/TagAction/badge.jelly b/src/main/resources/hudson/plugins/repo/TagAction/badge.jelly
deleted file mode 100644
index 57a3b30..0000000
--- a/src/main/resources/hudson/plugins/repo/TagAction/badge.jelly
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
From 65d36483eea26682f93a6b742eef9cf02b9014c5 Mon Sep 17 00:00:00 2001
From: Francois Ferrand
Date: Wed, 20 Nov 2019 10:24:56 +0100
Subject: [PATCH 124/184] Support submodules and fetchSubmodules flags
Add 2 new configuration flags, to enable the `submodules` flag in repo init,
to fetch submodules of manifest repo; and the `fetch-submodules` flag in
repo sync to fetch submodules for all repositories.
---
.../java/hudson/plugins/repo/RepoScm.java | 51 ++++++++++++++++++-
.../hudson/plugins/repo/RepoScm/config.jelly | 8 +++
src/main/webapp/help-fetchSubmodules.html | 6 +++
src/main/webapp/help-manifestSubmodules.html | 6 +++
4 files changed, 70 insertions(+), 1 deletion(-)
create mode 100644 src/main/webapp/help-fetchSubmodules.html
create mode 100644 src/main/webapp/help-manifestSubmodules.html
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 68ae362..b76a5a7 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -104,6 +104,8 @@ public class RepoScm extends SCM implements Serializable {
@CheckForNull private boolean trace;
@CheckForNull private boolean showAllChanges;
@CheckForNull private boolean noTags;
+ @CheckForNull private boolean manifestSubmodules;
+ @CheckForNull private boolean fetchSubmodules;
@CheckForNull private Set ignoreProjects;
@CheckForNull private EnvVars extraEnvVars;
@CheckForNull private boolean noCloneBundle;
@@ -298,6 +300,7 @@ public boolean isForceSync() {
public boolean isTrace() {
return trace;
}
+
/**
* Returns the value of noTags.
*/
@@ -313,6 +316,21 @@ public boolean isNoCloneBundle() {
return noCloneBundle;
}
+ /**
+ * Returns the value of manifestSubmodules.
+ */
+ @Exported
+ public boolean isManifestSubmodules() {
+ return manifestSubmodules;
+ }
+
+ /**
+ * Returns the value of fetchSubmodules.
+ */
+ public boolean isFetchSubmodules() {
+ return fetchSubmodules;
+ }
+
/**
* Returns the value of extraEnvVars.
*/
@@ -418,6 +436,8 @@ public RepoScm(final String manifestRepositoryUrl) {
trace = false;
showAllChanges = false;
noTags = false;
+ manifestSubmodules = false;
+ fetchSubmodules = false;
ignoreProjects = Collections.emptySet();
noCloneBundle = false;
}
@@ -642,6 +662,30 @@ public final void setNoTags(final boolean noTags) {
this.noTags = noTags;
}
+ /**
+ * Set manifestSubmodules.
+ *
+ * @param manifestSubmodules
+ * If this value is true, add the "--submodules" option when
+ * executing "repo init".
+ */
+ @DataBoundSetter
+ public void setManifestSubmodules(final boolean manifestSubmodules) {
+ this.manifestSubmodules = manifestSubmodules;
+ }
+
+ /**
+ * Set fetchSubmodules.
+ *
+ * @param fetchSubmodules
+ * If this value is true, add the "--fetch-submodules" option when
+ * executing "repo sync".
+ */
+ @DataBoundSetter
+ public void setFetchSubmodules(final boolean fetchSubmodules) {
+ this.fetchSubmodules = fetchSubmodules;
+ }
+
/**
* Sets list of projects which changes will be ignored when
* calculating whether job needs to be rebuild. This field corresponds
@@ -864,7 +908,9 @@ private int doSync(final Launcher launcher, @Nonnull final FilePath workspace,
if (isNoCloneBundle()) {
commands.add("--no-clone-bundle");
}
-
+ if (fetchSubmodules) {
+ commands.add("--fetch-submodules");
+ }
return launcher.launch().stdout(logger).pwd(workspace)
.cmds(commands).envs(env).join();
}
@@ -910,6 +956,9 @@ private boolean checkoutCode(final Launcher launcher,
if (isNoCloneBundle()) {
commands.add("--no-clone-bundle");
}
+ if (manifestSubmodules) {
+ commands.add("--submodules");
+ }
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 244f90b..0cb83d1 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -53,6 +53,14 @@
+
+
+
+
+
+
+
+
diff --git a/src/main/webapp/help-fetchSubmodules.html b/src/main/webapp/help-fetchSubmodules.html
new file mode 100644
index 0000000..6527f04
--- /dev/null
+++ b/src/main/webapp/help-fetchSubmodules.html
@@ -0,0 +1,6 @@
+
+
+ Fetch submodules for from server.
+ This is passed to repo as repo sync --fetch-submodules.
+
+
diff --git a/src/main/webapp/help-manifestSubmodules.html b/src/main/webapp/help-manifestSubmodules.html
new file mode 100644
index 0000000..93cdf44
--- /dev/null
+++ b/src/main/webapp/help-manifestSubmodules.html
@@ -0,0 +1,6 @@
+
+
+ Sync any submodules associated with the manifest repo.
+ This is passed to repo as repo init --submodules.
+
+
From 417e8116054ed1102472ed0ce52ec5f9030c6820 Mon Sep 17 00:00:00 2001
From: Francois Ferrand
Date: Wed, 20 Nov 2019 10:48:56 +0100
Subject: [PATCH 125/184] Support specify platform in repo init
Add new configuration flag to support passing the `platform` flag in
repo init.
---
.../java/hudson/plugins/repo/RepoScm.java | 27 +++++++++++++++++++
.../hudson/plugins/repo/RepoScm/config.jelly | 4 +++
src/main/webapp/help-manifestPlatform.html | 8 ++++++
3 files changed, 39 insertions(+)
create mode 100644 src/main/webapp/help-manifestPlatform.html
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index b76a5a7..e571995 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -89,6 +89,7 @@ public class RepoScm extends SCM implements Serializable {
// Advanced Fields:
@CheckForNull private String manifestFile;
@CheckForNull private String manifestGroup;
+ @CheckForNull private String manifestPlatform;
@CheckForNull private String repoUrl;
@CheckForNull private String mirrorDir;
@CheckForNull private String manifestBranch;
@@ -186,6 +187,15 @@ public String getManifestGroup() {
return manifestGroup;
}
+ /**
+ * Returns the platform of projects to fetch. By default, this is null and
+ * repo will automatically fetch the appropriate platform.
+ */
+ @CheckForNull
+ public String getManifestPlatform() {
+ return manifestPlatform;
+ }
+
/**
* Returns the repo url. by default, this is null and
* repo is fetched from aosp
@@ -480,6 +490,19 @@ public void setManifestGroup(@CheckForNull final String manifestGroup) {
this.manifestGroup = Util.fixEmptyAndTrim(manifestGroup);
}
+ /**
+ * Set the platform of projects to fetch.
+ *
+ * @param manifestPlatform
+ * The platform for the projects that need to be fetched.
+ * Typically, this is null and only projects for the current platform
+ * will be fetched.
+ */
+ @DataBoundSetter
+ public void setManifestPlatform(@CheckForNull final String manifestPlatform) {
+ this.manifestPlatform = manifestPlatform;
+ }
+
/**
* Set the name of the mirror directory.
*
@@ -950,6 +973,10 @@ private boolean checkoutCode(final Launcher launcher,
commands.add("-g");
commands.add(env.expand(manifestGroup));
}
+ if (manifestPlatform != null) {
+ commands.add("-p");
+ commands.add(env.expand(manifestPlatform));
+ }
if (depth != 0) {
commands.add("--depth=" + depth);
}
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index 0cb83d1..5c41b16 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -24,6 +24,10 @@
+
+
+
+
diff --git a/src/main/webapp/help-manifestPlatform.html b/src/main/webapp/help-manifestPlatform.html
new file mode 100644
index 0000000..9b92243
--- /dev/null
+++ b/src/main/webapp/help-manifestPlatform.html
@@ -0,0 +1,8 @@
+
+
+ Restrict manifest projects to ones with a specified platform group [auto|all|none|linux|darwin|...]
+ This is passed to repo as repo init -P platformName. If a platform is not provided, the
+ -p option is not passed to repo and it will default to auto and ony fetch projects
+ which needed for current system.
+
+
From 386f3f135cc8e697b45c9bccf9ade119c8a72c16 Mon Sep 17 00:00:00 2001
From: Francois Ferrand
Date: Wed, 20 Nov 2019 10:59:03 +0100
Subject: [PATCH 126/184] Pass current-branch and no-tags to repo init as well
When the currentBranch or noTags option are selected, the `current-branch`
and `no-tags` flags are passed to repo sync.
With this change, these same flags are also passed to repo init.
---
src/main/java/hudson/plugins/repo/RepoScm.java | 6 ++++++
src/main/webapp/help-currentBranch.html | 2 +-
src/main/webapp/help-noTags.html | 2 +-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index e571995..aa2cf22 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -983,6 +983,12 @@ private boolean checkoutCode(final Launcher launcher,
if (isNoCloneBundle()) {
commands.add("--no-clone-bundle");
}
+ if (currentBranch) {
+ commands.add("--current-branch");
+ }
+ if (noTags) {
+ commands.add("--no-tags");
+ }
if (manifestSubmodules) {
commands.add("--submodules");
}
diff --git a/src/main/webapp/help-currentBranch.html b/src/main/webapp/help-currentBranch.html
index d3f3be7..e91bfca 100644
--- a/src/main/webapp/help-currentBranch.html
+++ b/src/main/webapp/help-currentBranch.html
@@ -2,6 +2,6 @@
Fetch only the current branch from server.
Increases the speed of the repo sync operation.
- This is passed to repo as repo sync -c.
+ This is passed to repo as repo init --current-branch and repo sync -c.
diff --git a/src/main/webapp/help-noTags.html b/src/main/webapp/help-noTags.html
index 5567c7f..a3f1604 100644
--- a/src/main/webapp/help-noTags.html
+++ b/src/main/webapp/help-noTags.html
@@ -1,6 +1,6 @@
Don't fetch tags.
- This is passed to repo as repo sync --no-tags.
+ This is passed to repo as repo init --no-tags and repo sync --no-tags.
From 208ff096315eb995642f1df44ca5c4b8663306dc Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 22 Nov 2019 16:32:10 +0100
Subject: [PATCH 127/184] Moved documentation from wiki to GitHub repo + modern
Jenkins core dependency
---
doc/README.adoc | 193 ++++++++++++++++++
pom.xml | 8 +-
.../java/hudson/plugins/repo/RepoScmTest.java | 34 +++
3 files changed, 231 insertions(+), 4 deletions(-)
create mode 100644 doc/README.adoc
create mode 100644 src/test/java/hudson/plugins/repo/RepoScmTest.java
diff --git a/doc/README.adoc b/doc/README.adoc
new file mode 100644
index 0000000..c5ae0eb
--- /dev/null
+++ b/doc/README.adoc
@@ -0,0 +1,193 @@
+= Repo Plugin
+
+image:https://img.shields.io/jenkins/plugin/v/repo.svg[link="https://plugins.jenkins.io/repo"]
+image:https://img.shields.io/github/release/jenkinsci/repo-plugin.svg?label=changelog[link="https://github.com/jenkinsci/repo-plugin/releases/latest"]
+image:https://img.shields.io/jenkins/plugin/i/repo.svg?color=blue[link="https://plugins.jenkins.io/repo"]
+
+This plugin adds http://code.google.com/p/git-repo/[Repo] as an SCM provider in Jenkins.
+
+*This plugin is up for adoption.* Want to help improve this plugin?
+https://wiki.jenkins.io/display/JENKINS/Adopt+a+Plugin[Click here to
+learn more]!
+
+:toc:
+:toc-placement: preamble
+:toclevels: 3
+
+[[RepoPlugin-Description]]
+== Description
+
+This plugin adds Repo (http://code.google.com/p/git-repo/) as an SCM
+provider for Jenkins. Projects can use this plugin to only run builds
+when changes are detected in any of the git repositories in the repo
+manifest, to list the changes between builds, and to re-create the
+project state across all repositories for any previous build using a
+static manifest.
+
+[[RepoPlugin-Changelog]]
+== Changelog
+
+As of version 1.11.0 the changelog is moved to https://github.com/jenkinsci/repo-plugin/releases/[GitHub Releases]
+
+[[RepoPlugin-Version1.10.7-Mar3,2017]]
+=== Version 1.10.7 - Mar 3, 2017
+
+* Update URLs to valid locations in help html.
+(https://github.com/jenkinsci/repo-plugin/pull/43[pull #43])
+* Support for evaluating $\{param} in destination dir.
+(https://github.com/jenkinsci/repo-plugin/pull/44[pull #44])
+* Fix --force-sync help description.
+(https://github.com/jenkinsci/repo-plugin/pull/45[pull #45])
+
+[[RepoPlugin-Version1.10.6-Jan10,2017]]
+=== Version 1.10.6 - Jan 10, 2017
+
+* Use local_manifests/local.xml rather than local_manifest.xml.
+(https://github.com/jenkinsci/repo-plugin/pull/42[pull #42])
+
+[[RepoPlugin-Version1.10.5-Nov30,2016]]
+=== Version 1.10.5 - Nov 30, 2016
+
+* https://issues.jenkins-ci.org/browse/JENKINS-40114[JENKINS-40114]
+Fixed. (https://github.com/jenkinsci/repo-plugin/pull/41[pull #41])
+
+[[RepoPlugin-Version1.10.4-Nov29,2016]]
+=== Version 1.10.4 - Nov 29, 2016
+
+* Fixex typos in local manifest help.
+(https://github.com/jenkinsci/repo-plugin/pull/37[pull #37])
+* https://issues.jenkins-ci.org/browse/JENKINS-36703[JENKINS-36703]
+Fixed polling behaviour.
+(https://github.com/jenkinsci/repo-plugin/pull/38[pull #38])
+* Fixed some repo commands.
+(https://github.com/jenkinsci/repo-plugin/pull/39[pull #39])
+
+[[RepoPlugin-Version1.10.3-Aug18,2016]]
+=== Version 1.10.3 - Aug 18, 2016
+
+* https://issues.jenkins-ci.org/browse/JENKINS-37416[JENKINS-37416]
+Expand local manifest.
+(https://github.com/jenkinsci/repo-plugin/pull/36[pull #36])
+
+[[RepoPlugin-Version1.10.2-Jul13,2016]]
+=== Version 1.10.2 - Jul 13, 2016
+
+* https://issues.jenkins-ci.org/browse/JENKINS-36644[JENKINS-36644] Fix
+Tag action is not working in pipeline job.
+(https://github.com/jenkinsci/repo-plugin/pull/35[pull #35])
+* https://issues.jenkins-ci.org/browse/JENKINS-33958[JENKINS-33958] Fix
+changelog hang when used with pipeline.
+(https://github.com/jenkinsci/repo-plugin/pull/34[pull #34])
+
+[[RepoPlugin-Version1.10.1-Jul11,2016]]
+=== Version 1.10.1 - Jul 11, 2016
+
+* https://issues.jenkins-ci.org/browse/JENKINS-14539[JENKINS-14539] Fix
+issue with Email Ext plugin - full name was returned instead of email.
+(https://github.com/jenkinsci/repo-plugin/pull/33[pull #33])
+
+[[RepoPlugin-Version1.10.0-Feb22,2015]]
+=== Version 1.10.0 - Feb 22, 2015
+
+* Adding an option to ignore specific projects on scm poll.
+(https://github.com/jenkinsci/repo-plugin/pull/31[pull #31])
+
+[[RepoPlugin-Version1.9.0-Jan21,2015]]
+=== Version 1.9.0 - Jan 21, 2015
+
+* Support for
+https://wiki.jenkins.io/display/JENKINS/Pipeline+Plugin[Pipeline Plugin]
+(https://github.com/jenkinsci/repo-plugin/pull/28[pull #28])
+
+[[RepoPlugin-Version1.8.0-Sept25th,2015]]
+=== Version 1.8.0 - Sept 25th, 2015
+
+* --force-sync (https://github.com/jenkinsci/repo-plugin/pull/26[pull
+#26])
+* --no-tags (https://github.com/jenkinsci/repo-plugin/pull/27[pull #27])
+
+[[RepoPlugin-Version1.7.1-May6th,2015]]
+=== Version 1.7.1 - May 6th, 2015
+
+* Fix some options can't be shown properly in configuration page
+(https://github.com/jenkinsci/repo-plugin/pull/25[pull #25])
+
+[[RepoPlugin-Version1.7-Apr23rd,2015]]
+=== Version 1.7 - Apr 23rd, 2015
+
+* Support for shallow clones, option to reset the repo before syncing
+(https://github.com/jenkinsci/repo-plugin/pull/20[pull #20])
+* Fixed
+https://issues.jenkins-ci.org/browse/JENKINS-17913[JENKINS-17913] Expand
+manifest file and URL.
+(https://github.com/jenkinsci/repo-plugin/pull/21[pull #21])
+* Added --trace option.
+(https://github.com/jenkinsci/repo-plugin/pull/22[pull #22])
+* Fixed
+https://issues.jenkins-ci.org/browse/JENKINS-23262[JENKINS-23262]
+(https://github.com/jenkinsci/repo-plugin/pull/22[pull #22])
+* Added option for --first-parent in changelog.
+(https://github.com/jenkinsci/repo-plugin/pull/23[pull #23])
+
+[[RepoPlugin-Version1.6-Nov19th,2013]]
+=== Version 1.6 - Nov 19th, 2013
+
+* Allow parameters in repo branch name
+(https://issues.jenkins-ci.org/browse/JENKINS-17913[issue #20])
+* Fixed a bug where a poll compared the current workspace and polled
+branch incorrectly.
+* Improved git log
+
+[[RepoPlugin-Version1.5-April23th,2013]]
+=== Version 1.5 - April 23th, 2013
+
+* Support for repo init -g
+* Support for repo init --repo-url
+* Parent pom updated to jenkins 1.424
+
+[[RepoPlugin-Version1.3-November19th,2012]]
+=== Version 1.3 - November 19th, 2012
+
+* Lowered memory footprint in case of projects with a large build
+history.
+* Support repo options '-c' and '-q'.
+* Fix:Â Repo does not implement
+getAffectedFiles()Â (https://issues.jenkins-ci.org/browse/JENKINS-14926[issue
+#14926]).
+* Allow localManifest to be specified either literally or as an URL.
+
+[[RepoPlugin-Version1.2.1-April23rd,2012]]
+=== Version 1.2.1 - April 23rd, 2012
+
+* Fix : Jobs using repo plugin do not persist
+(https://issues.jenkins-ci.org/browse/JENKINS-12466[JENKINS-12466])
+* Fix : Fixed NPE in RevisionState.hashCode()
+
+[[RepoPlugin-Version1.2]]
+=== Version 1.2
+
+If build scripts modify the workspace, which cause problems during repo
+sync, try running git reset --hard on the repository and re-running repo
+sync. Thanks to https://github.com/tgover1[tgover].
+
+Don't show all the changes brought in from a merge commit in the change
+log, just show the merge commit (see git log --first-parent). This fixes
+a problem of a merge commit breaking the build and all authors of
+changes brought in with that merge commit getting emailed about it.
+Thanks to https://github.com/tgover1[tgover].
+
+[[RepoPlugin-Version1.1]]
+=== Version 1.1
+
+Add support for syncing from local mirrors, specify the number of
+projects to sync simultaneously, use a local manifest, and sync to a
+subdirectory of the workspace. Thanks to
+https://github.com/tgover1[tgover].
+
+Add support to specify the name of the manifest file to use. Thanks to
+https://github.com/farshidce[farshidce].
+
+[[RepoPlugin-Version1.0]]
+=== Version 1.0
+
+Initial Release
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 6f6949a..1981422 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
org.jenkins-ci.plugins
plugin
- 2.30
+ 3.53
@@ -13,11 +13,11 @@
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
- http://wiki.jenkins-ci.org/display/JENKINS/Repo+Plugin
+ https://github.com/jenkinsci/repo-plugin/blob/master/doc/README.md
- 1.651.3
- 7
+ 2.60.3
+ 8
UTF-8
UTF-8
diff --git a/src/test/java/hudson/plugins/repo/RepoScmTest.java b/src/test/java/hudson/plugins/repo/RepoScmTest.java
new file mode 100644
index 0000000..88527aa
--- /dev/null
+++ b/src/test/java/hudson/plugins/repo/RepoScmTest.java
@@ -0,0 +1,34 @@
+package hudson.plugins.repo;
+
+import hudson.model.FreeStyleProject;
+import hudson.tasks.Shell;
+import org.junit.Rule;
+import org.junit.Test;
+import org.jvnet.hudson.test.JenkinsRule;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * {@link JenkinsRule} based tests for {@link RepoScm}
+ */
+public class RepoScmTest {
+ @Rule
+ public JenkinsRule j = new JenkinsRule();
+
+ @Test
+ public void configRoundTrip() throws Exception {
+ FreeStyleProject project = j.createFreeStyleProject();
+ final String manifestRepositoryUrl = "https://gerrit/projects/platform.git";
+ RepoScm scm = new RepoScm(manifestRepositoryUrl);
+ scm.setCleanFirst(true);
+ project.setScm(scm);
+ project.getBuildersList().add(new Shell("ecgo hello"));
+ project.save();
+ j.configRoundtrip(project);
+ project = j.jenkins.getItemByFullName(project.getFullName(), FreeStyleProject.class);
+ scm = (RepoScm) project.getScm();
+ assertTrue(scm.isCleanFirst());
+ assertEquals(manifestRepositoryUrl, scm.getManifestRepositoryUrl());
+ }
+}
From 31395fdc15eefdf7e3112bbdd8d62304d3717f7c Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 22 Nov 2019 17:09:54 +0100
Subject: [PATCH 128/184] Url to adoc not md
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 1981422..7a6d1e9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
- https://github.com/jenkinsci/repo-plugin/blob/master/doc/README.md
+ https://github.com/jenkinsci/repo-plugin/blob/master/doc/README.adoc
2.60.3
From 086a62d0737351287858e32fa8de001443277585 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Mon, 25 Nov 2019 11:12:04 +0100
Subject: [PATCH 129/184] [maven-release-plugin] prepare release repo-1.11.1
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 7a6d1e9..38803a8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.11.1-SNAPSHOT
+ 1.11.1
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.11.1
From acbbae8900295a5365c7ec9a490e783f48213b11 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Mon, 25 Nov 2019 11:12:12 +0100
Subject: [PATCH 130/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 38803a8..47eaf30 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.11.1
+ 1.11.2-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.11.1
+ HEAD
From 8cb8c29f1881b51b93fb218459eb45a604bbc55e Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 6 Dec 2019 17:05:24 +0100
Subject: [PATCH 131/184] [maven-release-plugin] prepare release repo-1.12.0
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 47eaf30..f32a04d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.11.2-SNAPSHOT
+ 1.12.0
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.12.0
From 302d168cfe37577bf60f597ffdeeba0877a0ccfc Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 6 Dec 2019 17:05:32 +0100
Subject: [PATCH 132/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index f32a04d..fec622b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.12.0
+ 1.12.1-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.12.0
+ HEAD
From 5b88e7b1b6ab05feb3015f7878ad49c25ee167ee Mon Sep 17 00:00:00 2001
From: williamssi
Date: Tue, 19 Nov 2019 16:07:22 +0000
Subject: [PATCH 133/184] JENKINS-59923: Replaced TagAction with new
ManifestAction including data migration
---
.../hudson/plugins/repo/ManifestAction.java | 107 ++++++++++++++++++
.../java/hudson/plugins/repo/RepoScm.java | 2 +-
.../java/hudson/plugins/repo/TagAction.java | 39 +++++--
.../index.jelly} | 10 +-
.../hudson/plugins/repo/TagAction/badge.jelly | 11 --
5 files changed, 144 insertions(+), 25 deletions(-)
create mode 100644 src/main/java/hudson/plugins/repo/ManifestAction.java
rename src/main/resources/hudson/plugins/repo/{TagAction/tagForm.jelly => ManifestAction/index.jelly} (72%)
delete mode 100644 src/main/resources/hudson/plugins/repo/TagAction/badge.jelly
diff --git a/src/main/java/hudson/plugins/repo/ManifestAction.java b/src/main/java/hudson/plugins/repo/ManifestAction.java
new file mode 100644
index 0000000..9476197
--- /dev/null
+++ b/src/main/java/hudson/plugins/repo/ManifestAction.java
@@ -0,0 +1,107 @@
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2010, Brad Larson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package hudson.plugins.repo;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.kohsuke.stapler.export.ExportedBean;
+
+import hudson.model.Run;
+import jenkins.model.RunAction2;
+
+/**
+ * A Manifest Action displays the static manifest information needed
+ * to recreate the exact state of the repository when the build was run.
+ */
+@ExportedBean(defaultVisibility = 999)
+public class ManifestAction implements RunAction2 {
+
+ private static Logger debug = Logger
+ .getLogger("hudson.plugins.repo.ManifestAction");
+
+ private transient Run, ?> run;
+
+ /**
+ * Constructs the manifest action object.
+ * @param run Build whose manifest we wish to display.
+ */
+ ManifestAction(final Run, ?> run) {
+ this.run = run;
+ }
+
+ @Override
+ public void onAttached(final Run, ?> r) {
+ this.run = r;
+ }
+
+ @Override
+ public void onLoad(final Run, ?> r) {
+ this.run = r;
+ }
+
+ /**
+ * Getter for the run property.
+ */
+ public Run, ?> getRun() {
+ return run;
+ }
+
+ /**
+ * Returns the filename to use as the badge.
+ */
+ public String getIconFileName() {
+ return "star.gif";
+ }
+
+ /**
+ * Returns the display name to use for the action.
+ */
+ public String getDisplayName() {
+ return "Repo Manifest";
+ }
+
+ /**
+ * Returns the name of the Url to use for the action.
+ */
+ public final String getUrlName() {
+ return "repo-manifest";
+ }
+
+ /**
+ * Gets a String representation of the static manifest for this repo snapshot.
+ */
+ public String getManifest() {
+ String result = "";
+ try {
+ final RevisionState revisionState = run.getAction(RevisionState.class);
+ if (revisionState != null) {
+ result = revisionState.getManifest();
+ }
+ } catch (Exception e) {
+ debug.log(Level.WARNING, "Error getting revision state {0}", e.getMessage());
+ }
+ return result;
+ }
+}
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index aa2cf22..17d0bff 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -872,7 +872,7 @@ public void checkout(
repoDir,
showAllChanges);
}
- build.addAction(new TagAction(build));
+ build.addAction(new ManifestAction(build));
}
private int doSync(final Launcher launcher, @Nonnull final FilePath workspace,
diff --git a/src/main/java/hudson/plugins/repo/TagAction.java b/src/main/java/hudson/plugins/repo/TagAction.java
index 27dab29..38d692c 100644
--- a/src/main/java/hudson/plugins/repo/TagAction.java
+++ b/src/main/java/hudson/plugins/repo/TagAction.java
@@ -23,19 +23,28 @@
*/
package hudson.plugins.repo;
+import java.io.ObjectStreamException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.kohsuke.accmod.Restricted;
+import org.kohsuke.accmod.restrictions.NoExternalUse;
+
import hudson.model.Run;
import hudson.scm.AbstractScmTagAction;
-import org.kohsuke.stapler.export.ExportedBean;
-
-/**
+ /**
* A Tag Action allows a user to tag a build. Repo doesn't support a solid tag
* method, so right now we just display the static manifest information needed
* to recreate the exact state of the repository when the build was ran.
+ * @deprecated replaced by {@link ManifestAction} JENKINS-59923
*/
-@ExportedBean(defaultVisibility = 999)
+@Deprecated
+@Restricted(NoExternalUse.class)
public class TagAction extends AbstractScmTagAction {
+ private static Logger debug = Logger.getLogger("hudson.plugins.repo.TagAction");
+
/**
* Constructs the tag action object. Just call the superclass.
*
@@ -54,7 +63,7 @@ public String getIconFileName() {
// TODO: return null if we don't want to show a link (no permissions?)
// TODO: if we later support actual tagging, we can use star-gold.gif
// for already tagged builds
- return "star.gif";
+ return null;
}
/**
@@ -63,7 +72,7 @@ public String getIconFileName() {
*/
public String getDisplayName() {
// TODO: adjust name based on build state (tagged already or not)?
- return "Repo Manifest";
+ return null;
}
@Override
@@ -83,8 +92,20 @@ public boolean isTagged() {
* snapshot.
*/
public String getManifest() {
- final RevisionState revisionState =
- getRun().getAction(RevisionState.class);
- return revisionState.getManifest();
+ return null;
+ }
+
+ @Override
+ public void onAttached(final Run, ?> r) {
+ debug.log(Level.SEVERE, "Unexpected attach of TagAction class");
+ }
+
+ /**
+ * Migrate to a new ManifestAction.
+ * @return
+ * @throws ObjectStreamException if there is an issue
+ */
+ Object readResolve() throws ObjectStreamException {
+ return new ManifestAction(build);
}
}
diff --git a/src/main/resources/hudson/plugins/repo/TagAction/tagForm.jelly b/src/main/resources/hudson/plugins/repo/ManifestAction/index.jelly
similarity index 72%
rename from src/main/resources/hudson/plugins/repo/TagAction/tagForm.jelly
rename to src/main/resources/hudson/plugins/repo/ManifestAction/index.jelly
index b3df949..4b4b2ec 100644
--- a/src/main/resources/hudson/plugins/repo/TagAction/tagForm.jelly
+++ b/src/main/resources/hudson/plugins/repo/ManifestAction/index.jelly
@@ -8,13 +8,15 @@
xmlns:f="/lib/form">
-
+
+
+
- Repo Manifest - Build #${it.build.number}
+ Repo Manifest - Build #${it.run.number}
To recreate this build, copy the below manifest and past it to .repo/manifest.xml, then run 'repo sync'.
When done, be sure to undo changes to the .repo/manifest.xml file and repo sync again.
-
- Manifest File:
+
+ Manifest File:
diff --git a/src/main/resources/hudson/plugins/repo/TagAction/badge.jelly b/src/main/resources/hudson/plugins/repo/TagAction/badge.jelly
deleted file mode 100644
index 57a3b30..0000000
--- a/src/main/resources/hudson/plugins/repo/TagAction/badge.jelly
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
From 7c53413d37875de544eb4f81e78e96b73436b969 Mon Sep 17 00:00:00 2001
From: Simon Williams
Date: Fri, 10 Jan 2020 11:11:07 +0000
Subject: [PATCH 134/184] JENKINS-59923: Restored the build history badge
---
src/main/java/hudson/plugins/repo/ManifestAction.java | 3 ++-
.../hudson/plugins/repo/ManifestAction/badge.jelly | 8 ++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
create mode 100644 src/main/resources/hudson/plugins/repo/ManifestAction/badge.jelly
diff --git a/src/main/java/hudson/plugins/repo/ManifestAction.java b/src/main/java/hudson/plugins/repo/ManifestAction.java
index 9476197..9762dd6 100644
--- a/src/main/java/hudson/plugins/repo/ManifestAction.java
+++ b/src/main/java/hudson/plugins/repo/ManifestAction.java
@@ -28,6 +28,7 @@
import org.kohsuke.stapler.export.ExportedBean;
+import hudson.model.BuildBadgeAction;
import hudson.model.Run;
import jenkins.model.RunAction2;
@@ -36,7 +37,7 @@
* to recreate the exact state of the repository when the build was run.
*/
@ExportedBean(defaultVisibility = 999)
-public class ManifestAction implements RunAction2 {
+public class ManifestAction implements RunAction2, BuildBadgeAction {
private static Logger debug = Logger
.getLogger("hudson.plugins.repo.ManifestAction");
diff --git a/src/main/resources/hudson/plugins/repo/ManifestAction/badge.jelly b/src/main/resources/hudson/plugins/repo/ManifestAction/badge.jelly
new file mode 100644
index 0000000..ce6f6e4
--- /dev/null
+++ b/src/main/resources/hudson/plugins/repo/ManifestAction/badge.jelly
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
From 572ddac2125c513ebc1a35e4852a98ada191dc8e Mon Sep 17 00:00:00 2001
From: Makson Lee
Date: Mon, 9 Dec 2019 17:29:44 +0800
Subject: [PATCH 135/184] Fix invalid platform flag issue
Change-Id: I46f02494f90719ca89db2a1722cd5ed9a1951f18
---
src/main/java/hudson/plugins/repo/RepoScm.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index aa2cf22..6e0671a 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -500,7 +500,7 @@ public void setManifestGroup(@CheckForNull final String manifestGroup) {
*/
@DataBoundSetter
public void setManifestPlatform(@CheckForNull final String manifestPlatform) {
- this.manifestPlatform = manifestPlatform;
+ this.manifestPlatform = Util.fixEmptyAndTrim(manifestPlatform);
}
/**
From c68374da3deb085cb4475427a66c22c533b10220 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 24 Jan 2020 16:51:33 +0100
Subject: [PATCH 136/184] [maven-release-plugin] prepare release repo-1.12.1
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index fec622b..92d65ef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.12.1-SNAPSHOT
+ 1.12.1
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.12.1
From b06f6f222ee4de7aebd6c4f6e5b55360953cd329 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 24 Jan 2020 16:51:41 +0100
Subject: [PATCH 137/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 92d65ef..1a37b2d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.12.1
+ 1.12.2-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.12.1
+ HEAD
From f2e743afc861d837da96fe476160e73035b542eb Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 31 Jan 2020 16:48:13 +0100
Subject: [PATCH 138/184] [maven-release-plugin] prepare release repo-1.12.2
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 1a37b2d..44241af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.12.2-SNAPSHOT
+ 1.12.2
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.12.2
From ff8e80a194288e9083aebbc4023841912cdfcc1b Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 31 Jan 2020 16:48:21 +0100
Subject: [PATCH 139/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 44241af..03dd0b4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.12.2
+ 1.12.3-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.12.2
+ HEAD
From 43f4b9e7a6e0b1560d4ab25d2a455076fc1feae5 Mon Sep 17 00:00:00 2001
From: Christian Koestlin
Date: Wed, 12 Feb 2020 08:12:23 +0100
Subject: [PATCH 140/184] Add support for repo-branch
With python3 arriving at repo, google introduced the repo-1 or maint branch to not break old installations. This commit facilitates this.
---
.../java/hudson/plugins/repo/RepoScm.java | 28 ++++++++++++++++++-
.../hudson/plugins/repo/RepoScm/config.jelly | 4 +++
src/main/webapp/help-repoBranch.html | 6 ++++
3 files changed, 37 insertions(+), 1 deletion(-)
create mode 100644 src/main/webapp/help-repoBranch.html
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 0de93d8..3b27e51 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -91,6 +91,7 @@ public class RepoScm extends SCM implements Serializable {
@CheckForNull private String manifestGroup;
@CheckForNull private String manifestPlatform;
@CheckForNull private String repoUrl;
+ @CheckForNull private String repoBranch;
@CheckForNull private String mirrorDir;
@CheckForNull private String manifestBranch;
@CheckForNull private int jobs;
@@ -205,6 +206,15 @@ public String getRepoUrl() {
return repoUrl;
}
+ /**
+ * Returns the repo branch. by default, this is null and
+ * repo is used from the default branch
+ */
+ @Exported
+ public String getRepoBranch() {
+ return repoBranch;
+ }
+
/**
* Returns the name of the mirror directory. By default, this is null and
* repo does not use a mirror.
@@ -376,7 +386,7 @@ public Map getExtraEnvVars() {
* @param destinationDir If not null then the source is synced to the destinationDir
* subdirectory of the workspace.
* @param repoUrl If not null then use this url as repo base,
- * instead of the default
+ * instead of the default.
* @param currentBranch If this value is true, add the "-c" option when executing
* "repo sync".
* @param resetFirst If this value is true, do "repo forall -c 'git reset --hard'"
@@ -432,6 +442,7 @@ public RepoScm(final String manifestRepositoryUrl) {
manifestFile = null;
manifestGroup = null;
repoUrl = null;
+ repoBranch = null;
mirrorDir = null;
manifestBranch = null;
jobs = 0;
@@ -662,6 +673,18 @@ public void setRepoUrl(@CheckForNull final String repoUrl) {
this.repoUrl = Util.fixEmptyAndTrim(repoUrl);
}
+ /**
+ * Set the repo branch.
+ *
+ * @param repoBranch
+ * If not null then use this as branch for repo itself
+ * instead of the default.
+ */
+ @DataBoundSetter
+ public void setRepoBranch(@CheckForNull final String repoBranch) {
+ this.repoBranch = Util.fixEmptyAndTrim(repoBranch);
+ }
+
/**
* Enables --force-sync option on repo sync command.
* @param forceSync
@@ -969,6 +992,9 @@ private boolean checkoutCode(final Launcher launcher,
commands.add("--repo-url=" + env.expand(repoUrl));
commands.add("--no-repo-verify");
}
+ if (repoBranch != null) {
+ commands.add("--repo-branch=" + env.expand(repoBranch));
+ }
if (manifestGroup != null) {
commands.add("-g");
commands.add(env.expand(manifestGroup));
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index 5c41b16..b9296e2 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -41,6 +41,10 @@
+
+
+
+
diff --git a/src/main/webapp/help-repoBranch.html b/src/main/webapp/help-repoBranch.html
new file mode 100644
index 0000000..b2277b5
--- /dev/null
+++ b/src/main/webapp/help-repoBranch.html
@@ -0,0 +1,6 @@
+
+
+ Use a specific branch for pulling repo itself. By default this is empty, and repo will be using its
+ default branch (i.e. stable)
+
+
From 1dfc7834b0d62211446998cfae39ec14cb098347 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 21 Feb 2020 15:37:32 +0100
Subject: [PATCH 141/184] [maven-release-plugin] prepare release repo-1.13.0
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 03dd0b4..177f13a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.12.3-SNAPSHOT
+ 1.13.0
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.13.0
From 599f65959ff58e060ef1c23133baf895cda5d9b3 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 21 Feb 2020 15:37:40 +0100
Subject: [PATCH 142/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 177f13a..b191998 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.13.0
+ 1.13.1-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.13.0
+ HEAD
From be57ac59b58f52eea7194513efbfc8ccdcfa7d4e Mon Sep 17 00:00:00 2001
From: Francois Ferrand
Date: Thu, 23 Apr 2020 18:44:12 +0200
Subject: [PATCH 143/184] Fix displaying multiple manifests.
When multiple repo checkouts are performed in the same build, multiple
ManifestActions are created (which is expected). However, they all point
to the same manifest content: which this commit fixes.
---
.../hudson/plugins/repo/ManifestAction.java | 39 +++++++++++++++++--
.../java/hudson/plugins/repo/RepoScm.java | 6 ++-
2 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/ManifestAction.java b/src/main/java/hudson/plugins/repo/ManifestAction.java
index 9762dd6..436d784 100644
--- a/src/main/java/hudson/plugins/repo/ManifestAction.java
+++ b/src/main/java/hudson/plugins/repo/ManifestAction.java
@@ -23,6 +23,7 @@
*/
package hudson.plugins.repo;
+import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -32,6 +33,8 @@
import hudson.model.Run;
import jenkins.model.RunAction2;
+import javax.annotation.CheckForNull;
+
/**
* A Manifest Action displays the static manifest information needed
* to recreate the exact state of the repository when the build was run.
@@ -44,6 +47,12 @@ public class ManifestAction implements RunAction2, BuildBadgeAction {
private transient Run, ?> run;
+ /**
+ * Allow disambiguation of the action url when multiple {@link RevisionState} actions present.
+ */
+ @CheckForNull
+ private Integer index;
+
/**
* Constructs the manifest action object.
* @param run Build whose manifest we wish to display.
@@ -52,6 +61,27 @@ public class ManifestAction implements RunAction2, BuildBadgeAction {
this.run = run;
}
+ /**
+ * Sets an identifier used to disambiguate multiple {@link RevisionState} actions attached to a
+ * {@link Run}.
+ *
+ * @param index the index, indexes less than or equal to {@code 1} will be discarded.
+ */
+ public void setIndex(final Integer index) {
+ this.index = index == null || index <= 1 ? null : index;
+ }
+
+ /**
+ * Gets the identifier used to disambiguate multiple {@link RevisionState} actions attached to
+ * a {@link Run}.
+ *
+ * @return the index.
+ */
+ @CheckForNull
+ public Integer getIndex() {
+ return index;
+ }
+
@Override
public void onAttached(final Run, ?> r) {
this.run = r;
@@ -87,7 +117,7 @@ public String getDisplayName() {
* Returns the name of the Url to use for the action.
*/
public final String getUrlName() {
- return "repo-manifest";
+ return index == null ? "repo-manifest" : "repo-manifest-" + index;
}
/**
@@ -96,9 +126,10 @@ public final String getUrlName() {
public String getManifest() {
String result = "";
try {
- final RevisionState revisionState = run.getAction(RevisionState.class);
- if (revisionState != null) {
- result = revisionState.getManifest();
+ final int i = index == null ? 0 : index;
+ final List revisionStates = run.getActions(RevisionState.class);
+ if (revisionStates.size() >= i) {
+ result = revisionStates.get(i).getManifest();
}
} catch (Exception e) {
debug.log(Level.WARNING, "Error getting revision state {0}", e.getMessage());
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 3b27e51..7ba9906 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -895,7 +895,11 @@ public void checkout(
repoDir,
showAllChanges);
}
- build.addAction(new ManifestAction(build));
+
+ ManifestAction manifestAction = new ManifestAction(build);
+ int revisionStateCount = build.getActions(RevisionState.class).size();
+ manifestAction.setIndex(revisionStateCount);
+ build.addAction(manifestAction);
}
private int doSync(final Launcher launcher, @Nonnull final FilePath workspace,
From eab05958aa72d7825f7a5ca042ff1c96a0f1d706 Mon Sep 17 00:00:00 2001
From: Francois Ferrand
Date: Fri, 1 May 2020 12:33:09 +0200
Subject: [PATCH 144/184] Support changelog with shallow checkout
When performing shallow checkout, the 'previous' revision may not be
present, which causes the `git log` command to fail.
When this happens, simply show HEAD in change in changelog, like the git
plugin does.
---
checkstyle.xml | 6 ++++--
src/main/java/hudson/plugins/repo/ChangeLog.java | 9 +++++++--
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/checkstyle.xml b/checkstyle.xml
index d589e86..9ce7098 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -6,7 +6,7 @@
-->
@@ -41,7 +41,9 @@ Checkstyle configuration that checks coding conventions.
-
+
+
+
diff --git a/src/main/java/hudson/plugins/repo/ChangeLog.java b/src/main/java/hudson/plugins/repo/ChangeLog.java
index fbd48f3..74eb430 100644
--- a/src/main/java/hudson/plugins/repo/ChangeLog.java
+++ b/src/main/java/hudson/plugins/repo/ChangeLog.java
@@ -172,8 +172,13 @@ private static List generateChangeLog(
// from Gerrit. It might be tricky with master/slave setup.
commands.add(change.getRevision() + ".." + newRevision);
final ByteArrayOutputStream gitOutput = new ByteArrayOutputStream();
- launcher.launch().stdout(gitOutput).pwd(gitdir).cmds(commands)
- .join();
+ if (launcher.launch().stdout(gitOutput).pwd(gitdir).cmds(commands)
+ .join() != 0) {
+ commands.remove(commands.size() - 1);
+ commands.add("HEAD");
+ launcher.launch().stdout(gitOutput).pwd(gitdir).cmds(commands)
+ .join();
+ }
final String o = new String(gitOutput.toByteArray(), Charset.defaultCharset());
final String[] changelogs = o.split(
"\\[\\[\\]\\]");
From ff1cd0a651ace1cece69b1d33f7c9cd8cfacbbc8 Mon Sep 17 00:00:00 2001
From: Francois Ferrand
Date: Thu, 23 Apr 2020 20:34:10 +0200
Subject: [PATCH 145/184] Support multiple checkouts in changelog.
Compute SCMRevisionState against checkout of the same manifest (URL,
branch and file), to get significant log when multiple checkouts are
performed.
---
pom.xml | 2 +-
.../hudson/plugins/repo/ManifestAction.java | 9 ++--
.../java/hudson/plugins/repo/RepoScm.java | 43 +++++++++++++------
.../hudson/plugins/repo/RevisionState.java | 28 +++++++++++-
.../plugins/repo/TestRevisionState.java | 10 ++---
5 files changed, 68 insertions(+), 24 deletions(-)
diff --git a/pom.xml b/pom.xml
index b191998..7f14cbe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.13.1-SNAPSHOT
+ 1.13.2
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
diff --git a/src/main/java/hudson/plugins/repo/ManifestAction.java b/src/main/java/hudson/plugins/repo/ManifestAction.java
index 436d784..f043e91 100644
--- a/src/main/java/hudson/plugins/repo/ManifestAction.java
+++ b/src/main/java/hudson/plugins/repo/ManifestAction.java
@@ -23,6 +23,7 @@
*/
package hudson.plugins.repo;
+import java.io.Serializable;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -40,10 +41,10 @@
* to recreate the exact state of the repository when the build was run.
*/
@ExportedBean(defaultVisibility = 999)
-public class ManifestAction implements RunAction2, BuildBadgeAction {
-
+public class ManifestAction implements RunAction2, Serializable, BuildBadgeAction {
private static Logger debug = Logger
.getLogger("hudson.plugins.repo.ManifestAction");
+ private static final long serialVersionUID = 1;
private transient Run, ?> run;
@@ -126,9 +127,9 @@ public final String getUrlName() {
public String getManifest() {
String result = "";
try {
- final int i = index == null ? 0 : index;
+ final int i = index == null ? 0 : index - 1;
final List revisionStates = run.getActions(RevisionState.class);
- if (revisionStates.size() >= i) {
+ if (revisionStates.size() > i && i >= 0) {
result = revisionStates.get(i).getManifest();
}
} catch (Exception e) {
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 7ba9906..bd3fdf8 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -800,12 +800,15 @@ public PollingResult compareRemoteRevisionWith(
InterruptedException {
SCMRevisionState myBaseline = baseline;
final EnvVars env = getEnvVars(null, job);
+ final String expandedManifestUrl = env.expand(manifestRepositoryUrl);
final String expandedManifestBranch = env.expand(manifestBranch);
+ final String expandedManifestFile = env.expand(manifestFile);
final Run, ?> lastRun = job.getLastBuild();
if (myBaseline == SCMRevisionState.NONE) {
// Probably the first build, or possibly an aborted build.
- myBaseline = getLastState(lastRun, expandedManifestBranch);
+ myBaseline = getLastState(lastRun, expandedManifestUrl,
+ expandedManifestBranch, expandedManifestFile);
if (myBaseline == SCMRevisionState.NONE) {
return PollingResult.BUILD_NOW;
}
@@ -831,7 +834,8 @@ public PollingResult compareRemoteRevisionWith(
final RevisionState currentState = new RevisionState(
getStaticManifest(launcher, repoDir, listener.getLogger(), env),
getManifestRevision(launcher, repoDir, listener.getLogger(), env),
- expandedManifestBranch, listener.getLogger());
+ expandedManifestUrl, expandedManifestBranch, expandedManifestFile,
+ listener.getLogger());
final Change change;
if (currentState.equals(myBaseline)) {
@@ -876,15 +880,18 @@ public void checkout(
getStaticManifest(launcher, repoDir, listener.getLogger(), env);
final String manifestRevision =
getManifestRevision(launcher, repoDir, listener.getLogger(), env);
+ final String expandedUrl = env.expand(manifestRepositoryUrl);
final String expandedBranch = env.expand(manifestBranch);
+ final String expandedFile = env.expand(manifestFile);
final RevisionState currentState =
- new RevisionState(manifest, manifestRevision, expandedBranch,
- listener.getLogger());
+ new RevisionState(manifest, manifestRevision, expandedUrl,
+ expandedBranch, expandedFile, listener.getLogger());
+ // TODO: check if already present...
build.addAction(currentState);
final Run previousBuild = build.getPreviousBuild();
final SCMRevisionState previousState =
- getLastState(previousBuild, expandedBranch);
+ getLastState(previousBuild, expandedUrl, expandedBranch, expandedFile);
if (changelogFile != null) {
ChangeLog.saveChangeLog(
@@ -1105,21 +1112,31 @@ private String getManifestRevision(final Launcher launcher,
return manifestText;
}
+ private boolean isRelevantState(final RevisionState state, final String url,
+ final String branch, final String file) {
+ return StringUtils.equals(state.getBranch(), branch)
+ && StringUtils.equals(state.getUrl(), url)
+ && StringUtils.equals(state.getFile(), file);
+ }
+
@Nonnull
private SCMRevisionState getLastState(final Run, ?> lastBuild,
- final String expandedManifestBranch) {
+ final String expandedManifestUrl, final String expandedManifestBranch,
+ final String expandedManifestFile) {
if (lastBuild == null) {
return RevisionState.NONE;
}
- final RevisionState lastState =
- lastBuild.getAction(RevisionState.class);
- if (lastState != null
- && StringUtils.equals(lastState.getBranch(),
- expandedManifestBranch)) {
- return lastState;
+ final List lastStateList =
+ lastBuild.getActions(RevisionState.class);
+ for (RevisionState lastState : lastStateList) {
+ if (lastState != null
+ && isRelevantState(lastState, expandedManifestUrl,
+ expandedManifestBranch, expandedManifestFile)) {
+ return lastState;
+ }
}
return getLastState(lastBuild.getPreviousBuild(),
- expandedManifestBranch);
+ expandedManifestUrl, expandedManifestBranch, expandedManifestFile);
}
@Override
diff --git a/src/main/java/hudson/plugins/repo/RevisionState.java b/src/main/java/hudson/plugins/repo/RevisionState.java
index b01ce53..5808792 100644
--- a/src/main/java/hudson/plugins/repo/RevisionState.java
+++ b/src/main/java/hudson/plugins/repo/RevisionState.java
@@ -55,7 +55,9 @@ class RevisionState extends SCMRevisionState implements Serializable {
private final String manifest;
private final Map projects =
new TreeMap();
+ private final String url;
private final String branch;
+ private final String file;
private static Logger debug =
Logger.getLogger("hudson.plugins.repo.RevisionState");
@@ -67,15 +69,22 @@ class RevisionState extends SCMRevisionState implements Serializable {
* A string representation of the static manifest XML file
* @param manifestRevision
* Git hash of the manifest repo
+ * @param url
+ * The URL of the manifest
* @param branch
* The branch of the manifest project
+ * @param file
+ * The path to the manifest file
* @param logger
* A PrintStream for logging errors
*/
RevisionState(final String manifest, final String manifestRevision,
- final String branch, @Nullable final PrintStream logger) {
+ final String url, final String branch, final String file,
+ @Nullable final PrintStream logger) {
this.manifest = manifest;
+ this.url = url;
this.branch = branch;
+ this.file = file;
try {
final InputSource xmlSource = new InputSource();
xmlSource.setCharacterStream(new StringReader(manifest));
@@ -151,10 +160,20 @@ public boolean equals(final Object obj) {
@Override
public int hashCode() {
return (branch != null ? branch.hashCode() : 0)
+ ^ (url != null ? url.hashCode() : 0)
+ ^ (file != null ? file.hashCode() : 0)
^ (manifest != null ? manifest.hashCode() : 0)
^ projects.hashCode();
}
+ /**
+ * Returns the manifest repository's url when this state was
+ * created.
+ */
+ public String getUrl() {
+ return url;
+ }
+
/**
* Returns the manifest repository's branch name when this state was
* created.
@@ -163,6 +182,13 @@ public String getBranch() {
return branch;
}
+ /**
+ * Returns the path to the manifest file used when this state was created.
+ */
+ public String getFile() {
+ return file;
+ }
+
/**
* Returns the static XML manifest for this repository state in String form.
*/
diff --git a/src/test/java/hudson/plugins/repo/TestRevisionState.java b/src/test/java/hudson/plugins/repo/TestRevisionState.java
index fd5b072..271825a 100644
--- a/src/test/java/hudson/plugins/repo/TestRevisionState.java
+++ b/src/test/java/hudson/plugins/repo/TestRevisionState.java
@@ -74,12 +74,12 @@ public class TestRevisionState extends TestCase {
protected void setUp() throws Exception {
super.setUp();
- stateOne = new RevisionState(manifestOne, "a", "master", null);
- stateOneCopy = new RevisionState(manifestOne, "a", "master", null);
- stateTwo = new RevisionState(manifestTwo, "a", "master", null);
- stateThree = new RevisionState(manifestThree, "a", "master", null);
+ stateOne = new RevisionState(manifestOne, "a", "https://my.gerrit.com/myrepo", "master", "default.xml", null);
+ stateOneCopy = new RevisionState(manifestOne, "a", "https://my.gerrit.com/myrepo", "master", "default.xml", null);
+ stateTwo = new RevisionState(manifestTwo, "a", "https://my.gerrit.com/myrepo", "master", "default.xml", null);
+ stateThree = new RevisionState(manifestThree, "a", "https://my.gerrit.com/myrepo", "master", "default.xml", null);
- stateMChange = new RevisionState(manifestThree, "b", "master", null);
+ stateMChange = new RevisionState(manifestThree, "b", "https://my.gerrit.com/myrepo", "master", "default.xml", null);
}
/**
From 07083b812b109adfa72de0e2508e86e4b42f8142 Mon Sep 17 00:00:00 2001
From: Francois Ferrand
Date: Tue, 28 Apr 2020 16:54:12 +0200
Subject: [PATCH 146/184] Display the "source" of manifest.
In ManifestAction page, show the URL, Branch and File of the manifest
which was used. This is especially useful when performing multiple
checkouts in the same job.
---
.../hudson/plugins/repo/ManifestAction.java | 44 ++++++++++++++-----
.../java/hudson/plugins/repo/RepoScm.java | 2 +-
.../plugins/repo/ManifestAction/index.jelly | 2 +
3 files changed, 36 insertions(+), 12 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/ManifestAction.java b/src/main/java/hudson/plugins/repo/ManifestAction.java
index f043e91..2bac3b6 100644
--- a/src/main/java/hudson/plugins/repo/ManifestAction.java
+++ b/src/main/java/hudson/plugins/repo/ManifestAction.java
@@ -47,6 +47,7 @@ public class ManifestAction implements RunAction2, Serializable, BuildBadgeActio
private static final long serialVersionUID = 1;
private transient Run, ?> run;
+ private transient RevisionState revisionState;
/**
* Allow disambiguation of the action url when multiple {@link RevisionState} actions present.
@@ -70,6 +71,16 @@ public class ManifestAction implements RunAction2, Serializable, BuildBadgeActio
*/
public void setIndex(final Integer index) {
this.index = index == null || index <= 1 ? null : index;
+ try {
+ final int i = index == null ? 0 : index - 1;
+ final List revisionStates = run.getActions(RevisionState.class);
+ if (revisionStates.size() > i && i >= 0) {
+ revisionState = revisionStates.get(i);
+ }
+ } catch (Exception e) {
+ debug.log(Level.WARNING, "Error getting revision state {0}", e.getMessage());
+ revisionState = null;
+ }
}
/**
@@ -125,16 +136,27 @@ public final String getUrlName() {
* Gets a String representation of the static manifest for this repo snapshot.
*/
public String getManifest() {
- String result = "";
- try {
- final int i = index == null ? 0 : index - 1;
- final List revisionStates = run.getActions(RevisionState.class);
- if (revisionStates.size() > i && i >= 0) {
- result = revisionStates.get(i).getManifest();
- }
- } catch (Exception e) {
- debug.log(Level.WARNING, "Error getting revision state {0}", e.getMessage());
- }
- return result;
+ return revisionState == null ? "" : revisionState.getManifest();
+ }
+
+ /**
+ * Returns the manifest repository's url for this repo snapshot.
+ */
+ public String getUrl() {
+ return revisionState == null ? "" : revisionState.getUrl();
+ }
+
+ /**
+ * Returns the manifest repository's branch name for this repo snapshot.
+ */
+ public String getBranch() {
+ return revisionState == null ? "" : revisionState.getBranch();
+ }
+
+ /**
+ * Returns the path to the manifest file for this repo snapshot.
+ */
+ public String getFile() {
+ return revisionState == null ? "" : revisionState.getFile();
}
}
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index bd3fdf8..f333601 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -886,7 +886,6 @@ public void checkout(
final RevisionState currentState =
new RevisionState(manifest, manifestRevision, expandedUrl,
expandedBranch, expandedFile, listener.getLogger());
- // TODO: check if already present...
build.addAction(currentState);
final Run previousBuild = build.getPreviousBuild();
@@ -903,6 +902,7 @@ public void checkout(
showAllChanges);
}
+ // TODO: create a single action displaying all manifests?
ManifestAction manifestAction = new ManifestAction(build);
int revisionStateCount = build.getActions(RevisionState.class).size();
manifestAction.setIndex(revisionStateCount);
diff --git a/src/main/resources/hudson/plugins/repo/ManifestAction/index.jelly b/src/main/resources/hudson/plugins/repo/ManifestAction/index.jelly
index 4b4b2ec..51bf4ab 100644
--- a/src/main/resources/hudson/plugins/repo/ManifestAction/index.jelly
+++ b/src/main/resources/hudson/plugins/repo/ManifestAction/index.jelly
@@ -16,6 +16,8 @@
To recreate this build, copy the below manifest and past it to .repo/manifest.xml, then run 'repo sync'.
When done, be sure to undo changes to the .repo/manifest.xml file and repo sync again.
+ Generated from ${it.file} in branch ${it.branch} of ${it.url}.
+
Manifest File:
From c19eef55f58aff858b75a4b61d913c30f7b6c3d5 Mon Sep 17 00:00:00 2001
From: Tim Jacomb
Date: Sat, 25 Jul 2020 14:22:01 +0100
Subject: [PATCH 147/184] Remove unneeded configuration from buildPlugin
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index d78857d..5b60d43 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1 +1 @@
-buildPlugin(platforms: ['linux'], findbugs: [run: true, archive:true, unstableTotalAll: '0'], checkstyle: [run: true, archive:true, unstableTotalAll: '0'])
+buildPlugin(platforms: ['linux'])
From 732cb446d2e19555115008f5a236d314d9982d2d Mon Sep 17 00:00:00 2001
From: Adrien Bioteau
Date: Mon, 24 Aug 2020 16:04:15 +0200
Subject: [PATCH 148/184] Add option to enable --worktree option to repo init
---
.../java/hudson/plugins/repo/RepoScm.java | 25 +++++++++++++++++++
.../hudson/plugins/repo/RepoScm/config.jelly | 4 +++
src/main/webapp/help-worktree.html | 5 ++++
.../java/hudson/plugins/repo/TestRepoScm.java | 7 ++++++
4 files changed, 41 insertions(+)
create mode 100644 src/main/webapp/help-worktree.html
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index f333601..d57720d 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -111,6 +111,7 @@ public class RepoScm extends SCM implements Serializable {
@CheckForNull private Set ignoreProjects;
@CheckForNull private EnvVars extraEnvVars;
@CheckForNull private boolean noCloneBundle;
+ @CheckForNull private boolean worktree;
/**
* Returns the manifest repository URL.
@@ -335,6 +336,13 @@ public boolean isNoTags() {
public boolean isNoCloneBundle() {
return noCloneBundle;
}
+ /**
+ * Returns the value of isWorktree.
+ */
+ @Exported
+ public boolean isWorktree() {
+ return worktree;
+ }
/**
* Returns the value of manifestSubmodules.
@@ -428,6 +436,7 @@ public RepoScm(final String manifestRepositoryUrl,
setShowAllChanges(showAllChanges);
setRepoUrl(repoUrl);
ignoreProjects = Collections.emptySet();
+ setWorktree(false);
}
/**
@@ -461,6 +470,7 @@ public RepoScm(final String manifestRepositoryUrl) {
fetchSubmodules = false;
ignoreProjects = Collections.emptySet();
noCloneBundle = false;
+ worktree = false;
}
/**
@@ -661,6 +671,18 @@ public void setNoCloneBundle(final boolean noCloneBundle) {
this.noCloneBundle = noCloneBundle;
}
+ /**
+ * Set worktree.
+ *
+ * @param worktree
+ * If this value is true, add the "--worktree" option when
+ * running the "repo init" command.
+ */
+ @DataBoundSetter
+ public void setWorktree(final boolean worktree) {
+ this.worktree = worktree;
+ }
+
/**
* Set the repo url.
*
@@ -1020,6 +1042,9 @@ private boolean checkoutCode(final Launcher launcher,
if (isNoCloneBundle()) {
commands.add("--no-clone-bundle");
}
+ if (isWorktree()) {
+ commands.add("--worktree");
+ }
if (currentBranch) {
commands.add("--current-branch");
}
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index b9296e2..a57021e 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -104,5 +104,9 @@
+
+
+
+
diff --git a/src/main/webapp/help-worktree.html b/src/main/webapp/help-worktree.html
new file mode 100644
index 0000000..f2464f3
--- /dev/null
+++ b/src/main/webapp/help-worktree.html
@@ -0,0 +1,5 @@
+
+
+ Use `git worktree` for checkouts (At least, Git version 2.15 is required to avoid dangerous gc bugs). Usefull under Windows because it no longer require symlinks at all.
+
+
diff --git a/src/test/java/hudson/plugins/repo/TestRepoScm.java b/src/test/java/hudson/plugins/repo/TestRepoScm.java
index 2c1381e..d9c1bbb 100644
--- a/src/test/java/hudson/plugins/repo/TestRepoScm.java
+++ b/src/test/java/hudson/plugins/repo/TestRepoScm.java
@@ -64,4 +64,11 @@ public void testCleanFirst() {
scm.setCleanFirst(true);
assertEquals(true, scm.isCleanFirst());
}
+
+ public void testWorktree() {
+ RepoScm scm = new RepoScm("http://manifesturl");
+ assertEquals(false, scm.isWorktree());
+ scm.setWorktree(true);
+ assertEquals(true, scm.isWorktree());
+ }
}
From 67734512025379f1f079e23eaba05871828e3f9f Mon Sep 17 00:00:00 2001
From: Typz
Date: Tue, 29 Sep 2020 16:17:55 +0200
Subject: [PATCH 149/184] Fix incorrect version update in pom
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 7f14cbe..b191998 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.13.2
+ 1.13.1-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
From 291dc3c7fc56631c7336b0289c7d7058f2a05c58 Mon Sep 17 00:00:00 2001
From: Francois Ferrand
Date: Tue, 20 Oct 2020 18:36:05 +0200
Subject: [PATCH 150/184] [maven-release-plugin] prepare release repo-1.14.0
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index b191998..d627cf0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.13.1-SNAPSHOT
+ 1.14.0
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.14.0
From db4d71f0d9f2dd70e9505776a13da828f605caab Mon Sep 17 00:00:00 2001
From: Francois Ferrand
Date: Tue, 20 Oct 2020 18:36:15 +0200
Subject: [PATCH 151/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index d627cf0..6b3fdd5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.14.0
+ 1.14.1-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -127,7 +127,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.14.0
+ HEAD
From 7edc4299387f7908224acbaa57d9c2b2946c8ad9 Mon Sep 17 00:00:00 2001
From: zwx168238
Date: Thu, 17 Dec 2020 19:34:40 +0800
Subject: [PATCH 152/184] enable multithreading support when jobs was set
Signed-off-by: zwx168238
---
src/main/java/hudson/plugins/repo/RepoScm.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index d57720d..c53a699 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -940,6 +940,9 @@ private int doSync(final Launcher launcher, @Nonnull final FilePath workspace,
if (resetFirst) {
commands.add(getDescriptor().getExecutable());
commands.add("forall");
+ if (jobs > 0) {
+ commands.add("--jobs=" + jobs);
+ }
commands.add("-c");
commands.add("git reset --hard");
int resetCode = launcher.launch().stdout(logger)
@@ -953,6 +956,9 @@ private int doSync(final Launcher launcher, @Nonnull final FilePath workspace,
if (cleanFirst) {
commands.add(getDescriptor().getExecutable());
commands.add("forall");
+ if (jobs > 0) {
+ commands.add("--jobs=" + jobs);
+ }
commands.add("-c");
commands.add("git clean -fdx");
int cleanCode = launcher.launch().stdout(logger)
From a7a8fea9b30e5aade6b76594a7d61cf6bf508ff9 Mon Sep 17 00:00:00 2001
From: Adrien Bioteau
Date: Wed, 9 Jun 2021 08:55:53 +0200
Subject: [PATCH 153/184] Update pom.xml
Fix not found artifact org.netbeans.modules:org-netbeans-insane:jar:RELEASE802
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 6b3fdd5..2c7b5ef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
org.jenkins-ci.plugins
plugin
- 3.53
+ 3.56
From 84517ffd1f8734c6bcbcbd71c18587a35644fc06 Mon Sep 17 00:00:00 2001
From: Adrien Bioteau
Date: Wed, 9 Jun 2021 08:56:14 +0200
Subject: [PATCH 154/184] Update pom.xml
Add properties to define version of plugin
---
pom.xml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 2c7b5ef..1b648d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,13 +9,15 @@
org.jenkins-ci.plugins
repo
- 1.14.1-SNAPSHOT
+ ${revision}${changelist}
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
https://github.com/jenkinsci/repo-plugin/blob/master/doc/README.adoc
+ 1.14.1
+ -SNAPSHOT
2.60.3
8
UTF-8
From 3da9753b6c25f7807cbab95198bca1f3033865be Mon Sep 17 00:00:00 2001
From: Adrien Bioteau
Date: Mon, 28 Jun 2021 14:00:34 +0200
Subject: [PATCH 155/184] Cleanup local manifest from a previous build before
initializing workspace
Fix checkout when previous build has a bad local manifest (repo init command failed)
---
.../java/hudson/plugins/repo/RepoScm.java | 41 +++++++++++--------
1 file changed, 23 insertions(+), 18 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index d57720d..1586019 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -1003,6 +1003,18 @@ private boolean checkoutCode(final Launcher launcher,
debug.log(Level.INFO, "Checking out code in: {0}", workspace.getName());
+ FilePath rdir = workspace.child(".repo");
+ FilePath lmdir = rdir.child("local_manifests");
+ if (rdir.exists()) {
+ // Delete the legacy local_manifest.xml in case it exists from a previous build
+ rdir.child("local_manifest.xml").delete();
+
+ if (lmdir.exists()) {
+ // Delete contents of local_manifests in case it exists from a previous build
+ lmdir.deleteContents();
+ }
+ }
+
commands.add(getDescriptor().getExecutable());
if (trace) {
commands.add("--trace");
@@ -1060,27 +1072,20 @@ private boolean checkoutCode(final Launcher launcher,
if (returnCode != 0) {
return false;
}
- //{
- FilePath rdir = workspace.child(".repo");
- FilePath lmdir = rdir.child("local_manifests");
- // Delete the legacy local_manifest.xml in case it exists from a previous build
- rdir.child("local_manifest.xml").delete();
- if (lmdir.exists()) {
- lmdir.deleteContents();
- } else {
+
+ if (localManifest != null) {
+ if (!lmdir.exists()) {
lmdir.mkdirs();
}
- if (localManifest != null) {
- FilePath lm = lmdir.child("local.xml");
- String expandedLocalManifest = env.expand(localManifest);
- if (expandedLocalManifest.startsWith("
Date: Fri, 2 Jul 2021 15:01:27 +0200
Subject: [PATCH 156/184] Add buildEnvironment method to propagate information
from SCM to builds
---
.../java/hudson/plugins/repo/RepoScm.java | 25 +++++++++++++++++++
.../plugins/repo/RepoScm/buildEnv.groovy | 9 +++++++
.../plugins/repo/RepoScm/buildEnv.properties | 1 +
3 files changed, 35 insertions(+)
create mode 100644 src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.groovy
create mode 100644 src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.properties
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index d430906..b208f1f 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -1111,6 +1111,31 @@ private boolean checkoutCode(final Launcher launcher,
return true;
}
+ /**
+ * Adds environmental variables for the builds to the given map.
+ */
+ @Override
+ public void buildEnvironment(
+ @Nonnull final Run, ?> build,
+ @Nonnull final java.util.Map env) {
+ final Job, ?> job = build.getParent();
+ final EnvVars jobEnv = getEnvVars(null, job);
+
+ final String expandedManifestUrl = jobEnv.expand(manifestRepositoryUrl);
+ final String expandedManifestBranch = jobEnv.expand(manifestBranch);
+ final String expandedManifestFile = jobEnv.expand(manifestFile);
+
+ final List stateList = build.getActions(RevisionState.class);
+ for (RevisionState state : stateList) {
+ if (state != null
+ && isRelevantState(state, expandedManifestUrl,
+ expandedManifestBranch, expandedManifestFile)) {
+ env.put("REPO_MANIFEST_XML", state.getManifest());
+ break;
+ }
+ }
+ }
+
private String getStaticManifest(final Launcher launcher,
final FilePath workspace, final OutputStream logger,
final EnvVars env)
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.groovy b/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.groovy
new file mode 100644
index 0000000..a02e0f2
--- /dev/null
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.groovy
@@ -0,0 +1,9 @@
+package hudson.plugins.repo.RepoSCM
+
+def l = namespace(lib.JenkinsTagLib)
+
+['REPO_MANIFEST_XML'].each {name ->
+ l.buildEnvVar(name: name) {
+ raw(_("${name}.blurb"))
+ }
+}
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.properties b/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.properties
new file mode 100644
index 0000000..4a7b819
--- /dev/null
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.properties
@@ -0,0 +1 @@
+REPO_MANIFEST_XML.blurb=The static manifest (in XML format).
From 4e44fea2f9c35d3be79de8d7330e802db8f9b17e Mon Sep 17 00:00:00 2001
From: Adrien Bioteau
Date: Mon, 5 Jul 2021 08:14:04 +0200
Subject: [PATCH 157/184] Update checkstyle
Check header only on java source files
---
checkstyle.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/checkstyle.xml b/checkstyle.xml
index 9ce7098..973aab0 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -125,6 +125,7 @@ Checkstyle configuration that checks coding conventions.
+
From 1a8ddb63c73e470df49f35313b82abda2498b2a2 Mon Sep 17 00:00:00 2001
From: Adrien Bioteau
Date: Mon, 8 Nov 2021 11:44:37 +0100
Subject: [PATCH 158/184] Add method to get current revision state
---
.../java/hudson/plugins/repo/RepoScm.java | 60 ++++++++++++-------
1 file changed, 40 insertions(+), 20 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index b208f1f..d954e3f 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -1125,14 +1125,11 @@ public void buildEnvironment(
final String expandedManifestBranch = jobEnv.expand(manifestBranch);
final String expandedManifestFile = jobEnv.expand(manifestFile);
- final List stateList = build.getActions(RevisionState.class);
- for (RevisionState state : stateList) {
- if (state != null
- && isRelevantState(state, expandedManifestUrl,
- expandedManifestBranch, expandedManifestFile)) {
- env.put("REPO_MANIFEST_XML", state.getManifest());
- break;
- }
+ SCMRevisionState state = getState(build, expandedManifestUrl,
+ expandedManifestBranch, expandedManifestFile);
+
+ if (state != SCMRevisionState.NONE) {
+ env.put("REPO_MANIFEST_XML", ((RevisionState) state).getManifest());
}
}
@@ -1181,23 +1178,46 @@ private boolean isRelevantState(final RevisionState state, final String url,
}
@Nonnull
- private SCMRevisionState getLastState(final Run, ?> lastBuild,
- final String expandedManifestUrl, final String expandedManifestBranch,
+ private SCMRevisionState getState(final Run, ?> build,
+ final String expandedManifestUrl,
+ final String expandedManifestBranch,
final String expandedManifestFile) {
- if (lastBuild == null) {
- return RevisionState.NONE;
+ if (build == null) {
+ return SCMRevisionState.NONE;
}
- final List lastStateList =
- lastBuild.getActions(RevisionState.class);
- for (RevisionState lastState : lastStateList) {
- if (lastState != null
- && isRelevantState(lastState, expandedManifestUrl,
+
+ final List stateList =
+ build.getActions(RevisionState.class);
+ for (RevisionState state : stateList) {
+ if (state != null
+ && isRelevantState(state, expandedManifestUrl,
expandedManifestBranch, expandedManifestFile)) {
- return lastState;
+ return state;
}
}
- return getLastState(lastBuild.getPreviousBuild(),
- expandedManifestUrl, expandedManifestBranch, expandedManifestFile);
+
+ return SCMRevisionState.NONE;
+ }
+
+ @Nonnull
+ private SCMRevisionState getLastState(final Run, ?> lastBuild,
+ final String expandedManifestUrl,
+ final String expandedManifestBranch,
+ final String expandedManifestFile) {
+ if (lastBuild == null) {
+ return SCMRevisionState.NONE;
+ }
+
+ SCMRevisionState lastState = getState(lastBuild, expandedManifestUrl,
+ expandedManifestBranch, expandedManifestFile);
+
+ if (lastState == SCMRevisionState.NONE) {
+ lastState = getLastState(lastBuild.getPreviousBuild(),
+ expandedManifestUrl, expandedManifestBranch,
+ expandedManifestFile);
+ }
+
+ return lastState;
}
@Override
From 83c7c359a1c27117f477eb2e8507a92c8aa38459 Mon Sep 17 00:00:00 2001
From: Adrien Bioteau
Date: Thu, 25 Nov 2021 17:12:37 +0100
Subject: [PATCH 159/184] Update repo homepage url
---
README.txt | 2 +-
doc/README.adoc | 4 ++--
src/main/resources/index.jelly | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/README.txt b/README.txt
index 9e98d62..9ce1a85 100644
--- a/README.txt
+++ b/README.txt
@@ -1,4 +1,4 @@
-This plugin adds Repo (http://code.google.com/p/git-repo/) as an SCM
+This plugin adds Repo (https://gerrit.googlesource.com/git-repo) as an SCM
provider for Jenkins. Projects can use this plugin to only run builds
when changes are detected in any of the git repositories in the repo
manifest, to list the changes between builds, and to re-create the
diff --git a/doc/README.adoc b/doc/README.adoc
index c5ae0eb..c410a01 100644
--- a/doc/README.adoc
+++ b/doc/README.adoc
@@ -4,7 +4,7 @@ image:https://img.shields.io/jenkins/plugin/v/repo.svg[link="https://plugins.jen
image:https://img.shields.io/github/release/jenkinsci/repo-plugin.svg?label=changelog[link="https://github.com/jenkinsci/repo-plugin/releases/latest"]
image:https://img.shields.io/jenkins/plugin/i/repo.svg?color=blue[link="https://plugins.jenkins.io/repo"]
-This plugin adds http://code.google.com/p/git-repo/[Repo] as an SCM provider in Jenkins.
+This plugin adds https://gerrit.googlesource.com/git-repo[Repo] as an SCM provider in Jenkins.
*This plugin is up for adoption.* Want to help improve this plugin?
https://wiki.jenkins.io/display/JENKINS/Adopt+a+Plugin[Click here to
@@ -17,7 +17,7 @@ learn more]!
[[RepoPlugin-Description]]
== Description
-This plugin adds Repo (http://code.google.com/p/git-repo/) as an SCM
+This plugin adds Repo (https://gerrit.googlesource.com/git-repo) as an SCM
provider for Jenkins. Projects can use this plugin to only run builds
when changes are detected in any of the git repositories in the repo
manifest, to list the changes between builds, and to re-create the
diff --git a/src/main/resources/index.jelly b/src/main/resources/index.jelly
index c102c04..b6a6189 100644
--- a/src/main/resources/index.jelly
+++ b/src/main/resources/index.jelly
@@ -1,5 +1,5 @@
- This plugin allows use of
repo as
- an SCM tool. A repo binary is required.
+ This plugin allows use of
Repo as
+ an SCM tool. A repo binary is required.
\ No newline at end of file
From f72f07504e4828f62c95d3c418c3e1045080a777 Mon Sep 17 00:00:00 2001
From: Adrien Bioteau
Date: Thu, 25 Nov 2021 17:30:08 +0100
Subject: [PATCH 160/184] Propagate manifest url, branch and filename from SCM
step
---
src/main/java/hudson/plugins/repo/RepoScm.java | 3 +++
src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.groovy | 2 +-
.../resources/hudson/plugins/repo/RepoScm/buildEnv.properties | 3 +++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index d954e3f..4aba1d6 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -1129,6 +1129,9 @@ public void buildEnvironment(
expandedManifestBranch, expandedManifestFile);
if (state != SCMRevisionState.NONE) {
+ env.put("REPO_MANIFEST_URL", ((RevisionState) state).getUrl());
+ env.put("REPO_MANIFEST_BRANCH", ((RevisionState) state).getBranch());
+ env.put("REPO_MANIFEST_FILE", ((RevisionState) state).getFile());
env.put("REPO_MANIFEST_XML", ((RevisionState) state).getManifest());
}
}
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.groovy b/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.groovy
index a02e0f2..5936788 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.groovy
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.groovy
@@ -2,7 +2,7 @@ package hudson.plugins.repo.RepoSCM
def l = namespace(lib.JenkinsTagLib)
-['REPO_MANIFEST_XML'].each {name ->
+['REPO_MANIFEST_URL', 'REPO_MANIFEST_BRANCH', 'REPO_MANIFEST_FILE', 'REPO_MANIFEST_XML'].each {name ->
l.buildEnvVar(name: name) {
raw(_("${name}.blurb"))
}
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.properties b/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.properties
index 4a7b819..f881ee6 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.properties
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.properties
@@ -1 +1,4 @@
+REPO_MANIFEST_URL.blurb=The URL of manifest repository used.
+REPO_MANIFEST_BRANCH.blurb=The branch of the manifest repository used.
+REPO_MANIFEST_FILE.blurb=The manifest filename used.
REPO_MANIFEST_XML.blurb=The static manifest (in XML format).
From 5f82dd41cba7931b9eaf53ed7fc25803aa26bbae Mon Sep 17 00:00:00 2001
From: Adrien Bioteau
Date: Tue, 21 Dec 2021 16:07:27 +0100
Subject: [PATCH 161/184] Use default location for help files
---
.../hudson/plugins/repo/RepoScm/config.jelly | 55 ++++++++++---------
.../repo/RepoScm}/help-cleanFirst.html | 0
.../repo/RepoScm}/help-currentBranch.html | 0
.../plugins/repo/RepoScm}/help-depth.html | 0
.../repo/RepoScm}/help-destinationDir.html | 0
.../repo/RepoScm}/help-executable.html | 0
.../repo/RepoScm}/help-fetchSubmodules.html | 0
.../plugins/repo/RepoScm}/help-forceSync.html | 0
.../repo/RepoScm}/help-ignoreChanges.html | 0
.../plugins/repo/RepoScm}/help-jobs.html | 0
.../repo/RepoScm}/help-localManifest.html | 0
.../repo/RepoScm}/help-manifestBranch.html | 0
.../repo/RepoScm}/help-manifestFile.html | 0
.../repo/RepoScm}/help-manifestGroup.html | 0
.../repo/RepoScm}/help-manifestPlatform.html | 0
.../RepoScm}/help-manifestRepositoryUrl.html | 0
.../RepoScm}/help-manifestSubmodules.html | 0
.../plugins/repo/RepoScm}/help-mirrorDir.html | 0
.../repo/RepoScm}/help-noCloneBundle.html | 0
.../plugins/repo/RepoScm}/help-noTags.html | 0
.../plugins/repo/RepoScm}/help-quiet.html | 0
.../repo/RepoScm}/help-repoBranch.html | 0
.../plugins/repo/RepoScm}/help-repoUrl.html | 0
.../repo/RepoScm}/help-resetFirst.html | 0
.../repo/RepoScm}/help-showAllChanges.html | 0
.../plugins/repo/RepoScm}/help-trace.html | 0
.../plugins/repo/RepoScm}/help-worktree.html | 0
.../hudson/plugins/repo/RepoScm/help.html | 11 ++++
28 files changed, 39 insertions(+), 27 deletions(-)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-cleanFirst.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-currentBranch.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-depth.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-destinationDir.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-executable.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-fetchSubmodules.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-forceSync.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-ignoreChanges.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-jobs.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-localManifest.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-manifestBranch.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-manifestFile.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-manifestGroup.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-manifestPlatform.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-manifestRepositoryUrl.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-manifestSubmodules.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-mirrorDir.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-noCloneBundle.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-noTags.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-quiet.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-repoBranch.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-repoUrl.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-resetFirst.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-showAllChanges.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-trace.html (100%)
rename src/main/{webapp => resources/hudson/plugins/repo/RepoScm}/help-worktree.html (100%)
create mode 100644 src/main/resources/hudson/plugins/repo/RepoScm/help.html
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index a57021e..da2af27 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -7,104 +7,105 @@
xmlns:t="/lib/hudson"
xmlns:f="/lib/form">
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/src/main/webapp/help-cleanFirst.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-cleanFirst.html
similarity index 100%
rename from src/main/webapp/help-cleanFirst.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-cleanFirst.html
diff --git a/src/main/webapp/help-currentBranch.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-currentBranch.html
similarity index 100%
rename from src/main/webapp/help-currentBranch.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-currentBranch.html
diff --git a/src/main/webapp/help-depth.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-depth.html
similarity index 100%
rename from src/main/webapp/help-depth.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-depth.html
diff --git a/src/main/webapp/help-destinationDir.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-destinationDir.html
similarity index 100%
rename from src/main/webapp/help-destinationDir.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-destinationDir.html
diff --git a/src/main/webapp/help-executable.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-executable.html
similarity index 100%
rename from src/main/webapp/help-executable.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-executable.html
diff --git a/src/main/webapp/help-fetchSubmodules.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-fetchSubmodules.html
similarity index 100%
rename from src/main/webapp/help-fetchSubmodules.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-fetchSubmodules.html
diff --git a/src/main/webapp/help-forceSync.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-forceSync.html
similarity index 100%
rename from src/main/webapp/help-forceSync.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-forceSync.html
diff --git a/src/main/webapp/help-ignoreChanges.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-ignoreChanges.html
similarity index 100%
rename from src/main/webapp/help-ignoreChanges.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-ignoreChanges.html
diff --git a/src/main/webapp/help-jobs.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-jobs.html
similarity index 100%
rename from src/main/webapp/help-jobs.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-jobs.html
diff --git a/src/main/webapp/help-localManifest.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-localManifest.html
similarity index 100%
rename from src/main/webapp/help-localManifest.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-localManifest.html
diff --git a/src/main/webapp/help-manifestBranch.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-manifestBranch.html
similarity index 100%
rename from src/main/webapp/help-manifestBranch.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-manifestBranch.html
diff --git a/src/main/webapp/help-manifestFile.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-manifestFile.html
similarity index 100%
rename from src/main/webapp/help-manifestFile.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-manifestFile.html
diff --git a/src/main/webapp/help-manifestGroup.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-manifestGroup.html
similarity index 100%
rename from src/main/webapp/help-manifestGroup.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-manifestGroup.html
diff --git a/src/main/webapp/help-manifestPlatform.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-manifestPlatform.html
similarity index 100%
rename from src/main/webapp/help-manifestPlatform.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-manifestPlatform.html
diff --git a/src/main/webapp/help-manifestRepositoryUrl.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-manifestRepositoryUrl.html
similarity index 100%
rename from src/main/webapp/help-manifestRepositoryUrl.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-manifestRepositoryUrl.html
diff --git a/src/main/webapp/help-manifestSubmodules.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-manifestSubmodules.html
similarity index 100%
rename from src/main/webapp/help-manifestSubmodules.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-manifestSubmodules.html
diff --git a/src/main/webapp/help-mirrorDir.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-mirrorDir.html
similarity index 100%
rename from src/main/webapp/help-mirrorDir.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-mirrorDir.html
diff --git a/src/main/webapp/help-noCloneBundle.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-noCloneBundle.html
similarity index 100%
rename from src/main/webapp/help-noCloneBundle.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-noCloneBundle.html
diff --git a/src/main/webapp/help-noTags.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-noTags.html
similarity index 100%
rename from src/main/webapp/help-noTags.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-noTags.html
diff --git a/src/main/webapp/help-quiet.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-quiet.html
similarity index 100%
rename from src/main/webapp/help-quiet.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-quiet.html
diff --git a/src/main/webapp/help-repoBranch.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-repoBranch.html
similarity index 100%
rename from src/main/webapp/help-repoBranch.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-repoBranch.html
diff --git a/src/main/webapp/help-repoUrl.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-repoUrl.html
similarity index 100%
rename from src/main/webapp/help-repoUrl.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-repoUrl.html
diff --git a/src/main/webapp/help-resetFirst.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-resetFirst.html
similarity index 100%
rename from src/main/webapp/help-resetFirst.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-resetFirst.html
diff --git a/src/main/webapp/help-showAllChanges.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-showAllChanges.html
similarity index 100%
rename from src/main/webapp/help-showAllChanges.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-showAllChanges.html
diff --git a/src/main/webapp/help-trace.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-trace.html
similarity index 100%
rename from src/main/webapp/help-trace.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-trace.html
diff --git a/src/main/webapp/help-worktree.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-worktree.html
similarity index 100%
rename from src/main/webapp/help-worktree.html
rename to src/main/resources/hudson/plugins/repo/RepoScm/help-worktree.html
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/help.html b/src/main/resources/hudson/plugins/repo/RepoScm/help.html
new file mode 100644
index 0000000..b84d890
--- /dev/null
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/help.html
@@ -0,0 +1,11 @@
+
+
+ The repo plugin provides Repo as an SCM tools in Jenkins.
+
+
+
+ The repo plugin provides an SCM implementation to be used with the Pipeline SCM checkout step.
+ The Pipeline Syntax Snippet Generator guides the user to select repo plugin checkout options and provides online help for each of the options.
+
+
+
From 30e40419682fb752a6e7b95e7fc5110ba136ffb9 Mon Sep 17 00:00:00 2001
From: Adrien Bioteau
Date: Tue, 21 Dec 2021 17:17:47 +0100
Subject: [PATCH 162/184] Move and update README
---
doc/README.adoc => README.adoc | 21 +++++++++++++++++++--
README.txt | 13 -------------
2 files changed, 19 insertions(+), 15 deletions(-)
rename doc/README.adoc => README.adoc (90%)
delete mode 100644 README.txt
diff --git a/doc/README.adoc b/README.adoc
similarity index 90%
rename from doc/README.adoc
rename to README.adoc
index c410a01..f43478b 100644
--- a/doc/README.adoc
+++ b/README.adoc
@@ -1,3 +1,4 @@
+[[Repo-plugin]]
= Repo Plugin
image:https://img.shields.io/jenkins/plugin/v/repo.svg[link="https://plugins.jenkins.io/repo"]
@@ -10,8 +11,7 @@ This plugin adds https://gerrit.googlesource.com/git-repo[Repo] as an SCM provid
https://wiki.jenkins.io/display/JENKINS/Adopt+a+Plugin[Click here to
learn more]!
-:toc:
-:toc-placement: preamble
+:toc: preamble
:toclevels: 3
[[RepoPlugin-Description]]
@@ -24,6 +24,23 @@ manifest, to list the changes between builds, and to re-create the
project state across all repositories for any previous build using a
static manifest.
+[[RepoPlugin-Pipelines]]
+== Pipelines
+
+The repo plugin provides an SCM implementation to be used with the Pipeline SCM link:https://www.jenkins.io/doc/pipeline/steps/workflow-scm-step/[`checkout` step].
+
+The link:https://www.jenkins.io/redirect/pipeline-snippet-generator[Pipeline Syntax Snippet Generator] guides the user to select checkout options.
+
+[[RepoPlugin-EnvironmentVariables]]
+=== Environment Variables
+
+The repo plugin assigns values to environment variables in Pipeline projects.
+
+REPO_MANIFEST_URL:: URL of manifest repository used.
+REPO_MANIFEST_BRANCH:: Branch of the manifest repository used.
+REPO_MANIFEST_FILE:: Manifest filename used.
+REPO_MANIFEST_XML:: Static manifest (in XML format).
+
[[RepoPlugin-Changelog]]
== Changelog
diff --git a/README.txt b/README.txt
deleted file mode 100644
index 9ce1a85..0000000
--- a/README.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-This plugin adds Repo (https://gerrit.googlesource.com/git-repo) as an SCM
-provider for Jenkins. Projects can use this plugin to only run builds
-when changes are detected in any of the git repositories in the repo
-manifest, to list the changes between builds, and to re-create the
-project state across all repositories for any previous build using
-a static manifest.
-
-=============
-
-Maintainers
-
-Bjarke Freund-Hansen - bjarkefh@gmail.com
-Brad Larson - bklarson@gmail.com
From 56ab5f4c255b5294fd5f6aca3c4cbd7c52f558cc Mon Sep 17 00:00:00 2001
From: Adrien Bioteau
Date: Fri, 11 Mar 2022 08:20:01 +0100
Subject: [PATCH 163/184] Fix broken jenkins plugin documentation
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 1b648d1..c4d3ab7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
- https://github.com/jenkinsci/repo-plugin/blob/master/doc/README.adoc
+ https://github.com/jenkinsci/repo-plugin/blob/master/README.adoc
1.14.1
From 3c8e6236b1088fc138a1a3e6af5ebbcb8b616f2f Mon Sep 17 00:00:00 2001
From: Dmitry_Platonov
Date: Wed, 4 May 2022 13:09:22 +0200
Subject: [PATCH 164/184] =?UTF-8?q?=E2=80=9CSECURITY-2478=E2=80=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 4 +-
.../plugins/repo/ManifestValidator.java | 83 +++++++++++++++++++
.../java/hudson/plugins/repo/RepoScm.java | 59 +++++++++++++
.../plugins/repo/ManifestValidatorTest.java | 56 +++++++++++++
.../hudson/plugins/repo/Security2478Test.java | 76 +++++++++++++++++
5 files changed, 276 insertions(+), 2 deletions(-)
create mode 100644 src/main/java/hudson/plugins/repo/ManifestValidator.java
create mode 100644 src/test/java/hudson/plugins/repo/ManifestValidatorTest.java
create mode 100644 src/test/java/hudson/plugins/repo/Security2478Test.java
diff --git a/pom.xml b/pom.xml
index c4d3ab7..383ad22 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
org.jenkins-ci.plugins
plugin
- 3.56
+ 4.31
@@ -18,7 +18,7 @@
1.14.1
-SNAPSHOT
- 2.60.3
+ 2.277.1
8
UTF-8
UTF-8
diff --git a/src/main/java/hudson/plugins/repo/ManifestValidator.java b/src/main/java/hudson/plugins/repo/ManifestValidator.java
new file mode 100644
index 0000000..093dc0d
--- /dev/null
+++ b/src/main/java/hudson/plugins/repo/ManifestValidator.java
@@ -0,0 +1,83 @@
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2010, Brad Larson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package hudson.plugins.repo;
+
+import hudson.AbortException;
+import jenkins.util.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.NodeList;
+
+import org.xml.sax.SAXException;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Locale;
+
+/**
+ * to validate manifest xml file and abort when remote references a local path.
+ */
+public final class ManifestValidator {
+
+ private ManifestValidator() {
+ // to hide the implicit public constructor
+ }
+
+ /**
+ * to validate manifest xml file and abort when remote references a local path.
+ * @param manifestText byte representation of manifest file
+ * @param manifestRepositoryUrl url
+ * @throws IOException when remote references a local path.
+ */
+ public static void validate(final byte[] manifestText, final String manifestRepositoryUrl)
+ throws IOException {
+ if (manifestText.length > 0) {
+ try {
+ Document doc = XMLUtils.parse(new ByteArrayInputStream(manifestText));
+ NodeList remote = doc.getElementsByTagName("remote");
+ for (int i = 0; i < remote.getLength(); i++) {
+ NamedNodeMap attributes = remote.item(i).getAttributes();
+ for (int j = 0; j < attributes.getLength(); j++) {
+ if ("fetch".equals(attributes.item(j).getNodeName())
+ && attributes.item(j).getNodeValue()
+ .toLowerCase(Locale.ENGLISH).startsWith("file://")) {
+ // we don't need to check source using Files.exists because fetch
+ // attribute could resolve only local paths starting from 'file://'
+ throw new AbortException("Checkout of Repo url '"
+ + manifestRepositoryUrl
+ + "' aborted because manifest references a local "
+ + "directory, which may be insecure. You can allow "
+ + "local checkouts anyway"
+ + " by setting the system property '"
+ + RepoScm.ALLOW_LOCAL_CHECKOUT_PROPERTY + "' to true.");
+ }
+ }
+ }
+ } catch (SAXException e) {
+ throw new IOException("Could not validate manifest");
+ }
+ }
+ }
+}
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 4aba1d6..b9630a6 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -30,16 +30,20 @@
import java.io.Serializable;
import java.net.URL;
import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
+import hudson.AbortException;
import hudson.EnvVars;
import hudson.Extension;
import hudson.FilePath;
@@ -84,6 +88,17 @@ public class RepoScm extends SCM implements Serializable {
private static Logger debug = Logger
.getLogger("hudson.plugins.repo.RepoScm");
+ /**
+ * escape hatch name.
+ */
+ static final String ALLOW_LOCAL_CHECKOUT_PROPERTY =
+ RepoScm.class.getName() + ".ALLOW_LOCAL_CHECKOUT";
+ /**
+ * escape hatch.
+ */
+ //CS IGNORE VisibilityModifier FOR NEXT 1 LINES. REASON: escape hatch property.
+ static /* not final */ boolean ALLOW_LOCAL_CHECKOUT = Boolean.parseBoolean(System.getProperty(ALLOW_LOCAL_CHECKOUT_PROPERTY, "false"));
+
private final String manifestRepositoryUrl;
// Advanced Fields:
@@ -880,6 +895,10 @@ public void checkout(
@CheckForNull final File changelogFile, @CheckForNull final SCMRevisionState baseline)
throws IOException, InterruptedException {
+ if (!ALLOW_LOCAL_CHECKOUT && !workspace.isRemote()) {
+ abortIfUrlLocal();
+ }
+
Job, ?> job = build.getParent();
EnvVars env = build.getEnvironment(listener);
env = getEnvVars(env, job);
@@ -931,6 +950,18 @@ public void checkout(
build.addAction(manifestAction);
}
+ private void abortIfUrlLocal() throws AbortException {
+ if (StringUtils.isNotEmpty(manifestRepositoryUrl)
+ && (manifestRepositoryUrl.toLowerCase(Locale.ENGLISH).startsWith("file://")
+ || Files.exists(Paths.get(manifestRepositoryUrl)))) {
+ throw new AbortException("Checkout of Repo url '" + manifestRepositoryUrl
+ + "' aborted because it references a local directory, "
+ + "which may be insecure. "
+ + "You can allow local checkouts anyway by setting the system property '"
+ + ALLOW_LOCAL_CHECKOUT_PROPERTY + "' to true.");
+ }
+ }
+
private int doSync(final Launcher launcher, @Nonnull final FilePath workspace,
final OutputStream logger, final EnvVars env)
throws IOException, InterruptedException {
@@ -1093,6 +1124,10 @@ private boolean checkoutCode(final Launcher launcher,
}
}
+ if (!ALLOW_LOCAL_CHECKOUT && !workspace.isRemote()) {
+ abortIfManifestReferencesLocalUrl(launcher, workspace, logger, env);
+ }
+
returnCode = doSync(launcher, workspace, logger, env);
if (returnCode != 0) {
debug.log(Level.WARNING, "Sync failed. Resetting repository");
@@ -1111,6 +1146,30 @@ private boolean checkoutCode(final Launcher launcher,
return true;
}
+ private byte[] getManifestAsBytes(final Launcher launcher,
+ final FilePath workspace,
+ final OutputStream logger,
+ final EnvVars env)
+ throws IOException, InterruptedException {
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ final List commands = new ArrayList<>();
+ commands.add(getDescriptor().getExecutable());
+ commands.add("manifest");
+ launcher.launch().stderr(logger).stdout(byteArrayOutputStream).pwd(workspace)
+ .cmds(commands).envs(env).join();
+ return byteArrayOutputStream.toByteArray();
+ }
+
+ private void abortIfManifestReferencesLocalUrl(final Launcher launcher,
+ final FilePath workspace,
+ final OutputStream logger,
+ final EnvVars env)
+ throws IOException, InterruptedException {
+ byte[] manifestText = getManifestAsBytes(launcher, workspace, logger, env);
+
+ ManifestValidator.validate(manifestText, manifestRepositoryUrl);
+ }
+
/**
* Adds environmental variables for the builds to the given map.
*/
diff --git a/src/test/java/hudson/plugins/repo/ManifestValidatorTest.java b/src/test/java/hudson/plugins/repo/ManifestValidatorTest.java
new file mode 100644
index 0000000..6dbd84a
--- /dev/null
+++ b/src/test/java/hudson/plugins/repo/ManifestValidatorTest.java
@@ -0,0 +1,56 @@
+package hudson.plugins.repo;
+
+import org.junit.Test;
+import org.jvnet.hudson.test.Issue;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.fail;
+
+public class ManifestValidatorTest {
+
+ @Issue("SECURITY-2478")
+ @Test
+ public void validateWhenFetchAttributeReferencesLocalPathThenAbort() {
+ String manifest = "\n" +
+ "\n" +
+ " \n" +
+ "\n" +
+ " \n" +
+ "";
+ try {
+ ManifestValidator.validate(manifest.getBytes(StandardCharsets.UTF_8), "repoUrl");
+ fail("should fail because fetch attribute in remote tag references a local path");
+ } catch (IOException e) {
+ assertThat(e.getMessage(), is("Checkout of Repo url 'repoUrl' aborted because manifest references a local directory, " +
+ "which may be insecure. You can allow local checkouts anyway by setting the system property '" +
+ RepoScm.ALLOW_LOCAL_CHECKOUT_PROPERTY + "' to true."));
+ }
+ }
+
+ @Issue("SECURITY-2478")
+ @Test
+ public void validateWhenValidManifestThenDoNotAbort() {
+ String manifest = "\n" +
+ "\n" +
+ " \n" +
+ "\n" +
+ " \n" +
+ " ";
+
+ try {
+ ManifestValidator.validate(manifest.getBytes(StandardCharsets.UTF_8), "repoUrl");
+ } catch (Exception e) {
+ fail("fail because input is valid and no exception expected");
+ }
+ }
+}
diff --git a/src/test/java/hudson/plugins/repo/Security2478Test.java b/src/test/java/hudson/plugins/repo/Security2478Test.java
new file mode 100644
index 0000000..d2f8637
--- /dev/null
+++ b/src/test/java/hudson/plugins/repo/Security2478Test.java
@@ -0,0 +1,76 @@
+package hudson.plugins.repo;
+
+import hudson.model.FreeStyleBuild;
+import hudson.model.FreeStyleProject;
+import hudson.model.Result;
+import hudson.slaves.DumbSlave;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.jvnet.hudson.test.Issue;
+import org.jvnet.hudson.test.JenkinsRule;
+
+public class Security2478Test {
+
+ @Rule
+ public JenkinsRule rule = new JenkinsRule();
+
+ @Rule
+ public TemporaryFolder testFolder = new TemporaryFolder();
+
+ @Issue("SECURITY-2478")
+ @Test
+ public void checkoutShouldAbortWhenUrlIsNonRemoteAndBuildOnController() throws Exception {
+ FreeStyleProject freeStyleProject = rule.createFreeStyleProject();
+ String manifestRepositoryUrl = testFolder.newFolder().toString();
+ RepoScm scm = new RepoScm(manifestRepositoryUrl);
+ freeStyleProject.setScm(scm);
+ FreeStyleBuild freeStyleBuild = rule.assertBuildStatus(Result.FAILURE, freeStyleProject.scheduleBuild2(0));
+ rule.assertLogContains("Checkout of Repo url '" + manifestRepositoryUrl +
+ "' aborted because it references a local directory, " +
+ "which may be insecure. You can allow local checkouts anyway by setting the system property '" +
+ RepoScm.ALLOW_LOCAL_CHECKOUT_PROPERTY + "' to true.", freeStyleBuild);
+ }
+
+ @Issue("SECURITY-2478")
+ @Test
+ public void checkoutShouldNotAbortWhenUrlIsNonRemoteAndEscapeHatchTrue() throws Exception {
+ try {
+ RepoScm.ALLOW_LOCAL_CHECKOUT = true;
+ FreeStyleProject freeStyleProject = rule.createFreeStyleProject();
+ String manifestRepositoryUrl = testFolder.newFolder().toString();
+ RepoScm scm = new RepoScm(manifestRepositoryUrl);
+ freeStyleProject.setScm(scm);
+ FreeStyleBuild freeStyleBuild = rule.assertBuildStatus(Result.FAILURE, freeStyleProject.scheduleBuild2(0));
+
+ // build fails because of manifestRepositoryUrl is not a repo(git) repository, but we don't care,
+ // we verify that build was not aborted because of RepoScm uses local path.
+ rule.assertLogNotContains("Checkout of Repo url '" + manifestRepositoryUrl +
+ "' aborted because it references a local directory, " +
+ "which may be insecure. You can allow local checkouts anyway by setting the system property '" +
+ RepoScm.ALLOW_LOCAL_CHECKOUT_PROPERTY + "' to true.", freeStyleBuild);
+ } finally {
+ RepoScm.ALLOW_LOCAL_CHECKOUT = false;
+ }
+ }
+
+ @Issue("SECURITY-2478")
+ @Test
+ public void checkoutShouldNotAbortWhenUrlIsNonRemoteAndBuildOnAgent() throws Exception {
+ DumbSlave agent = rule.createOnlineSlave();
+ FreeStyleProject freeStyleProject = rule.createFreeStyleProject();
+
+ String manifestRepositoryUrl = testFolder.newFolder().toString();
+
+ RepoScm scm = new RepoScm(manifestRepositoryUrl);
+ freeStyleProject.setScm(scm);
+ freeStyleProject.setAssignedLabel(agent.getSelfLabel());
+
+ // build fails because of manifestRepositoryUrl is not a repo(git) repository, but we don't care,
+ // we verify that build was not aborted because of RepoScm uses local path.
+ rule.assertLogNotContains("Checkout of Repo url '" + manifestRepositoryUrl +
+ "' aborted because it references a local directory, " +
+ "which may be insecure. You can allow local checkouts anyway by setting the system property '" +
+ RepoScm.ALLOW_LOCAL_CHECKOUT_PROPERTY + "' to true.", freeStyleProject.scheduleBuild2(0).get());
+ }
+}
From b41020c7b52b264429c11316ed70250cb967d1e2 Mon Sep 17 00:00:00 2001
From: Dmitry_Platonov
Date: Wed, 4 May 2022 13:12:24 +0200
Subject: [PATCH 165/184] [maven-release-plugin] prepare release repo-1.15.0
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 383ad22..e29001d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- ${revision}${changelist}
+ 1.15.0
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -129,7 +129,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.15.0
From 4d5fc8889181d66e464ca196088ddb002c13f13b Mon Sep 17 00:00:00 2001
From: Dmitry_Platonov
Date: Wed, 4 May 2022 13:12:24 +0200
Subject: [PATCH 166/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index e29001d..cfd103b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.15.0
+ 1.15.1-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -129,7 +129,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.15.0
+ HEAD
From bf0ee240acb155caad15a1a50d2d89928095f15d Mon Sep 17 00:00:00 2001
From: Makson Lee
Date: Fri, 8 Jul 2022 23:47:51 +0800
Subject: [PATCH 167/184] Fix missing of manifest after restart Jenkins
instance.
Fix issue JENKINS-64150.
---
.../hudson/plugins/repo/ManifestAction.java | 87 ++++---------------
.../java/hudson/plugins/repo/RepoScm.java | 8 +-
.../hudson/plugins/repo/StaticManifest.java | 82 +++++++++++++++++
.../plugins/repo/ManifestAction/index.jelly | 9 +-
4 files changed, 108 insertions(+), 78 deletions(-)
create mode 100644 src/main/java/hudson/plugins/repo/StaticManifest.java
diff --git a/src/main/java/hudson/plugins/repo/ManifestAction.java b/src/main/java/hudson/plugins/repo/ManifestAction.java
index 2bac3b6..81355eb 100644
--- a/src/main/java/hudson/plugins/repo/ManifestAction.java
+++ b/src/main/java/hudson/plugins/repo/ManifestAction.java
@@ -23,18 +23,15 @@
*/
package hudson.plugins.repo;
-import java.io.Serializable;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.kohsuke.stapler.export.ExportedBean;
-
import hudson.model.BuildBadgeAction;
import hudson.model.Run;
import jenkins.model.RunAction2;
+import org.kohsuke.stapler.export.ExportedBean;
-import javax.annotation.CheckForNull;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
/**
* A Manifest Action displays the static manifest information needed
@@ -47,13 +44,6 @@ public class ManifestAction implements RunAction2, Serializable, BuildBadgeActio
private static final long serialVersionUID = 1;
private transient Run, ?> run;
- private transient RevisionState revisionState;
-
- /**
- * Allow disambiguation of the action url when multiple {@link RevisionState} actions present.
- */
- @CheckForNull
- private Integer index;
/**
* Constructs the manifest action object.
@@ -63,37 +53,6 @@ public class ManifestAction implements RunAction2, Serializable, BuildBadgeActio
this.run = run;
}
- /**
- * Sets an identifier used to disambiguate multiple {@link RevisionState} actions attached to a
- * {@link Run}.
- *
- * @param index the index, indexes less than or equal to {@code 1} will be discarded.
- */
- public void setIndex(final Integer index) {
- this.index = index == null || index <= 1 ? null : index;
- try {
- final int i = index == null ? 0 : index - 1;
- final List revisionStates = run.getActions(RevisionState.class);
- if (revisionStates.size() > i && i >= 0) {
- revisionState = revisionStates.get(i);
- }
- } catch (Exception e) {
- debug.log(Level.WARNING, "Error getting revision state {0}", e.getMessage());
- revisionState = null;
- }
- }
-
- /**
- * Gets the identifier used to disambiguate multiple {@link RevisionState} actions attached to
- * a {@link Run}.
- *
- * @return the index.
- */
- @CheckForNull
- public Integer getIndex() {
- return index;
- }
-
@Override
public void onAttached(final Run, ?> r) {
this.run = r;
@@ -129,34 +88,22 @@ public String getDisplayName() {
* Returns the name of the Url to use for the action.
*/
public final String getUrlName() {
- return index == null ? "repo-manifest" : "repo-manifest-" + index;
+ return "repo-manifest";
}
/**
* Gets a String representation of the static manifest for this repo snapshot.
*/
- public String getManifest() {
- return revisionState == null ? "" : revisionState.getManifest();
- }
-
- /**
- * Returns the manifest repository's url for this repo snapshot.
- */
- public String getUrl() {
- return revisionState == null ? "" : revisionState.getUrl();
- }
-
- /**
- * Returns the manifest repository's branch name for this repo snapshot.
- */
- public String getBranch() {
- return revisionState == null ? "" : revisionState.getBranch();
- }
-
- /**
- * Returns the path to the manifest file for this repo snapshot.
- */
- public String getFile() {
- return revisionState == null ? "" : revisionState.getFile();
+ public List getManifests() {
+ List manifests = new ArrayList();
+
+ final List revisionStates = getRun().getActions(RevisionState.class);
+ if (revisionStates != null) {
+ for (RevisionState revisionState : revisionStates) {
+ manifests.add(new StaticManifest(revisionState.getFile(), revisionState.getBranch(),
+ revisionState.getUrl(), revisionState.getManifest()));
+ }
+ }
+ return manifests;
}
}
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index b9630a6..2f98862 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -943,11 +943,9 @@ public void checkout(
showAllChanges);
}
- // TODO: create a single action displaying all manifests?
- ManifestAction manifestAction = new ManifestAction(build);
- int revisionStateCount = build.getActions(RevisionState.class).size();
- manifestAction.setIndex(revisionStateCount);
- build.addAction(manifestAction);
+ if (build.getActions(ManifestAction.class).size() == 0) {
+ build.addAction(new ManifestAction(build));
+ }
}
private void abortIfUrlLocal() throws AbortException {
diff --git a/src/main/java/hudson/plugins/repo/StaticManifest.java b/src/main/java/hudson/plugins/repo/StaticManifest.java
new file mode 100644
index 0000000..8e54b3b
--- /dev/null
+++ b/src/main/java/hudson/plugins/repo/StaticManifest.java
@@ -0,0 +1,82 @@
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2010, Brad Larson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package hudson.plugins.repo;
+
+/**
+ * A POJO containing information about a static manifest.
+ */
+public class StaticManifest {
+ private String file;
+ private String branch;
+ private String url;
+ private String manifest;
+
+ /**
+ * Create a new ModifiedFile object with the given path and edit type.
+ *
+ * @param file
+ * the path to the manifest file for this static manifest
+ * @param branch
+ * the manifest repository's branch name for this static manifes
+ * @param url
+ * he manifest repository's url for this static manifest
+ * @param manifest
+ * the content of this static manifest
+ */
+ public StaticManifest(final String file, final String branch,
+ final String url, final String manifest) {
+ this.file = file;
+ this.branch = branch;
+ this.url = url;
+ this.manifest = manifest;
+ }
+
+ /**
+ * Returns the path to the manifest file for this static manifest.
+ */
+ public String getFile() {
+ return file;
+ }
+
+ /**
+ * Returns the manifest repository's branch name for this static manifest.
+ */
+ public String getBranch() {
+ return branch;
+ }
+
+ /**
+ * Returns the manifest repository's url for this static manifest.
+ */
+ public String getUrl() {
+ return url;
+ }
+
+ /**
+ * Returns the content of this static manifest.
+ */
+ public String getManifest() {
+ return manifest;
+ }
+}
diff --git a/src/main/resources/hudson/plugins/repo/ManifestAction/index.jelly b/src/main/resources/hudson/plugins/repo/ManifestAction/index.jelly
index 51bf4ab..fa16f9e 100644
--- a/src/main/resources/hudson/plugins/repo/ManifestAction/index.jelly
+++ b/src/main/resources/hudson/plugins/repo/ManifestAction/index.jelly
@@ -16,10 +16,13 @@
To recreate this build, copy the below manifest and past it to .repo/manifest.xml, then run 'repo sync'.
When done, be sure to undo changes to the .repo/manifest.xml file and repo sync again.
- Generated from ${it.file} in branch ${it.branch} of ${it.url}.
-
Manifest File:
-
+
+ Generated from ${manifest.file} in branch ${manifest.branch} of ${manifest.url}.
+
+
+
+
\ No newline at end of file
From af8e27651fc10ccd94d9a03d85554238628e2b81 Mon Sep 17 00:00:00 2001
From: Makson Lee
Date: Sat, 9 Jul 2022 23:22:33 +0800
Subject: [PATCH 168/184] Fix broken maniifest icon.
Fix issue JENKINS-68818.
---
pom.xml | 8 ++++----
.../java/hudson/plugins/repo/ManifestAction.java | 2 +-
.../plugins/repo/ManifestAction/badge.jelly | 15 +++++++++------
3 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/pom.xml b/pom.xml
index cfd103b..a965c02 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,22 +3,22 @@
org.jenkins-ci.plugins
plugin
- 4.31
+ 4.41
org.jenkins-ci.plugins
repo
- 1.15.1-SNAPSHOT
+ ${revision}${changelist}
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
https://github.com/jenkinsci/repo-plugin/blob/master/README.adoc
- 1.14.1
+ 1.15.1
-SNAPSHOT
- 2.277.1
+ 2.346.1
8
UTF-8
UTF-8
diff --git a/src/main/java/hudson/plugins/repo/ManifestAction.java b/src/main/java/hudson/plugins/repo/ManifestAction.java
index 2bac3b6..0a8fb06 100644
--- a/src/main/java/hudson/plugins/repo/ManifestAction.java
+++ b/src/main/java/hudson/plugins/repo/ManifestAction.java
@@ -115,7 +115,7 @@ public void onLoad(final Run, ?> r) {
* Returns the filename to use as the badge.
*/
public String getIconFileName() {
- return "star.gif";
+ return "star";
}
/**
diff --git a/src/main/resources/hudson/plugins/repo/ManifestAction/badge.jelly b/src/main/resources/hudson/plugins/repo/ManifestAction/badge.jelly
index ce6f6e4..49d23dc 100644
--- a/src/main/resources/hudson/plugins/repo/ManifestAction/badge.jelly
+++ b/src/main/resources/hudson/plugins/repo/ManifestAction/badge.jelly
@@ -1,8 +1,11 @@
+
-
-
-
\ No newline at end of file
+
+
+
+
\ No newline at end of file
From 5cd850dc3fba43135e60dbcf0e810bf411123a70 Mon Sep 17 00:00:00 2001
From: Makson Lee
Date: Mon, 11 Jul 2022 11:33:54 +0800
Subject: [PATCH 169/184] Add static manifest into environment variables when
we can.
The value of an environment variable can't be greater than MAX_ARG_STRLEN, which is PAGE_SIZE * 32, aka 131072 bytes.
---
src/main/java/hudson/plugins/repo/RepoScm.java | 11 ++++++++++-
.../hudson/plugins/repo/RepoScm/buildEnv.properties | 3 ++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index b9630a6..bef69f6 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -85,6 +85,11 @@
@ExportedBean
public class RepoScm extends SCM implements Serializable {
+ /**
+ * maximum length of string passed to a single environment variable.
+ */
+ private static final int MAX_ARG_STRLEN = 131072;
+
private static Logger debug = Logger
.getLogger("hudson.plugins.repo.RepoScm");
@@ -1191,7 +1196,11 @@ public void buildEnvironment(
env.put("REPO_MANIFEST_URL", ((RevisionState) state).getUrl());
env.put("REPO_MANIFEST_BRANCH", ((RevisionState) state).getBranch());
env.put("REPO_MANIFEST_FILE", ((RevisionState) state).getFile());
- env.put("REPO_MANIFEST_XML", ((RevisionState) state).getManifest());
+ String manifest = ((RevisionState) state).getManifest();
+ if (manifest.length() > MAX_ARG_STRLEN) {
+ manifest = "_";
+ }
+ env.put("REPO_MANIFEST_XML", manifest);
}
}
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.properties b/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.properties
index f881ee6..2b04d4f 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.properties
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/buildEnv.properties
@@ -1,4 +1,5 @@
REPO_MANIFEST_URL.blurb=The URL of manifest repository used.
REPO_MANIFEST_BRANCH.blurb=The branch of the manifest repository used.
REPO_MANIFEST_FILE.blurb=The manifest filename used.
-REPO_MANIFEST_XML.blurb=The static manifest (in XML format).
+REPO_MANIFEST_XML.blurb=The static manifest (in XML format), if manifest size is greater \
+ than MAX_ARG_STRLEN (131072 bytes), value will be set to a single underscore character.
From 4c4a72c7de3d3e5bbbad223605ea264dcec56bc1 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 14 Oct 2022 16:07:31 +0200
Subject: [PATCH 170/184] [SECURITY-2337]
---
src/main/java/hudson/plugins/repo/RevisionState.java | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RevisionState.java b/src/main/java/hudson/plugins/repo/RevisionState.java
index 5808792..0826a15 100644
--- a/src/main/java/hudson/plugins/repo/RevisionState.java
+++ b/src/main/java/hudson/plugins/repo/RevisionState.java
@@ -38,12 +38,11 @@
import java.util.logging.Logger;
import javax.annotation.Nullable;
-import javax.xml.parsers.DocumentBuilderFactory;
+import jenkins.util.xml.XMLUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
/**
* A RevisionState records the state of the repository for a particular build.
@@ -86,12 +85,7 @@ class RevisionState extends SCMRevisionState implements Serializable {
this.branch = branch;
this.file = file;
try {
- final InputSource xmlSource = new InputSource();
- xmlSource.setCharacterStream(new StringReader(manifest));
- final Document doc =
- DocumentBuilderFactory.newInstance().newDocumentBuilder()
- .parse(xmlSource);
-
+ final Document doc = XMLUtils.parse(new StringReader(manifest));
if (!doc.getDocumentElement().getNodeName().equals("manifest")) {
if (logger != null) {
logger.println("Error - malformed manifest");
From 14ca344723aa977d97615cf0ae018138e07289c6 Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 14 Oct 2022 16:14:36 +0200
Subject: [PATCH 171/184] [maven-release-plugin] prepare release repo-1.16.0
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index a965c02..e76bfb6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- ${revision}${changelist}
+ 1.16.0
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -129,7 +129,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.16.0
From 17703c9ef83dc540f07948fafc2932e21d55b73f Mon Sep 17 00:00:00 2001
From: rsandell
Date: Fri, 14 Oct 2022 16:14:36 +0200
Subject: [PATCH 172/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index e76bfb6..7335ea1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.16.0
+ 1.16.1-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -129,7 +129,7 @@
scm:git:git://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.16.0
+ HEAD
From 30fe94b5003948264329d41b1b26294b674919bd Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Wed, 19 Oct 2022 17:16:30 +0200
Subject: [PATCH 173/184] Create release-drafter.yml
---
.github/workflows/release-drafter.yml | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
create mode 100644 .github/workflows/release-drafter.yml
diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml
new file mode 100644
index 0000000..e0419f2
--- /dev/null
+++ b/.github/workflows/release-drafter.yml
@@ -0,0 +1,17 @@
+# Note: additional setup is required, see https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc
+
+name: Release Drafter
+
+on:
+ push:
+ branches:
+ - "master"
+
+jobs:
+ update_release_draft:
+ runs-on: ubuntu-latest
+ steps:
+ # Drafts your next Release notes as Pull Requests are merged into the default branch
+ - uses: release-drafter/release-drafter@v5
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
From 59bf3b7a73aacf9846790f160f2c1a0602fe8db4 Mon Sep 17 00:00:00 2001
From: Karsten Tausche
Date: Fri, 23 Dec 2022 10:19:41 +0100
Subject: [PATCH 174/184] Pass no-repo-verify also to repo sync if needed
When a custom repo version is used (repoUrl parameter), `repo init` is
called with --repo-url=* and --no-repo-verify, to allow for unsigned
versions of the repo tool. `repo sync` does `repo selfupdate`
automatically; so it also needs the --no-repo-verify parameter.
Currently, `repo sync` ends up reverting back to the last signed release
tag, which is inconsistent with `repo init` allowing unsigned versions.
---
src/main/java/hudson/plugins/repo/RepoScm.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index dd63a38..200116f 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -1030,6 +1030,12 @@ private int doSync(final Launcher launcher, @Nonnull final FilePath workspace,
if (fetchSubmodules) {
commands.add("--fetch-submodules");
}
+ if (repoUrl != null) {
+ // When repoUrl is set, we allow for unsigned repo tool
+ // versions; so --no-repo-verify must be set both in init
+ // and sync.
+ commands.add("--no-repo-verify");
+ }
return launcher.launch().stdout(logger).pwd(workspace)
.cmds(commands).envs(env).join();
}
From 99a7e562dac658b5e8bf05bd7cd385b125350f9f Mon Sep 17 00:00:00 2001
From: Alexander Koskovich
Date: Sat, 16 Dec 2023 13:20:24 -0500
Subject: [PATCH 175/184] Support syncing repositories that utilize Git LFS
The primary usecase of repo is AOSP development, however objects in
AOSP can often get quite large, a lot of firmware and proprietary blobs
can be well above 100 MiB which is the GitHub limit.
---
.../java/hudson/plugins/repo/RepoScm.java | 24 +++++++++++++++++++
.../hudson/plugins/repo/RepoScm/config.jelly | 4 ++++
.../plugins/repo/RepoScm/help-gitLfs.html | 6 +++++
3 files changed, 34 insertions(+)
create mode 100644 src/main/resources/hudson/plugins/repo/RepoScm/help-gitLfs.html
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index dd63a38..8b2b1a2 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -132,6 +132,7 @@ public class RepoScm extends SCM implements Serializable {
@CheckForNull private EnvVars extraEnvVars;
@CheckForNull private boolean noCloneBundle;
@CheckForNull private boolean worktree;
+ @CheckForNull private boolean gitLfs;
/**
* Returns the manifest repository URL.
@@ -379,6 +380,13 @@ public boolean isFetchSubmodules() {
return fetchSubmodules;
}
+ /**
+ * Returns the value of gitLfs.
+ */
+ public boolean isGitLfs() {
+ return gitLfs;
+ }
+
/**
* Returns the value of extraEnvVars.
*/
@@ -491,6 +499,7 @@ public RepoScm(final String manifestRepositoryUrl) {
ignoreProjects = Collections.emptySet();
noCloneBundle = false;
worktree = false;
+ gitLfs = false;
}
/**
@@ -774,6 +783,18 @@ public void setFetchSubmodules(final boolean fetchSubmodules) {
this.fetchSubmodules = fetchSubmodules;
}
+ /**
+ * Set gitLfs.
+ *
+ * @param gitLfs
+ * If this value is true, add the "--git-lfs" option when
+ * executing "repo init".
+ */
+ @DataBoundSetter
+ public void setGitLfs(final boolean gitLfs) {
+ this.gitLfs = gitLfs;
+ }
+
/**
* Sets list of projects which changes will be ignored when
* calculating whether job needs to be rebuild. This field corresponds
@@ -1106,6 +1127,9 @@ private boolean checkoutCode(final Launcher launcher,
if (manifestSubmodules) {
commands.add("--submodules");
}
+ if (gitLfs) {
+ commands.add("--git-lfs");
+ }
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 da2af27..d4d82c3 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -109,5 +109,9 @@
+
+
+
+
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/help-gitLfs.html b/src/main/resources/hudson/plugins/repo/RepoScm/help-gitLfs.html
new file mode 100644
index 0000000..f3e6aaa
--- /dev/null
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/help-gitLfs.html
@@ -0,0 +1,6 @@
+
+
+ Allow repositories utilizing LFS to sync LFS objects.
+ This is passed to repo as repo init --git-lfs.
+
+
From 2dee4ac954528295a4dc227339b1da32724528d7 Mon Sep 17 00:00:00 2001
From: shlomomdahan <64103471+shlomomdahan@users.noreply.github.com>
Date: Thu, 19 Dec 2024 12:39:07 -0500
Subject: [PATCH 176/184] Migrate legacy checkUrl attribute in
RepoScm/global.jelly
---
src/main/resources/hudson/plugins/repo/RepoScm/global.jelly | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/global.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/global.jelly
index fe481ca..333a20c 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/global.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/global.jelly
@@ -10,7 +10,7 @@
+ checkUrl="${rootURL}/scm/RepoScm/executableCheck" checkDependsOn=""/>
\ No newline at end of file
From 991d35d3bbecb5c53a9bcfe57f048e3a8df95771 Mon Sep 17 00:00:00 2001
From: Bruno Verachten
Date: Tue, 24 Jun 2025 22:05:25 +0200
Subject: [PATCH 177/184] feat(java): Require Jenkins core 2.492.3 and Java 17
---
pom.xml | 49 ++-----------------
.../java/hudson/plugins/repo/RepoScm.java | 4 +-
2 files changed, 5 insertions(+), 48 deletions(-)
diff --git a/pom.xml b/pom.xml
index 7335ea1..8c53b86 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
org.jenkins-ci.plugins
plugin
- 4.41
+ 5.17
@@ -18,8 +18,7 @@
1.15.1
-SNAPSHOT
- 2.346.1
- 8
+ 2.492.3
UTF-8
UTF-8
@@ -32,48 +31,6 @@
-
-
- rsandell
- Robert Sandell
- rsandell@cloudbees.com
-
- babysitter
-
- +1
-
-
- aep
- Arvid E. Picciani
- aep-jenkins@exys.org
-
- developer
- maintainer
-
- +1
-
-
- bjarkef
- Bjarke Freund-Hansen
- bjarkefh@gmail.com
-
- developer
- maintainer
-
- +1
-
-
- bklarson
- Brad Larson
- bklarson@gmail.com
-
- developer
- maintainer
-
- -6
-
-
-
@@ -126,7 +83,7 @@
- scm:git:git://github.com/jenkinsci/repo-plugin.git
+ scm:git:https://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
HEAD
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index dd63a38..b2db302 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -66,7 +66,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.QueryParameter;
-import org.kohsuke.stapler.StaplerRequest;
+import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;
@@ -1336,7 +1336,7 @@ public String getDisplayName() {
}
@Override
- public boolean configure(final StaplerRequest req,
+ public boolean configure(final StaplerRequest2 req,
final JSONObject json)
throws hudson.model.Descriptor.FormException {
repoExecutable =
From cd798a53c1a5a4f666c98a7dd7ff63a8e0e56807 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Mon, 29 Dec 2025 00:50:08 +0100
Subject: [PATCH 178/184] Update Jenkinsfile to use JDK 17 and 25
---
Jenkinsfile | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 5b60d43..a937aac 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1 +1,4 @@
-buildPlugin(platforms: ['linux'])
+buildPlugin(useContainerAgent: true, timeout: 180, configurations: [
+ [platform: 'linux', jdk: 25],
+ [platform: 'linux', jdk: 17],
+])
From 07bed5b9b82f102f223aaf5a2088785244770646 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Mon, 29 Dec 2025 01:01:28 +0100
Subject: [PATCH 179/184] Update JDK version from 25 to 21 in Jenkinsfile
JDK 25 was a bit too optimistic with this code version.
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index a937aac..f41551e 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,4 +1,4 @@
buildPlugin(useContainerAgent: true, timeout: 180, configurations: [
- [platform: 'linux', jdk: 25],
+ [platform: 'linux', jdk: 21],
[platform: 'linux', jdk: 17],
])
From 31de5aadcc008a3c85749db331d3c147b51edef2 Mon Sep 17 00:00:00 2001
From: Roman Rapoport <80348145+RomanR-dev@users.noreply.github.com>
Date: Mon, 29 Dec 2025 02:15:28 +0200
Subject: [PATCH 180/184] Add option: noSync, to run repo init without sync
option to intialize only manifests repo (#77)
Co-authored-by: Robert Sandell
---
.../java/hudson/plugins/repo/RepoScm.java | 28 +++++++++++++++++--
.../hudson/plugins/repo/RepoScm/config.jelly | 3 ++
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/src/main/java/hudson/plugins/repo/RepoScm.java b/src/main/java/hudson/plugins/repo/RepoScm.java
index 50eb5a5..cc767e1 100644
--- a/src/main/java/hudson/plugins/repo/RepoScm.java
+++ b/src/main/java/hudson/plugins/repo/RepoScm.java
@@ -132,6 +132,7 @@ public class RepoScm extends SCM implements Serializable {
@CheckForNull private EnvVars extraEnvVars;
@CheckForNull private boolean noCloneBundle;
@CheckForNull private boolean worktree;
+ @CheckForNull private boolean noSync;
@CheckForNull private boolean gitLfs;
/**
@@ -395,6 +396,13 @@ public Map getExtraEnvVars() {
return extraEnvVars;
}
+ /**
+ * Returns the value of noSync.
+ */
+ public boolean isNoSync() {
+ return noSync;
+ }
+
/**
* The constructor takes in user parameters and sets them. Each job using
* the RepoSCM will call this constructor.
@@ -499,6 +507,7 @@ public RepoScm(final String manifestRepositoryUrl) {
ignoreProjects = Collections.emptySet();
noCloneBundle = false;
worktree = false;
+ noSync = false;
gitLfs = false;
}
@@ -747,6 +756,17 @@ public void setForceSync(final boolean forceSync) {
this.forceSync = forceSync;
}
+ /**
+ * disables -sync option on repo command.
+ * @param noSync
+ * If this value is true, do not add the "-sync" option when
+ * executing "repo ".
+ */
+ @DataBoundSetter
+ public void setNoSync(final boolean noSync) {
+ this.noSync = noSync;
+ }
+
/**
* Set noTags.
*
@@ -1026,7 +1046,7 @@ private int doSync(final Launcher launcher, @Nonnull final FilePath workspace,
}
commands.add(getDescriptor().getExecutable());
if (trace) {
- commands.add("--trace");
+ commands.add("--trace");
}
commands.add("sync");
commands.add("-d");
@@ -1084,7 +1104,7 @@ private boolean checkoutCode(final Launcher launcher,
commands.add(getDescriptor().getExecutable());
if (trace) {
- commands.add("--trace");
+ commands.add("--trace");
}
commands.add("init");
commands.add("-u");
@@ -1142,6 +1162,10 @@ private boolean checkoutCode(final Launcher launcher,
if (returnCode != 0) {
return false;
}
+ if (isNoSync()) {
+ debug.log(Level.FINEST, "Repo init completed successfully, not running repo sync");
+ return true;
+ }
if (localManifest != null) {
if (!lmdir.exists()) {
diff --git a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
index d4d82c3..ada0c9d 100644
--- a/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
+++ b/src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
@@ -109,6 +109,9 @@
+
+
+
From c04dc252c4581b97e65b24df83b5068e760345c0 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Mon, 29 Dec 2025 01:24:26 +0100
Subject: [PATCH 181/184] [maven-release-plugin] prepare release repo-1.17.0
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 8c53b86..940b593 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.16.1-SNAPSHOT
+ 1.17.0
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -86,7 +86,7 @@
scm:git:https://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.17.0
From a873f7e09d43375336f558081de1845655afdee0 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Mon, 29 Dec 2025 01:24:31 +0100
Subject: [PATCH 182/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 940b593..9fa5990 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.17.0
+ 1.17.1-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -86,7 +86,7 @@
scm:git:https://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.17.0
+ HEAD
From 8440a828dfa1b870885d80e354ecb5419023306b Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Mon, 29 Dec 2025 01:48:03 +0100
Subject: [PATCH 183/184] [maven-release-plugin] prepare release repo-1.17.0-r2
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 9fa5990..0840cdf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.17.1-SNAPSHOT
+ 1.17.0
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -86,7 +86,7 @@
scm:git:https://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- HEAD
+ repo-1.17.0-r2
From f4fed02ce9cfdb3ba8ad9af81593fdbe6441b3e6 Mon Sep 17 00:00:00 2001
From: Robert Sandell
Date: Mon, 29 Dec 2025 01:48:08 +0100
Subject: [PATCH 184/184] [maven-release-plugin] prepare for next development
iteration
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 0840cdf..9fa5990 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.jenkins-ci.plugins
repo
- 1.17.0
+ 1.17.1-SNAPSHOT
hpi
Jenkins REPO plugin
Integrates Jenkins with REPO SCM
@@ -86,7 +86,7 @@
scm:git:https://github.com/jenkinsci/repo-plugin.git
scm:git:git@github.com:jenkinsci/repo-plugin.git
http://github.com/jenkinsci/repo-plugin
- repo-1.17.0-r2
+ HEAD