Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-74073] Migrate legacy checkUrl in M2ReleaseBuildWrapper/global.jelly #123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,9 @@
* Checks if the Nexus URL exists and we can authenticate against it.
*/
@POST
public FormValidation doUrlCheck(@QueryParameter String urlValue,
final @QueryParameter String usernameValue,
final @QueryParameter Secret passwordValue) {
public FormValidation doUrlCheck(@QueryParameter("m2release.nexusURL") String urlValue,
final @QueryParameter("m2release.nexusUser") String usernameValue,
final @QueryParameter Secret value) {
// this method can be used to check if a file exists anywhere in the file system,
// so it should be protected.
if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
Expand All @@ -503,11 +503,11 @@
if (!(url.getProtocol().equals("http") || url.getProtocol().equals("https"))) {
return FormValidation.error("protocol must be http or https");
}
StageClient client = new StageClient(new URL(testURL), usernameValue, passwordValue.getPlainText());
StageClient client = new StageClient(new URL(testURL), usernameValue, value.getPlainText());
client.checkAuthentication();
}
catch (MalformedURLException ex) {
return FormValidation.error(url + " is not a valid URL");
return FormValidation.error(urlValue + " is not a valid URL");

Check warning on line 510 in src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 510 is not covered by tests
}
catch (StageException ex) {
FormValidation stageError = FormValidation.error(ex.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,14 @@
<!-- any global configurations for the release plugin will go here. -->
<f:optionalBlock name="m2release.nexusSupport" title="Enable Nexus Pro support" checked="${descriptor.nexusSupport}" help="${rootURL}/plugin/m2release/help-globalConfig.html">
<f:entry title="Nexus URL" help="${rootURL}/plugin/m2release/help-nexusURL.html">
<f:textbox name="m2release.nexusURL" value="${descriptor.nexusURL}"
onchange="findMatchingFormInput(this,'m2release.nexusPassword').onchange()" />
<f:textbox name="m2release.nexusURL" value="${descriptor.nexusURL}"/>
</f:entry>
<f:entry title="Nexus User" help="${rootURL}/plugin/m2release/help-nexusUserPass.html" >
<f:textbox name="m2release.nexusUser" value="${descriptor.nexusUser}"
onchange="findMatchingFormInput(this,'m2release.nexusPassword').onchange()" />
<f:textbox name="m2release.nexusUser" value="${descriptor.nexusUser}"/>
</f:entry>
<f:entry title="Nexus Password" help="${rootURL}/plugin/m2release/help-nexusUserPass.html">
<f:password name="m2release.nexusPassword" value="${descriptor.nexusPassword}"
checkUrl="'${rootURL}/buildWrapper/M2ReleaseBuildWrapper/urlCheck?urlValue='+escape(findMatchingFormInput(this,'m2release.nexusURL').value)+'&amp;usernameValue='+escape(findMatchingFormInput(this,'m2release.nexusUser').value)+'&amp;passwordValue='+escape(findMatchingFormInput(this,'m2release.nexusPassword').value)"
checkMethod="post" />
<f:password name="m2release.nexusPassword" value="${descriptor.nexusPassword}"
checkUrl="${rootURL}/buildWrapper/M2ReleaseBuildWrapper/urlCheck" checkDependsOn="m2release.nexusURL m2release.nexusUser"/>
</f:entry>
</f:optionalBlock>

Expand Down
Loading