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-39470] Migrate to 2.17 parent POM #1

Merged
merged 3 commits into from Nov 8, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions pom.xml
Expand Up @@ -3,9 +3,9 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<!-- TODO switch to 1.532.2 if JENKINS-16936 is backported -->
<version>1.537</version>
<version>2.17</version>
</parent>

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not change the existing code conventions, if there is no space in the original code do not add it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 please try to stage only functionnally impacted lines (use git gui or equivalent then select lines, then Index lines.

<artifactId>secure-requester-whitelist</artifactId>
<version>1.1-SNAPSHOT</version>
<packaging>hpi</packaging>
Expand All @@ -18,25 +18,30 @@
<url>http://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>

<scm>
<connection>scm:git:git://github.com/jenkinsci/${project.artifactId}-plugin.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/${project.artifactId}-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
</scm>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for this deletion??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above, no longer necessary.


<properties>
<!-- TODO until bc4c132 in 1.545, or below 1.536 -->
<concurrency>1</concurrency>
<jenkins.version>1.580.1</jenkins.version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it's on purpose you didn't stay on the same 1.537 baseline

<java.level>6</java.level>
<findbugs.failOnError>false</findbugs.failOnError>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to fix these.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's because a possible NPE here:
return Jenkins.getInstance().getDescriptorByType(Whitelist.class);

I think it's something that is not gonna happen.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still useful to fix warnings in order to enforce further checks

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jglick @oleg-nenashev supressed warning for this scenario and removed flag from POM.

</properties>
</project>
1 change: 1 addition & 0 deletions src/main/resources/index.jelly
@@ -1,3 +1,4 @@
<?jelly escape-by-default='true'?>
<div>
Allows an administrator to specify sites trusted to make JSONP or primitive-XPath REST API requests.
</div>
Expand Up @@ -25,7 +25,7 @@
package org.jenkinsci.plugins.secure_requester_whitelist;

import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.WebRequestSettings;
import com.gargoylesoftware.htmlunit.WebRequest;
import java.net.URL;
import net.sf.json.JSONObject;
import static org.junit.Assert.*;
Expand All @@ -39,10 +39,13 @@ public class SecureRequesterImplTest {
@Rule public JenkinsRule r = new JenkinsRule();

@PresetData(PresetData.DataSet.NO_ANONYMOUS_READACCESS)
@Test public void authorizing() throws Exception {
@Test

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code style, the rest of the tests in this plugin use @Test public format, do not change it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not care about choice of style per se, but avoid gratuitous diff hunks.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am reverting this one to make it consistent with the style in the rest of project.

public void authorizing() throws Exception {
assertJSONP(null, 403);
assertJSONP("http://apache.org/", 403);

Whitelist.get().configure(null, new JSONObject().accumulate("allowNoReferer", true).accumulate("domains", "apache.org jenkins-ci.org"));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change in code style, again

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted.

assertJSONP(null, 200);
assertJSONP("http://apache.org/", 200);
assertJSONP("http://jenkins-ci.org/", 200);
Expand All @@ -51,13 +54,15 @@ public class SecureRequesterImplTest {
assertJSONP("huh?", 403);
}

private void assertJSONP(String referer, int expectedStatusCode) throws Exception {
JenkinsRule.WebClient wc = r.createWebClient();
private void assertJSONP(final String referer, final int expectedStatusCode) throws Exception {
final JenkinsRule.WebClient wc = r.createWebClient();
wc.login("alice");
WebRequestSettings req = new WebRequestSettings(new URL(wc.getContextPath() + "api/json?jsonp"));

final WebRequest req = new WebRequest(new URL(wc.getContextPath() + "api/json?jsonp"));
if (referer != null) {
req.setAdditionalHeader("Referer", referer);
}

try {
wc.getPage(req);
assertEquals(expectedStatusCode, 200);
Expand Down