From ab8a84d278118146ac6e139f968b553dcc615ee7 Mon Sep 17 00:00:00 2001 From: Rafal Hejna Date: Wed, 20 Apr 2022 20:08:39 +0200 Subject: [PATCH 1/6] Remove references to non-existent error.png icon --- .../LastBuildPromotionStatusColumn.java | 8 +- .../promoted_builds/PromotionProcess.java | 98 +++++++++---------- .../plugins/promoted_builds/Status.java | 41 ++++---- .../jobdsl/JobDslPromotionProcess.java | 4 +- .../column.jelly | 11 ++- .../PromotedBuildAction/badge.jelly | 19 ++-- 6 files changed, 97 insertions(+), 84 deletions(-) diff --git a/src/main/java/hudson/plugins/promoted_builds/LastBuildPromotionStatusColumn.java b/src/main/java/hudson/plugins/promoted_builds/LastBuildPromotionStatusColumn.java index 7ec5ccd8..82625523 100644 --- a/src/main/java/hudson/plugins/promoted_builds/LastBuildPromotionStatusColumn.java +++ b/src/main/java/hudson/plugins/promoted_builds/LastBuildPromotionStatusColumn.java @@ -32,10 +32,10 @@ public List getPromotionIcons(final Item item) { PromotedBuildAction a = b != null ? b.getAction(PromotedBuildAction.class) : null; if (a != null) { for (Status s : a.getPromotions()) { - PromotionProcess process = s.getProcess(); - if (process !=null && process.isVisible()){ - icons.add(s.getIcon("16px")); - } + PromotionProcess process = s.getProcess(); + if (process !=null && process.isVisible()){ + icons.add(s.getIcon()); + } } } } diff --git a/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java b/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java index 080c48fa..55317560 100644 --- a/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java +++ b/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java @@ -69,7 +69,7 @@ * * @author Kohsuke Kawaguchi */ - // BuildableItem, LazyBuildMixIn.LazyLoadingJob, ParameterizedJobMixIn.ParameterizedJob +// BuildableItem, LazyBuildMixIn.LazyLoadingJob, ParameterizedJobMixIn.ParameterizedJob public final class PromotionProcess extends AbstractProject implements Saveable, Describable, BuildableItemWithBuildWrappers { /** @@ -79,8 +79,8 @@ public final class PromotionProcess extends AbstractProject(this); /** * The icon that represents this promotion process. This is the name of - * the GIF icon that can be found in ${rootURL}/plugin/promoted-builds/icons/16x16/ - * and ${rootURL}/plugin/promoted-builds/icons/32x32/, e.g. "star-gold". + * the SVG icon that can be found in ${rootURL}/plugin/promoted-builds/icons/, + * e.g. "star-gold". */ public String icon; @@ -218,7 +218,7 @@ public AbstractProject asProject() { } public Map,BuildWrapper> getBuildWrappers() { - return getBuildWrappersList().toMap(); + return getBuildWrappersList().toMap(); } public DescribableList> getBuildWrappersList() { @@ -290,44 +290,44 @@ public String getIcon() { } public String getIsVisible(){ - return isVisible; + return isVisible; } public boolean isVisible(){ - if (isVisible == null) return true; + if (isVisible == null) return true; - AbstractProject job = getOwner(); + AbstractProject job = getOwner(); - if (job == null) return true; + if (job == null) return true; - String expandedIsVisible = isVisible; - EnvVars environment = getDefaultParameterValuesAsEnvVars(job); - if (environment != null){ - expandedIsVisible = environment.expand(expandedIsVisible); - } + String expandedIsVisible = isVisible; + EnvVars environment = getDefaultParameterValuesAsEnvVars(job); + if (environment != null){ + expandedIsVisible = environment.expand(expandedIsVisible); + } - if (expandedIsVisible == null){ - return true; - } - return !expandedIsVisible.toLowerCase().equals("false"); + if (expandedIsVisible == null){ + return true; + } + return !expandedIsVisible.toLowerCase().equals("false"); } private static EnvVars getDefaultParameterValuesAsEnvVars(AbstractProject owner) { - EnvVars envVars = null; - ParametersDefinitionProperty parametersDefinitionProperty = (ParametersDefinitionProperty)owner.getProperty(ParametersDefinitionProperty.class); - if (parametersDefinitionProperty!=null){ - envVars = new EnvVars(); - for (ParameterDefinition parameterDefinition: parametersDefinitionProperty.getParameterDefinitions()){ - ParameterValue defaultParameterValue = parameterDefinition.getDefaultParameterValue(); - if (defaultParameterValue!=null){ - if (defaultParameterValue instanceof StringParameterValue){ - envVars.put(parameterDefinition.getName(), (String)defaultParameterValue.getValue()); - } - } - } - EnvVars.resolve(envVars); - } - - return envVars; + EnvVars envVars = null; + ParametersDefinitionProperty parametersDefinitionProperty = (ParametersDefinitionProperty)owner.getProperty(ParametersDefinitionProperty.class); + if (parametersDefinitionProperty!=null){ + envVars = new EnvVars(); + for (ParameterDefinition parameterDefinition: parametersDefinitionProperty.getParameterDefinitions()){ + ParameterValue defaultParameterValue = parameterDefinition.getDefaultParameterValue(); + if (defaultParameterValue!=null){ + if (defaultParameterValue instanceof StringParameterValue){ + envVars.put(parameterDefinition.getName(), (String)defaultParameterValue.getValue()); + } + } + } + EnvVars.resolve(envVars); + } + + return envVars; } /** * Handle compatibility with pre-1.8 configs. @@ -418,20 +418,20 @@ public boolean considerPromotion(AbstractBuild build) throws IOException { */ @CheckForNull public Future considerPromotion2(AbstractBuild build) throws IOException { - LOGGER.fine("Considering the promotion of "+build+" via "+getName()+" without parmeters"); - // If the build has manual approvals, use the parameters from it - List params = new ArrayList(); - List 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); - } + LOGGER.fine("Considering the promotion of "+build+" via "+getName()+" without parmeters"); + // If the build has manual approvals, use the parameters from it + List params = new ArrayList(); + List 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); + } @CheckForNull public Future considerPromotion2(AbstractBuild build, List params) throws IOException { @@ -478,7 +478,7 @@ public void promote(AbstractBuild build, Cause cause, Status qualification) * @throws IOException Promotion failure */ public Future promote2(AbstractBuild build, Cause cause, Status qualification) throws IOException { - return promote2(build, cause, qualification, null); + return promote2(build, cause, qualification, null); } /** @@ -539,7 +539,7 @@ public boolean scheduleBuild(@Nonnull AbstractBuild build, @Nonnull Cause c */ @CheckForNull public Future scheduleBuild2(@Nonnull AbstractBuild build, - Cause cause, @CheckForNull List params) { + Cause cause, @CheckForNull List params) { List actions = new ArrayList(); actions.add(Promotion.PromotionParametersAction.buildFor(build, params)); actions.add(new PromotionTargetAction(build)); diff --git a/src/main/java/hudson/plugins/promoted_builds/Status.java b/src/main/java/hudson/plugins/promoted_builds/Status.java index e4665644..d1c5fd7c 100644 --- a/src/main/java/hudson/plugins/promoted_builds/Status.java +++ b/src/main/java/hudson/plugins/promoted_builds/Status.java @@ -90,12 +90,12 @@ public String getName() { */ @CheckForNull public PromotedBuildAction getParent() { - if (parent==null){ + if (parent==null){ final AbstractBuild target = getTarget(); if (target != null) { parent = target.getAction(PromotedBuildAction.class); } - } + } return parent; } @@ -116,11 +116,10 @@ public PromotionProcess getProcess() { /** * Gets the icon that should represent this promotion (that is potentially attempted but failed.) - * @param size size of the icon, will be used in the icon path - * @return Path to the icon in resources + * @return Path to the SVG icon in resources or l:icon class name */ @Nonnull - public String getIcon(String size) { + public String getIcon() { String baseName; PromotionProcess p = getProcess(); @@ -130,7 +129,7 @@ public String getIcon(String size) { } else { Promotion l = getLast(); if (l!=null && l.getResult()!= Result.SUCCESS) { - return Jenkins.RESOURCE_PATH+"/images/"+size+"/error.png"; + return "icon-red"; } baseName = p.getIcon(); } @@ -207,15 +206,15 @@ public Promotion getSuccessfulPromotion(JobPropertyImpl jp) { /** * Returns true if the promotion was successfully completed. - * @return {@code true} if the there were successful promotions. + * @return {@code true} if the there were successful promotions. */ public boolean isPromotionSuccessful() { return promotion>=0; } /** - * Checks promotion attempts. - * @return + * Checks promotion attempts. + * @return * {@code true} if at least one {@link Promotion} activity is attempted. * {@code false} if none is executed yet (this includes the case where it's in the queue. */ @@ -319,8 +318,8 @@ public Promotion getLast() { @Restricted(NoExternalUse.class) public Boolean isLastAnError() { - Promotion l = getLast(); - return (l != null && l.getResult() != Result.SUCCESS); + Promotion l = getLast(); + return (l != null && l.getResult() != Result.SUCCESS); } @@ -357,11 +356,11 @@ public Promotion getPromotionBuild(int number) { public boolean isManuallyApproved(){ final PromotionProcess process = getProcess(); - if (process == null) { + if (process == null) { return false; // Should not be processed } ManualCondition manualCondition=(ManualCondition) process.getPromotionCondition(ManualCondition.class.getName()); - return manualCondition != null; + return manualCondition != null; } public boolean canBuild() { @@ -388,30 +387,30 @@ public boolean canBuild() { */ @POST public void doBuild(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { - + final PromotionProcess process = getProcess(); if (process == null) { throw new AbortException("Cannot retrieve the promotion process"); } - + AbstractBuild target = getTarget(); if (target ==null) { throw new AbortException("Cannot get the target build to be promoted"); } - - ManualCondition manualCondition = (ManualCondition) process.getPromotionCondition(ManualCondition.class.getName()); + + ManualCondition manualCondition = (ManualCondition) process.getPromotionCondition(ManualCondition.class.getName()); // TODO: Use PromotionPermissionHelper.checkPermission instead, but consider issues with backwards compatibility. if (!PromotionPermissionHelper.hasPermission(target.getProject(), manualCondition)) { return; } - + JSONObject formData = req.getSubmittedForm(); - + List paramValues=null; if (formData!=null){ paramValues = new ArrayList(); if (manualCondition!=null){ - List parameterDefinitions=manualCondition.getParameterDefinitions(); + List parameterDefinitions=manualCondition.getParameterDefinitions(); if (parameterDefinitions != null && !parameterDefinitions.isEmpty()) { JSONArray a = JSONArray.fromObject(formData.get("parameter")); @@ -437,7 +436,7 @@ public void doBuild(StaplerRequest req, StaplerResponse rsp) throws IOException, } } if (paramValues==null){ - paramValues = new ArrayList(); + paramValues = new ArrayList(); } Future f = process.scheduleBuild2(target, new UserCause(), paramValues); if (f==null) diff --git a/src/main/java/hudson/plugins/promoted_builds/integrations/jobdsl/JobDslPromotionProcess.java b/src/main/java/hudson/plugins/promoted_builds/integrations/jobdsl/JobDslPromotionProcess.java index dbd5a427..2f61f4e0 100755 --- a/src/main/java/hudson/plugins/promoted_builds/integrations/jobdsl/JobDslPromotionProcess.java +++ b/src/main/java/hudson/plugins/promoted_builds/integrations/jobdsl/JobDslPromotionProcess.java @@ -19,8 +19,8 @@ public final class JobDslPromotionProcess { private String name; /** * The icon that represents this promotion process. This is the name of - * the GIF icon that can be found in ${rootURL}/plugin/promoted-builds/icons/16x16/ - * and ${rootURL}/plugin/promoted-builds/icons/32x32/, e.g. "star-gold". + * the SVG icon that can be found in ${rootURL}/plugin/promoted-builds/icons/, + * e.g. "star-gold". */ private String icon; diff --git a/src/main/resources/hudson/plugins/promoted_builds/LastBuildPromotionStatusColumn/column.jelly b/src/main/resources/hudson/plugins/promoted_builds/LastBuildPromotionStatusColumn/column.jelly index 16e6f61c..79053e29 100644 --- a/src/main/resources/hudson/plugins/promoted_builds/LastBuildPromotionStatusColumn/column.jelly +++ b/src/main/resources/hudson/plugins/promoted_builds/LastBuildPromotionStatusColumn/column.jelly @@ -1,8 +1,15 @@ - + - + + + + + + + + diff --git a/src/main/resources/hudson/plugins/promoted_builds/PromotedBuildAction/badge.jelly b/src/main/resources/hudson/plugins/promoted_builds/PromotedBuildAction/badge.jelly index 49b9ff17..673f0c22 100644 --- a/src/main/resources/hudson/plugins/promoted_builds/PromotedBuildAction/badge.jelly +++ b/src/main/resources/hudson/plugins/promoted_builds/PromotedBuildAction/badge.jelly @@ -1,13 +1,20 @@ - + - - - + + + + + + + + + + From 9f0e9496349e020e2ec59307b166abb44ae3957f Mon Sep 17 00:00:00 2001 From: Rafal Hejna Date: Wed, 20 Apr 2022 20:26:41 +0200 Subject: [PATCH 2/6] Remove references to non-existent error.png icon --- .../promoted_builds/LastBuildPromotionStatusColumn.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/hudson/plugins/promoted_builds/LastBuildPromotionStatusColumn.java b/src/main/java/hudson/plugins/promoted_builds/LastBuildPromotionStatusColumn.java index 82625523..d7b574ae 100644 --- a/src/main/java/hudson/plugins/promoted_builds/LastBuildPromotionStatusColumn.java +++ b/src/main/java/hudson/plugins/promoted_builds/LastBuildPromotionStatusColumn.java @@ -32,10 +32,10 @@ public List getPromotionIcons(final Item item) { PromotedBuildAction a = b != null ? b.getAction(PromotedBuildAction.class) : null; if (a != null) { for (Status s : a.getPromotions()) { - PromotionProcess process = s.getProcess(); - if (process !=null && process.isVisible()){ - icons.add(s.getIcon()); - } + PromotionProcess process = s.getProcess(); + if (process !=null && process.isVisible()){ + icons.add(s.getIcon()); + } } } } From 738911e1699539de6e69f0a26613191530010c16 Mon Sep 17 00:00:00 2001 From: Rafal Hejna Date: Wed, 20 Apr 2022 20:27:49 +0200 Subject: [PATCH 3/6] Remove references to non-existent error.png icon --- .../plugins/promoted_builds/LastBuildPromotionStatusColumn.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/hudson/plugins/promoted_builds/LastBuildPromotionStatusColumn.java b/src/main/java/hudson/plugins/promoted_builds/LastBuildPromotionStatusColumn.java index d7b574ae..5daf6ac8 100644 --- a/src/main/java/hudson/plugins/promoted_builds/LastBuildPromotionStatusColumn.java +++ b/src/main/java/hudson/plugins/promoted_builds/LastBuildPromotionStatusColumn.java @@ -33,7 +33,7 @@ public List getPromotionIcons(final Item item) { if (a != null) { for (Status s : a.getPromotions()) { PromotionProcess process = s.getProcess(); - if (process !=null && process.isVisible()){ + if (process !=null && process.isVisible()){ icons.add(s.getIcon()); } } From 5181fc3e323abd16cb117fc611178bcf595310f6 Mon Sep 17 00:00:00 2001 From: Rafal Hejna Date: Wed, 20 Apr 2022 20:32:20 +0200 Subject: [PATCH 4/6] Remove references to non-existent error.png icon --- .../promoted_builds/PromotionProcess.java | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java b/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java index 55317560..38a0df1d 100644 --- a/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java +++ b/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java @@ -69,7 +69,7 @@ * * @author Kohsuke Kawaguchi */ -// BuildableItem, LazyBuildMixIn.LazyLoadingJob, ParameterizedJobMixIn.ParameterizedJob + // BuildableItem, LazyBuildMixIn.LazyLoadingJob, ParameterizedJobMixIn.ParameterizedJob public final class PromotionProcess extends AbstractProject implements Saveable, Describable, BuildableItemWithBuildWrappers { /** @@ -218,7 +218,7 @@ public AbstractProject asProject() { } public Map,BuildWrapper> getBuildWrappers() { - return getBuildWrappersList().toMap(); + return getBuildWrappersList().toMap(); } public DescribableList> getBuildWrappersList() { @@ -290,42 +290,42 @@ public String getIcon() { } public String getIsVisible(){ - return isVisible; + return isVisible; } public boolean isVisible(){ - if (isVisible == null) return true; + if (isVisible == null) return true; - AbstractProject job = getOwner(); + AbstractProject job = getOwner(); - if (job == null) return true; + if (job == null) return true; - String expandedIsVisible = isVisible; - EnvVars environment = getDefaultParameterValuesAsEnvVars(job); - if (environment != null){ - expandedIsVisible = environment.expand(expandedIsVisible); - } + String expandedIsVisible = isVisible; + EnvVars environment = getDefaultParameterValuesAsEnvVars(job); + if (environment != null){ + expandedIsVisible = environment.expand(expandedIsVisible); + } - if (expandedIsVisible == null){ - return true; - } - return !expandedIsVisible.toLowerCase().equals("false"); + if (expandedIsVisible == null){ + return true; + } + return !expandedIsVisible.toLowerCase().equals("false"); } private static EnvVars getDefaultParameterValuesAsEnvVars(AbstractProject owner) { - EnvVars envVars = null; - ParametersDefinitionProperty parametersDefinitionProperty = (ParametersDefinitionProperty)owner.getProperty(ParametersDefinitionProperty.class); - if (parametersDefinitionProperty!=null){ - envVars = new EnvVars(); - for (ParameterDefinition parameterDefinition: parametersDefinitionProperty.getParameterDefinitions()){ - ParameterValue defaultParameterValue = parameterDefinition.getDefaultParameterValue(); - if (defaultParameterValue!=null){ - if (defaultParameterValue instanceof StringParameterValue){ - envVars.put(parameterDefinition.getName(), (String)defaultParameterValue.getValue()); - } - } - } - EnvVars.resolve(envVars); - } + EnvVars envVars = null; + ParametersDefinitionProperty parametersDefinitionProperty = (ParametersDefinitionProperty)owner.getProperty(ParametersDefinitionProperty.class); + if (parametersDefinitionProperty!=null){ + envVars = new EnvVars(); + for (ParameterDefinition parameterDefinition: parametersDefinitionProperty.getParameterDefinitions()){ + ParameterValue defaultParameterValue = parameterDefinition.getDefaultParameterValue(); + if (defaultParameterValue!=null){ + if (defaultParameterValue instanceof StringParameterValue){ + envVars.put(parameterDefinition.getName(), (String)defaultParameterValue.getValue()); + } + } + } + EnvVars.resolve(envVars); + } return envVars; } @@ -418,20 +418,20 @@ public boolean considerPromotion(AbstractBuild build) throws IOException { */ @CheckForNull public Future considerPromotion2(AbstractBuild build) throws IOException { - LOGGER.fine("Considering the promotion of "+build+" via "+getName()+" without parmeters"); - // If the build has manual approvals, use the parameters from it - List params = new ArrayList(); - List 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); - } + LOGGER.fine("Considering the promotion of "+build+" via "+getName()+" without parmeters"); + // If the build has manual approvals, use the parameters from it + List params = new ArrayList(); + List 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); + } @CheckForNull public Future considerPromotion2(AbstractBuild build, List params) throws IOException { @@ -478,7 +478,7 @@ public void promote(AbstractBuild build, Cause cause, Status qualification) * @throws IOException Promotion failure */ public Future promote2(AbstractBuild build, Cause cause, Status qualification) throws IOException { - return promote2(build, cause, qualification, null); + return promote2(build, cause, qualification, null); } /** @@ -539,7 +539,7 @@ public boolean scheduleBuild(@Nonnull AbstractBuild build, @Nonnull Cause c */ @CheckForNull public Future scheduleBuild2(@Nonnull AbstractBuild build, - Cause cause, @CheckForNull List params) { + Cause cause, @CheckForNull List params) { List actions = new ArrayList(); actions.add(Promotion.PromotionParametersAction.buildFor(build, params)); actions.add(new PromotionTargetAction(build)); From faf998a670721d6eb134df2bad1b2b8a724dfb0f Mon Sep 17 00:00:00 2001 From: Rafal Hejna Date: Wed, 20 Apr 2022 20:38:15 +0200 Subject: [PATCH 5/6] Remove references to non-existent error.png icon --- .../promoted_builds/PromotionProcess.java | 28 +++++++-------- .../plugins/promoted_builds/Status.java | 34 +++++++++---------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java b/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java index 38a0df1d..e3f5c9c9 100644 --- a/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java +++ b/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java @@ -294,25 +294,25 @@ public String getIsVisible(){ } public boolean isVisible(){ - if (isVisible == null) return true; + if (isVisible == null) return true; - AbstractProject job = getOwner(); + AbstractProject job = getOwner(); - if (job == null) return true; + if (job == null) return true; - String expandedIsVisible = isVisible; - EnvVars environment = getDefaultParameterValuesAsEnvVars(job); - if (environment != null){ - expandedIsVisible = environment.expand(expandedIsVisible); - } + String expandedIsVisible = isVisible; + EnvVars environment = getDefaultParameterValuesAsEnvVars(job); + if (environment != null){ + expandedIsVisible = environment.expand(expandedIsVisible); + } - if (expandedIsVisible == null){ - return true; - } - return !expandedIsVisible.toLowerCase().equals("false"); + if (expandedIsVisible == null){ + return true; + } + return !expandedIsVisible.toLowerCase().equals("false"); } private static EnvVars getDefaultParameterValuesAsEnvVars(AbstractProject owner) { - EnvVars envVars = null; + EnvVars envVars = null; ParametersDefinitionProperty parametersDefinitionProperty = (ParametersDefinitionProperty)owner.getProperty(ParametersDefinitionProperty.class); if (parametersDefinitionProperty!=null){ envVars = new EnvVars(); @@ -327,7 +327,7 @@ private static EnvVars getDefaultParameterValuesAsEnvVars(AbstractProject owner) EnvVars.resolve(envVars); } - return envVars; + return envVars; } /** * Handle compatibility with pre-1.8 configs. diff --git a/src/main/java/hudson/plugins/promoted_builds/Status.java b/src/main/java/hudson/plugins/promoted_builds/Status.java index d1c5fd7c..414d4678 100644 --- a/src/main/java/hudson/plugins/promoted_builds/Status.java +++ b/src/main/java/hudson/plugins/promoted_builds/Status.java @@ -90,12 +90,12 @@ public String getName() { */ @CheckForNull public PromotedBuildAction getParent() { - if (parent==null){ + if (parent==null){ final AbstractBuild target = getTarget(); if (target != null) { parent = target.getAction(PromotedBuildAction.class); } - } + } return parent; } @@ -129,7 +129,7 @@ public String getIcon() { } else { Promotion l = getLast(); if (l!=null && l.getResult()!= Result.SUCCESS) { - return "icon-red"; + return "icon-red"; } baseName = p.getIcon(); } @@ -206,15 +206,15 @@ public Promotion getSuccessfulPromotion(JobPropertyImpl jp) { /** * Returns true if the promotion was successfully completed. - * @return {@code true} if the there were successful promotions. + * @return {@code true} if the there were successful promotions. */ public boolean isPromotionSuccessful() { return promotion>=0; } /** - * Checks promotion attempts. - * @return + * Checks promotion attempts. + * @return * {@code true} if at least one {@link Promotion} activity is attempted. * {@code false} if none is executed yet (this includes the case where it's in the queue. */ @@ -318,8 +318,8 @@ public Promotion getLast() { @Restricted(NoExternalUse.class) public Boolean isLastAnError() { - Promotion l = getLast(); - return (l != null && l.getResult() != Result.SUCCESS); + Promotion l = getLast(); + return (l != null && l.getResult() != Result.SUCCESS); } @@ -356,11 +356,11 @@ public Promotion getPromotionBuild(int number) { public boolean isManuallyApproved(){ final PromotionProcess process = getProcess(); - if (process == null) { + if (process == null) { return false; // Should not be processed } ManualCondition manualCondition=(ManualCondition) process.getPromotionCondition(ManualCondition.class.getName()); - return manualCondition != null; + return manualCondition != null; } public boolean canBuild() { @@ -387,30 +387,30 @@ public boolean canBuild() { */ @POST public void doBuild(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { - + final PromotionProcess process = getProcess(); if (process == null) { throw new AbortException("Cannot retrieve the promotion process"); } - + AbstractBuild target = getTarget(); if (target ==null) { throw new AbortException("Cannot get the target build to be promoted"); } - + ManualCondition manualCondition = (ManualCondition) process.getPromotionCondition(ManualCondition.class.getName()); // TODO: Use PromotionPermissionHelper.checkPermission instead, but consider issues with backwards compatibility. if (!PromotionPermissionHelper.hasPermission(target.getProject(), manualCondition)) { return; } - + JSONObject formData = req.getSubmittedForm(); - + List paramValues=null; if (formData!=null){ paramValues = new ArrayList(); if (manualCondition!=null){ - List parameterDefinitions=manualCondition.getParameterDefinitions(); + List parameterDefinitions=manualCondition.getParameterDefinitions(); if (parameterDefinitions != null && !parameterDefinitions.isEmpty()) { JSONArray a = JSONArray.fromObject(formData.get("parameter")); @@ -436,7 +436,7 @@ public void doBuild(StaplerRequest req, StaplerResponse rsp) throws IOException, } } if (paramValues==null){ - paramValues = new ArrayList(); + paramValues = new ArrayList(); } Future f = process.scheduleBuild2(target, new UserCause(), paramValues); if (f==null) From ed590164fb334a3779d70b92c4abe0ed29902d15 Mon Sep 17 00:00:00 2001 From: Rafal Hejna Date: Wed, 20 Apr 2022 20:41:24 +0200 Subject: [PATCH 6/6] Remove references to non-existent error.png icon --- .../java/hudson/plugins/promoted_builds/PromotionProcess.java | 2 +- src/main/java/hudson/plugins/promoted_builds/Status.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java b/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java index e3f5c9c9..8a48af91 100644 --- a/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java +++ b/src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java @@ -309,7 +309,7 @@ public boolean isVisible(){ if (expandedIsVisible == null){ return true; } - return !expandedIsVisible.toLowerCase().equals("false"); + return !expandedIsVisible.toLowerCase().equals("false"); } private static EnvVars getDefaultParameterValuesAsEnvVars(AbstractProject owner) { EnvVars envVars = null; diff --git a/src/main/java/hudson/plugins/promoted_builds/Status.java b/src/main/java/hudson/plugins/promoted_builds/Status.java index 414d4678..05370baf 100644 --- a/src/main/java/hudson/plugins/promoted_builds/Status.java +++ b/src/main/java/hudson/plugins/promoted_builds/Status.java @@ -398,7 +398,7 @@ public void doBuild(StaplerRequest req, StaplerResponse rsp) throws IOException, throw new AbortException("Cannot get the target build to be promoted"); } - ManualCondition manualCondition = (ManualCondition) process.getPromotionCondition(ManualCondition.class.getName()); + ManualCondition manualCondition = (ManualCondition) process.getPromotionCondition(ManualCondition.class.getName()); // TODO: Use PromotionPermissionHelper.checkPermission instead, but consider issues with backwards compatibility. if (!PromotionPermissionHelper.hasPermission(target.getProject(), manualCondition)) { return;