Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-25682

Using Credentials as attributes shows all perforce credentials with same description

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Created 2 perforce credentials. Used perforce credentials as one of the attribute. When running the build job in drop down for selecting perforce credentials shows both descriptions same "Perforce Software Credentials". It s difficult to differentiate which credential is which one. While using it as part of perforce setting block in job the drop down choice appear fine "Perforce Software Credential - xxxxx". The drop down for attribute value selection should also have the same behavior.

        Attachments

          Activity

          Hide
          p4paul Paul Allen added a comment -

          Please enter a unique description in the Description field when creating or updating the Credential.

          Show
          p4paul Paul Allen added a comment - Please enter a unique description in the Description field when creating or updating the Credential.
          Hide
          snarang Sangeeta Narang added a comment -

          Description for Credential specified in Global Credentials is unique, for example, "Group1 P4 Creds". But when I go to select the credential from select credential Attribute drop down shows "Perforce Password Credential" and the description contents are not even there.

          I am using templates from enterprise jenkins. The Credential description shows fine as "Perforce Password Credential (Group1 P4 Creds)", if they are used from within the job.

          Show
          snarang Sangeeta Narang added a comment - Description for Credential specified in Global Credentials is unique, for example, "Group1 P4 Creds". But when I go to select the credential from select credential Attribute drop down shows "Perforce Password Credential" and the description contents are not even there. I am using templates from enterprise jenkins. The Credential description shows fine as "Perforce Password Credential (Group1 P4 Creds)", if they are used from within the job.
          Hide
          p4paul Paul Allen added a comment -

          Please can you take a screenshot. I don't use enterprise Jenkins and perhaps it displays things a little different.

          If you look at the Markdown page on GitHub (https://github.com/jenkinsci/p4-plugin) and scroll down to the Credentials section I have screen shots for normal Jenkins. You can see here there is an example of multiple credentials.

          Show
          p4paul Paul Allen added a comment - Please can you take a screenshot. I don't use enterprise Jenkins and perhaps it displays things a little different. If you look at the Markdown page on GitHub ( https://github.com/jenkinsci/p4-plugin ) and scroll down to the Credentials section I have screen shots for normal Jenkins. You can see here there is an example of multiple credentials.
          Hide
          snarang Sangeeta Narang added a comment -

          Just uploaded the jpeg screenshots. Please ignore the snagproj files.
          So as you can see if I have two perforce credentials, I can not differentiate between them from UI. As number of credentials grow it all become painful to differentaite between them.

          Show
          snarang Sangeeta Narang added a comment - Just uploaded the jpeg screenshots. Please ignore the snagproj files. So as you can see if I have two perforce credentials, I can not differentiate between them from UI. As number of credentials grow it all become painful to differentaite between them.
          Hide
          jglick Jesse Glick added a comment -

          Paul Allen you need to specify @NameWith on P4Credentials or perhaps concrete subtypes such as P4PasswordImpl. See https://github.com/jenkinsci/plain-credentials-plugin/blob/445994d3d7f268731aca463887a4a835287901e2/src/main/java/org/jenkinsci/plugins/plaincredentials/StringCredentials.java#L37 as an example. From those screenshots it does not appear that you ever ask the user to select a particular credentials directly (perhaps you find one automatically based on field matches?), so you might not have ever had cause to call CredentialsNameProvider.name (or use something which does, such as <c:select>) and discover that the result is not helpful.

          Sangeeta Narang you cannot expect the maintainer of an OSS plugin to even know what you are talking about when discussing an issue only reproducible in combination with Jenkins Enterprise plugins. When encountering issues like these it is better to file a support ticket so that CloudBees engineering can evaluate the situation and decide whether a fix in an OSS plugin is warranted, and if so to file it with adequate background information.

          Stephen Connolly do you know why StandardCredentials.NameProvider is not kicking in as a fallback here?

          Show
          jglick Jesse Glick added a comment - Paul Allen you need to specify @NameWith on P4Credentials or perhaps concrete subtypes such as P4PasswordImpl . See https://github.com/jenkinsci/plain-credentials-plugin/blob/445994d3d7f268731aca463887a4a835287901e2/src/main/java/org/jenkinsci/plugins/plaincredentials/StringCredentials.java#L37 as an example. From those screenshots it does not appear that you ever ask the user to select a particular credentials directly (perhaps you find one automatically based on field matches?), so you might not have ever had cause to call CredentialsNameProvider.name (or use something which does, such as <c:select> ) and discover that the result is not helpful. Sangeeta Narang you cannot expect the maintainer of an OSS plugin to even know what you are talking about when discussing an issue only reproducible in combination with Jenkins Enterprise plugins. When encountering issues like these it is better to file a support ticket so that CloudBees engineering can evaluate the situation and decide whether a fix in an OSS plugin is warranted, and if so to file it with adequate background information. Stephen Connolly do you know why StandardCredentials.NameProvider is not kicking in as a fallback here?
          Hide
          p4paul Paul Allen added a comment -

          Thanks for looking into this...

          Not 100% sure how the @NameWith annotation works, but happy to add it where it is needed. Is there a way I can get a trial version of the Enterprise Jenkins to test this out?

          Show
          p4paul Paul Allen added a comment - Thanks for looking into this... Not 100% sure how the @NameWith annotation works, but happy to add it where it is needed. Is there a way I can get a trial version of the Enterprise Jenkins to test this out?
          Hide
          jglick Jesse Glick added a comment -

          Easiest is to install the metaplugin https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Enterprise+by+CloudBees and choose the minimal (license-only) installation mode, asking for an evaluation license when prompted, then go and install the Templates plugin.

          If you do not want to bother with that, you can confirm the correct behavior in a (JenkinsRule-based) test by just calling CredentialsNameProvider.name on your credentials and asserting that the result is a meaningful label. If you are stuck, I can try producing a pull request.

          Show
          jglick Jesse Glick added a comment - Easiest is to install the metaplugin https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Enterprise+by+CloudBees and choose the minimal (license-only) installation mode, asking for an evaluation license when prompted, then go and install the Templates plugin. If you do not want to bother with that, you can confirm the correct behavior in a ( JenkinsRule -based) test by just calling CredentialsNameProvider.name on your credentials and asserting that the result is a meaningful label. If you are stuck, I can try producing a pull request.
          Hide
          p4paul Paul Allen added a comment -

          Thanks. I like the JenkinsRule test idea, always prefer to automate tests where I can. I'll give it a go, if I get any trouble I'll ask for help.

          Show
          p4paul Paul Allen added a comment - Thanks. I like the JenkinsRule test idea, always prefer to automate tests where I can. I'll give it a go, if I get any trouble I'll ask for help.
          Hide
          p4paul Paul Allen added a comment -

          Ok, this change should resolve the issue:
          https://github.com/jenkinsci/p4-plugin/commit/aa910d56936a308600bdad568e2ab23ada636b7d

          Not sure why it didn't link the commit with JIRA?

          Show
          p4paul Paul Allen added a comment - Ok, this change should resolve the issue: https://github.com/jenkinsci/p4-plugin/commit/aa910d56936a308600bdad568e2ab23ada636b7d Not sure why it didn't link the commit with JIRA?
          Show
          jglick Jesse Glick added a comment - The JIRA link daemon is dead, I think. Sangeeta Narang you can try this build if you want to verify: https://jenkins.ci.cloudbees.com/job/plugins/job/p4-plugin/org.jenkins-ci.plugins$p4/104/artifact/org.jenkins-ci.plugins/p4/1.0.24-SNAPSHOT/p4-1.0.24-SNAPSHOT.hpi
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/com/cloudbees/plugins/credentials/CredentialsNameProvider.java
          src/test/java/com/cloudbees/plugins/credentials/CredentialsNameProviderTest.java
          http://jenkins-ci.org/commit/credentials-plugin/813ca86ea4c749295556c20f60c4114a91db36e4
          Log:
          JENKINS-25682 Adding test which failed in interfaceOfSuperclassAnnotated.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/com/cloudbees/plugins/credentials/CredentialsNameProvider.java src/test/java/com/cloudbees/plugins/credentials/CredentialsNameProviderTest.java http://jenkins-ci.org/commit/credentials-plugin/813ca86ea4c749295556c20f60c4114a91db36e4 Log: JENKINS-25682 Adding test which failed in interfaceOfSuperclassAnnotated.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/com/cloudbees/plugins/credentials/CredentialsNameProvider.java
          src/test/java/com/cloudbees/plugins/credentials/CredentialsNameProviderTest.java
          http://jenkins-ci.org/commit/credentials-plugin/1d51a488fbdaa994f598648f96d579e644bc815e
          Log:
          Merge pull request #17 from jglick/JENKINS-25682-CredentialsNameProvider

          JENKINS-25682 Fixing interfaceOfSuperclassAnnotated

          Compare: https://github.com/jenkinsci/credentials-plugin/compare/f71aef05722a...1d51a488fbda

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/com/cloudbees/plugins/credentials/CredentialsNameProvider.java src/test/java/com/cloudbees/plugins/credentials/CredentialsNameProviderTest.java http://jenkins-ci.org/commit/credentials-plugin/1d51a488fbdaa994f598648f96d579e644bc815e Log: Merge pull request #17 from jglick/ JENKINS-25682 -CredentialsNameProvider JENKINS-25682 Fixing interfaceOfSuperclassAnnotated Compare: https://github.com/jenkinsci/credentials-plugin/compare/f71aef05722a...1d51a488fbda
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Paul Allen
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/p4/credentials/P4PasswordImpl.java
          src/main/java/org/jenkinsci/plugins/p4/credentials/P4TicketImpl.java
          http://jenkins-ci.org/commit/p4-plugin/ae4942e0977fcc00847962444bb2aef7582913e6
          Log:
          Remove `@NameWith` annotation

          The 1.19 Credential release fixes the issue.

          JENKINS-25682

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Paul Allen Path: pom.xml src/main/java/org/jenkinsci/plugins/p4/credentials/P4PasswordImpl.java src/main/java/org/jenkinsci/plugins/p4/credentials/P4TicketImpl.java http://jenkins-ci.org/commit/p4-plugin/ae4942e0977fcc00847962444bb2aef7582913e6 Log: Remove `@NameWith` annotation The 1.19 Credential release fixes the issue. JENKINS-25682
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/com/cloudbees/plugins/credentials/CredentialsNameProvider.java
          src/test/java/com/cloudbees/plugins/credentials/CredentialsNameProviderTest.java
          src/test/java/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImplTest.java
          http://jenkins-ci.org/commit/credentials-plugin/c1470db23f2ecde3f8cf1a96120a3920452bb5f0
          Log:
          JENKINS-25682 #17 refinement: NameWith.priority is intended to be compared amongst also interfaces implemented closer in the superclass chain than others.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/com/cloudbees/plugins/credentials/CredentialsNameProvider.java src/test/java/com/cloudbees/plugins/credentials/CredentialsNameProviderTest.java src/test/java/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImplTest.java http://jenkins-ci.org/commit/credentials-plugin/c1470db23f2ecde3f8cf1a96120a3920452bb5f0 Log: JENKINS-25682 #17 refinement: NameWith.priority is intended to be compared amongst also interfaces implemented closer in the superclass chain than others.

            People

            • Assignee:
              Unassigned
              Reporter:
              snarang Sangeeta Narang
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: