forked from hpsa/hpe-application-automation-tools-plugin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support HTTPS protocol for PCS (#155)
* index on master: ab83a3d Merge remote-tracking branch 'remotes/origin/5.0.1-beta-SNAPSHOT' * Revert pom changes * Merge branch '5.0.1-beta-SNAPSHOT' of https://github.com/hpsa/hp-application-automation-tools-plugin into development # Conflicts: # .github/PULL_REQUEST_TEMPLATE.md * Added some comments * changes according to sonarlint * changes for sonarlint * Remove some comments * Comments * * Fix for supporting SECURITY-170 changes * https://jenkins.io/blog/2016/05/11/security-update/ * https://issues.jenkins-ci.org/browse/JENKINS-39654 * code changes for sonarlint
- Loading branch information
Showing
12 changed files
with
186 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/main/java/com/hp/application/automation/tools/run/AdditionalParametersAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.hp.application.automation.tools.run; | ||
|
||
import hudson.EnvVars; | ||
import hudson.Extension; | ||
import hudson.model.EnvironmentContributor; | ||
import hudson.model.ParameterValue; | ||
import hudson.model.Run; | ||
import hudson.model.TaskListener; | ||
import hudson.model.ParametersAction; | ||
|
||
import java.io.IOException; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* Fix for supporting SECURITY-170 changes | ||
* https://jenkins.io/blog/2016/05/11/security-update/ | ||
* https://issues.jenkins-ci.org/browse/JENKINS-39654 | ||
* | ||
*/ | ||
public class AdditionalParametersAction extends ParametersAction{ | ||
|
||
private List<ParameterValue> parameters; | ||
|
||
public AdditionalParametersAction(List<ParameterValue> cparameters){ | ||
this.parameters = Collections.unmodifiableList(cparameters); | ||
} | ||
|
||
|
||
|
||
@Override | ||
public List<ParameterValue> getParameters() { | ||
return Collections.unmodifiableList(parameters); | ||
} | ||
|
||
@Override | ||
public ParameterValue getParameter(String name){ | ||
for (ParameterValue p : parameters) { | ||
if (p == null) | ||
continue; | ||
if (p.getName().equals(name)) | ||
return p; | ||
} | ||
return null; | ||
} | ||
|
||
@Extension | ||
public static final class AdditionalParametersActionEnvironmentContributor extends EnvironmentContributor { | ||
@Override | ||
public void buildEnvironmentFor(Run r, EnvVars envs, TaskListener listener) | ||
throws IOException, InterruptedException { | ||
AdditionalParametersAction action = r.getAction(AdditionalParametersAction.class); | ||
if (action != null) { | ||
for (ParameterValue p : action.getParameters()) { | ||
envs.putIfNotNull(p.getName(), String.valueOf(p.getValue())); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.