Skip to content

Commit

Permalink
Provide parameters from manual approval on all promotions
Browse files Browse the repository at this point in the history
If a manual promotion has been done, provide its parameters to any other
type of promotion that may trigger the build.

Reword the SelfPromotionCondition failure text to indicate that the
build may still be in progress.

[FIXED JENKINS-29793]
  • Loading branch information
Brint E. Kriebel committed Sep 30, 2015
1 parent 4223721 commit 9c76a08
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java
Expand Up @@ -311,7 +311,19 @@ public boolean considerPromotion(AbstractBuild<?,?> build) throws IOException {
* @throws IOException
*/
public Future<Promotion> considerPromotion2(AbstractBuild<?, ?> build) throws IOException {
return considerPromotion2(build, (List<ParameterValue>)null);
LOGGER.fine("Considering the promotion of "+build+" via "+getName()+" without parmeters");
// If the build has manual approvals, use the parameters from it
List<ParameterValue> params = new ArrayList<ParameterValue>();
List<ManualApproval> approvals = build.getActions(ManualApproval.class);
for (ManualApproval approval : approvals) {
if (approval.name.equals(getName())) {
LOGGER.fine("Getting parameters from existing manual promotion");
params = approval.badge.getParameterValues();
LOGGER.finer("Using paramters: "+params.toString());
}
}

return considerPromotion2(build, params);
}

public Future<Promotion> considerPromotion2(AbstractBuild<?,?> build, List<ParameterValue> params) throws IOException {
Expand All @@ -324,7 +336,7 @@ public Future<Promotion> considerPromotion2(AbstractBuild<?,?> build, List<Param
if(a!=null && a.contains(this))
return null;

LOGGER.fine("Considering the promotion of "+build+" via "+getName());
LOGGER.fine("Considering the promotion of "+build+" via "+getName()+" with parameters");
Status qualification = isMet(build);
if(qualification==null)
return null; // not this time
Expand Down
@@ -1,3 +1,3 @@
<div>
${%Build failed - cannot be automatically promoted}
${%Build still in progress or failed - not automatically promoted}
</div>

0 comments on commit 9c76a08

Please sign in to comment.