Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from rinokadijk/master
Fixed JENKINS-15882 - rebuild plugin should not store non-stored password parameter
- Loading branch information
Showing
9 changed files
with
187 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,8 @@ work | |
.classpath | ||
.project | ||
.settings | ||
### IntelliJ ### | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ |
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
69 changes: 69 additions & 0 deletions
69
src/main/java/com/sonyericsson/rebuild/RebuildConfiguration.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,69 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright 2013 Rino Kadijk. | ||
* | ||
* 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 com.sonyericsson.rebuild; | ||
|
||
import hudson.model.Describable; | ||
import hudson.model.Descriptor; | ||
import hudson.model.Hudson; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
/** | ||
* This class holds the configuration values for the rebuild action. | ||
*/ | ||
public class RebuildConfiguration implements Describable { | ||
|
||
public boolean rememberPasswordEnabled; | ||
|
||
/** | ||
* Constructs a new configuration object. | ||
* | ||
* @param rememberPasswordEnabled indicates whether the password field should be pre-filled or empty when rebuilding | ||
* a job with a password parameter. | ||
*/ | ||
@DataBoundConstructor | ||
public RebuildConfiguration(boolean rememberPasswordEnabled) { | ||
this.rememberPasswordEnabled = rememberPasswordEnabled; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "RebuildConfiguration{" + | ||
"rememberPasswordEnabled=" + rememberPasswordEnabled + | ||
'}'; | ||
} | ||
|
||
@Override | ||
public Descriptor getDescriptor() { | ||
return Hudson.getInstance().getDescriptorOrDie(RebuildConfiguration.class); | ||
} | ||
|
||
/** | ||
* True if the password field should be pre-filled. | ||
* | ||
* @return true if the password field should be pre-filled. | ||
*/ | ||
public boolean getRememberPasswordEnabled() { | ||
return rememberPasswordEnabled; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/com/sonyericsson/rebuild/RebuildDescriptor.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,40 @@ | ||
package com.sonyericsson.rebuild; | ||
|
||
import jenkins.model.GlobalConfiguration; | ||
import net.sf.json.JSONObject; | ||
import org.kohsuke.stapler.StaplerRequest; | ||
|
||
/** | ||
* This class holds the configuration values for the rebuild action. | ||
*/ | ||
public final class RebuildDescriptor extends GlobalConfiguration { | ||
private final RebuildConfiguration rebuildConfiguration = new RebuildConfiguration(Boolean.TRUE); | ||
|
||
/** | ||
* Constructs a new Descriptor implementation. | ||
*/ | ||
public RebuildDescriptor() { | ||
load(); | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Rebuild"; | ||
} | ||
|
||
@Override | ||
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException { | ||
this.rebuildConfiguration.rememberPasswordEnabled = Boolean.valueOf(formData.getString("rememberPasswordEnabled")); | ||
save(); | ||
return true; | ||
} | ||
|
||
/** | ||
* Gets the configuration object. | ||
* | ||
* @return the configuration object. | ||
*/ | ||
public RebuildConfiguration getRebuildConfiguration() { | ||
return rebuildConfiguration; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/resources/com/sonyericsson/rebuild/RebuildAction/ExtendedChoiceParameterValue.jelly
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,35 @@ | ||
<!-- | ||
The MIT License | ||
Copyright 2013 Rino Kadijk. | ||
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. | ||
--> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" | ||
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" | ||
xmlns:i="jelly:fmt" xmlns:p="/lib/hudson/project"> | ||
<f:entry title="${it.name}" description="${it.description}"> | ||
<div name="parameter" description="${it.description}"> | ||
<input type="hidden" name="name" value="${it.name}" /> | ||
<f:textbox name="value" value="${it.value}" /> | ||
</div> | ||
</f:entry> | ||
</j:jelly> | ||
|
||
|
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
13 changes: 13 additions & 0 deletions
13
src/main/resources/com/sonyericsson/rebuild/RebuildDescriptor/config.jelly
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,13 @@ | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" | ||
xmlns:t="/lib/hudson" | ||
xmlns:f="/lib/form"> | ||
<f:section title="Rebuild"> | ||
<f:entry title="Rebuild Configuration"> | ||
<table width="100%"> | ||
<f:entry title="Remember Password Enabled" field="rememberPasswordEnabled"> | ||
<f:checkbox default="true" checked="${descriptor.rebuildConfiguration.rememberPasswordEnabled}" /> | ||
</f:entry> | ||
</table> | ||
</f:entry> | ||
</f:section> | ||
</j:jelly> |
6 changes: 6 additions & 0 deletions
6
...in/resources/com/sonyericsson/rebuild/RebuildDescriptor/help-rememberPasswordEnabled.html
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,6 @@ | ||
<div> | ||
If the remember password option is checked, the rebuild plugin will use the stored password parameter when a | ||
rebuild is triggered. If the remember password option is unchecked, the user will be prompted to enter the | ||
password every time a rebuild is triggered. This only applies for a parameterized build with parameters of | ||
type password. | ||
</div> |