diff --git a/changelog.html b/changelog.html
index 0c230d31bc8e8296ae911b6c9d129a69e21510c0..20b543c9cfee7d6a61fb59f0b589b7df40613ead 100644
--- a/changelog.html
+++ b/changelog.html
@@ -67,7 +67,9 @@ Upcoming changes
Added the View.READ permission to control visibility of views, and updated the default implementation to hide empty views.
(issue 3681)
-
+
+ Added new extension point for transient build actions.
+ (pull 421)
diff --git a/core/src/main/java/hudson/model/AbstractBuild.java b/core/src/main/java/hudson/model/AbstractBuild.java
index 8dad9c17e2ff4a87642db5f96e1fa5edd15a0a9c..cf8cced4c151353e27d17ee941f4aacad6a9acd1 100644
--- a/core/src/main/java/hudson/model/AbstractBuild.java
+++ b/core/src/main/java/hudson/model/AbstractBuild.java
@@ -87,6 +87,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -882,6 +883,25 @@ public abstract class AbstractBuild,R extends Abs
public Calendar due() {
return getTimestamp();
}
+
+ /**
+ * Add all transient action for this build
+ *
+ */
+ protected List createTransientActions() {
+ Vector ta = new Vector();
+ for (TransientBuildActionFactory tpaf : TransientBuildActionFactory.all())
+ ta.addAll(Util.fixNull(tpaf.createFor(this)));
+ return ta;
+ }
+
+ @Override
+ public synchronized List getActions() {
+ List actions = new Vector(super.getActions());
+ //add transient actions too
+ actions.addAll(createTransientActions());
+ return actions;
+ }
/**
* Builds up a set of variable names that contain sensitive values that
diff --git a/core/src/main/java/hudson/model/TransientBuildActionFactory.java b/core/src/main/java/hudson/model/TransientBuildActionFactory.java
new file mode 100644
index 0000000000000000000000000000000000000000..482354f03f1a5cc4c259976e69c03230cde51db7
--- /dev/null
+++ b/core/src/main/java/hudson/model/TransientBuildActionFactory.java
@@ -0,0 +1,34 @@
+package hudson.model;
+
+import hudson.Extension;
+import hudson.ExtensionList;
+import hudson.ExtensionPoint;
+import jenkins.model.Jenkins;
+import java.util.Collection;
+
+/**
+ * Extension point for inserting transient {@link Action}s into {@link AbstractBuild}s.
+ *
+ * To register your implementation, put {@link Extension} on your subtype.
+ *
+ * @author Lucie Votypkova
+ * @since 1.458
+ * @see Action
+ */
+
+public abstract class TransientBuildActionFactory implements ExtensionPoint {
+ /**
+ * Creates actions for the given build.
+ *
+ * @param project for which the action objects are requested. Never null.
+ * @return Can be empty but must not be null.
+ */
+ public abstract Collection extends Action> createFor(AbstractBuild target);
+
+ /**
+ * Returns all the registered {@link TransientBuildActionFactory}s.
+ */
+ public static ExtensionList all() {
+ return Jenkins.getInstance().getExtensionList(TransientBuildActionFactory.class);
+ }
+}
\ No newline at end of file