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..9762dd6
--- /dev/null
+++ b/src/main/java/hudson/plugins/repo/ManifestAction.java
@@ -0,0 +1,108 @@
+/*
+ * 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.BuildBadgeAction;
+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, BuildBadgeAction {
+
+ 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 6e0671a..0de93d8 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/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
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