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-63149] - Adding JCasC support #25

Merged
merged 3 commits into from
Feb 5, 2022

Conversation

Robert-Ilg
Copy link

Solves JENKINS-63149: Adding support for JCasC

Details:

  • Using Descriptor interface instead of Plugin extension

  • Moving validation of parameters to FormValidation

  • Adding JCasCCompatibilityTest

  • Resolving minor compiler warnings and spaces at end of line

  • Updating pom dependencies

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your master branch!

  • Ensure that the pull request title represents the desired changelog entry

  • Please describe what you did

  • Link to relevant issues in GitHub or Jira

  • Link to relevant pull requests, esp. upstream and downstream changes

  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@oleg-nenashev oleg-nenashev self-requested a review May 11, 2021 09:19
@oleg-nenashev oleg-nenashev changed the title Adding JCasC support [JENKINS-63149] - Adding JCasC support May 11, 2021
@oleg-nenashev
Copy link
Member

Thank you! I added it to my review queue.
As a quick feedback, maybe it makes sense to add a short documentation and example to README. The plugin still references Jenkins Wiki in the documentation metadata, but IMHO we will be able to move it to README on GitHub during the next release

Copy link
Member

@damianszczepanik damianszczepanik left a comment

Choose a reason for hiding this comment

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

Comments are left, please review

pom.xml Outdated
</parent>

<artifactId>sidebar-link</artifactId>
<packaging>hpi</packaging>
<name>Sidebar Link</name>
<version>1.12.1-SNAPSHOT</version>
<url>http://wiki.jenkins-ci.org/display/JENKINS/Sidebar-Link+Plugin</url>
<version>2.00.1</version>
Copy link
Member

Choose a reason for hiding this comment

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

is it compatible with v1.12 ?

Copy link
Author

Choose a reason for hiding this comment

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

I'm afraid not.
I don't believe that I managed it to be compatible.

@@ -50,6 +52,31 @@
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
Copy link
Member

Choose a reason for hiding this comment

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

do we need joda for this plugin?

Copy link
Author

Choose a reason for hiding this comment

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

I don't know how to solve the plugin conflict in another way:

Failed while enforcing RequireUpperBoundDeps. The error(s) are [
Require upper bound dependencies error for joda-time:joda-time:2.1 paths to dependency are:
+-org.jenkins-ci.plugins:sidebar-link:2.00.1
+-org.jenkinsci.plugins:pipeline-model-definition:1.8.4
+-org.jenkinsci.plugins:pipeline-model-api:1.8.4
+-com.github.fge:json-schema-validator:2.0.4
+-joda-time:joda-time:2.1
and
+-org.jenkins-ci.plugins:sidebar-link:2.00.1
+-io.jenkins.configuration-as-code:test-harness:1.47
+-com.github.erosb:everit-json-schema:1.12.1
+-com.damnhandy:handy-uri-templates:2.1.8
+-joda-time:joda-time:2.10.2

@@ -59,9 +62,14 @@ public LinkAction(String urlName, String displayName, String iconFileName) throw
throw new IllegalArgumentException(validationResult);
}

if((iconFileName == null) || (iconFileName.equals(""))) {
Copy link
Member

Choose a reason for hiding this comment

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

StringUtils.isBlank(iconFileName) like below

Copy link
Author

Choose a reason for hiding this comment

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

Done: please review "minor changes due to review"

@jonesbusy
Copy link
Contributor

Hi! Any chance to have this PR reviewed and merged ? We are interested to use this plugin but are missing jcasc support.

Thanks!

@damianszczepanik damianszczepanik merged commit 72f20c6 into jenkinsci:master Feb 5, 2022
@damianszczepanik
Copy link
Member

JCasC is merged. I will be happy to release it but before that I need to test it. Who can help me about it? I believe the readme file must be updated as well so it has some simple documentation how to use it

@jonesbusy
Copy link
Contributor

@damianszczepanik Amazing! I will test tomorrow the master branch. I will only test that the JcasC configuration is working for the global links (I don't use other feature). Thanks

@jonesbusy
Copy link
Contributor

Hi,

I've tested the creation of global links via JcasC. All working as expected

unclassified:
  sidebarGlobalLink:
    links:
    - displayName: "Link1"
      iconFileName: "static/efbf17e4/images/16x16/help.png"
      urlName: "https://www.google.com"
    - displayName: "Link2"
      iconFileName: "static/efbf17e4/images/16x16/help.png"

side_bar_link1

@damianszczepanik
Copy link
Member

Published

@@ -59,9 +64,14 @@ public LinkAction(String urlName, String displayName, String iconFileName) throw
throw new IllegalArgumentException(validationResult);
}

if(StringUtils.isBlank(iconFileName)) {
iconFileName = "static/efbf17e4/images/16x16/help.png";
Copy link
Contributor

Choose a reason for hiding this comment

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

This efbf17e4 seems to be SESSION_HASH from https://github.com/jenkinsci/jenkins/blob/5661c1055d026424118e2488b84ea22a19bf423d/core/src/main/java/jenkins/model/Jenkins.java#L5330-L5336. Perhaps the default iconFileName should instead be just "images/16x16/help.png". Reading the current hash from Jenkins.RESOURCE_PATH seems a worse alternative because the resulting iconFileName will be persisted and used after subsequent Jenkins upgrades.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, war/src/main/webapp/images/16x16/help.png was deleted from the Jenkins core in jenkinsci/jenkins#5778.

Copy link
Contributor

Choose a reason for hiding this comment

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

Filed #40 about the default icon.

@Restricted(NoExternalUse.class)
public FormValidation doCheckLinkIcon(@QueryParameter String value) {
if (StringUtils.isBlank(value)) {
return FormValidation.warning("The provided icon is blank or empty. Defautl will used.");
Copy link
Contributor

Choose a reason for hiding this comment

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

"Default" not "Defautl"

Copy link
Contributor

Choose a reason for hiding this comment

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

Was fixed in dd8e66e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants