Details

    • Similar Issues:

      Description

      It should be easier to refer to a particular Credentials from a script.

      Currently you can use GenericSCMStep with a hardcoded ID (or see JENKINS-26085). But this looks ugly in the script. It would be nicer for not just Workflow but other non-UI-driven plugins as well (Templates, Job DSL, YAML Project, &c.) if you could define a meaningful ID when creating a StandardCredentials. Perhaps this could be in an Advanced block when configuring the credentials. Without such a UI, you have to resort to editing $JENKINS_HOME/credentials.xml and reloading configuration from disk.

      Note that the actual lookup of the live StandardCredentials by its ID happens in some context, where the Item and DomainRestrictions are considered. So if the referent is not appropriate in the current context, the plugin code using the ID (for example, git-plugin) is responsible for rejecting the attempt, minimally just by saying that no Credentials with that ID could be found. In other words, security & sanity checks can be done in UI forms but they must be done again at runtime anyway; this is true even for freestyle projects since you can just upload a new config.xml with an arbitrary <credentialsId>...</credentialsId>.

      The Credentials plugin does of course need to take care to ensure that IDs are unique within a given CredentialsProvider when loading definitions from disk or adding definitions.

        Attachments

          Issue Links

            Activity

            jglick Jesse Glick created issue -
            jglick Jesse Glick made changes -
            Field Original Value New Value
            Link This issue is related to JENKINS-26085 [ JENKINS-26085 ]
            jglick Jesse Glick made changes -
            Link This issue is related to JENKINS-26299 [ JENKINS-26299 ]
            jglick Jesse Glick made changes -
            Link This issue is related to JENKINS-26051 [ JENKINS-26051 ]
            jglick Jesse Glick made changes -
            Assignee stephenconnolly [ stephenconnolly ] Jesse Glick [ jglick ]
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BaseSSHUser.java
            src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPassword.java
            src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
            http://jenkins-ci.org/commit/ssh-credentials-plugin/397bec75840835c953708f006d4ad74a7f9b5926
            Log:
            Making BaseSSHUser extend BaseStandardCredentials simplifies code and may be helpful for JENKINS-26099.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BaseSSHUser.java src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPassword.java src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java http://jenkins-ci.org/commit/ssh-credentials-plugin/397bec75840835c953708f006d4ad74a7f9b5926 Log: Making BaseSSHUser extend BaseStandardCredentials simplifies code and may be helpful for JENKINS-26099 .
            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/impl/BaseStandardCredentials.java
            src/main/java/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl.java
            src/main/java/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl.java
            src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/help-description.html
            src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/help-description_ja.html
            src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/help-id.html
            src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/id-and-description.jelly
            src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/id-and-description_de.properties
            src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/id-and-description_ja.properties
            src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/credentials.jelly
            src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/credentials_de.properties
            src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/credentials_ja.properties
            src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/help-description.html
            src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/help-description_ja.html
            src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/credentials.jelly
            src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/credentials_de.properties
            src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/credentials_ja.properties
            src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/help-description.html
            src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/help-description_ja.html
            http://jenkins-ci.org/commit/credentials-plugin/d993c3879e07809edb0af847076eedcd984d7d7c
            Log:
            JENKINS-26099 First draft of ability to pick an ID for credentials.

            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/impl/BaseStandardCredentials.java src/main/java/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl.java src/main/java/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl.java src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/help-description.html src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/help-description_ja.html src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/help-id.html src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/id-and-description.jelly src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/id-and-description_de.properties src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/id-and-description_ja.properties src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/credentials.jelly src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/credentials_de.properties src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/credentials_ja.properties src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/help-description.html src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/help-description_ja.html src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/credentials.jelly src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/credentials_de.properties src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/credentials_ja.properties src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/help-description.html src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/help-description_ja.html http://jenkins-ci.org/commit/credentials-plugin/d993c3879e07809edb0af847076eedcd984d7d7c Log: JENKINS-26099 First draft of ability to pick an ID for credentials.
            jglick Jesse Glick made changes -
            Remote Link This issue links to "PR 21 (Web Link)" [ 12015 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            pom.xml
            src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
            src/main/resources/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey/credentials.jelly
            src/main/resources/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey/credentials_de.properties
            src/main/resources/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey/credentials_ja.properties
            http://jenkins-ci.org/commit/ssh-credentials-plugin/ab9245809aa854544d144c90a4ca4835cdafb4f9
            Log:
            JENKINS-26099 Permit BasicSSHUserPrivateKey.id to be configured.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java src/main/resources/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey/credentials.jelly src/main/resources/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey/credentials_de.properties src/main/resources/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey/credentials_ja.properties http://jenkins-ci.org/commit/ssh-credentials-plugin/ab9245809aa854544d144c90a4ca4835cdafb4f9 Log: JENKINS-26099 Permit BasicSSHUserPrivateKey.id to be configured.
            jglick Jesse Glick made changes -
            Remote Link This issue links to "ssh-credentials-plugin PR 12 (Web Link)" [ 12016 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            pom.xml
            src/main/java/org/jenkinsci/plugins/plaincredentials/impl/FileCredentialsImpl.java
            src/main/java/org/jenkinsci/plugins/plaincredentials/impl/StringCredentialsImpl.java
            src/main/resources/org/jenkinsci/plugins/plaincredentials/impl/FileCredentialsImpl/credentials.jelly
            src/main/resources/org/jenkinsci/plugins/plaincredentials/impl/StringCredentialsImpl/credentials.jelly
            http://jenkins-ci.org/commit/plain-credentials-plugin/0ba4a8ae2df3e43bafcd8fd14519c974c18a1bdf
            Log:
            JENKINS-26099 Permit StringCredentialsImpl.id and FileCredentialsImpl.id to be configured.

            Compare: https://github.com/jenkinsci/plain-credentials-plugin/compare/846644ae21ff^...0ba4a8ae2df3

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/jenkinsci/plugins/plaincredentials/impl/FileCredentialsImpl.java src/main/java/org/jenkinsci/plugins/plaincredentials/impl/StringCredentialsImpl.java src/main/resources/org/jenkinsci/plugins/plaincredentials/impl/FileCredentialsImpl/credentials.jelly src/main/resources/org/jenkinsci/plugins/plaincredentials/impl/StringCredentialsImpl/credentials.jelly http://jenkins-ci.org/commit/plain-credentials-plugin/0ba4a8ae2df3e43bafcd8fd14519c974c18a1bdf Log: JENKINS-26099 Permit StringCredentialsImpl.id and FileCredentialsImpl.id to be configured. Compare: https://github.com/jenkinsci/plain-credentials-plugin/compare/846644ae21ff ^...0ba4a8ae2df3
            jglick Jesse Glick made changes -
            Remote Link This issue links to "plain-credentials-plugin PR 2 (Web Link)" [ 12017 ]
            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/CredentialsProvider.java
            src/main/java/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials.java
            src/main/java/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl.java
            src/main/java/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl.java
            src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/help-description.html
            src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/help-description_ja.html
            src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/help-id.html
            src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/id-and-description.jelly
            src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/id-and-description_de.properties
            src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/id-and-description_ja.properties
            src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/credentials.jelly
            src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/credentials_de.properties
            src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/credentials_ja.properties
            src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/help-description.html
            src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/help-description_ja.html
            src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/credentials.jelly
            src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/credentials_de.properties
            src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/credentials_ja.properties
            src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/help-description.html
            src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/help-description_ja.html
            src/test/java/com/cloudbees/plugins/credentials/MockFolderCredentialsProvider.java
            src/test/java/com/cloudbees/plugins/credentials/impl/BaseStandardCredentialsTest.java
            http://jenkins-ci.org/commit/credentials-plugin/f2639a47ab25274069c6d1fc7ee10e1817724f95
            Log:
            Merge pull request #21 from jenkinsci/config-id-JENKINS-26099

            [FIXED JENKINS-26099] Pick an ID for credentials

            Compare: https://github.com/jenkinsci/credentials-plugin/compare/fc7055dd1795...f2639a47ab25

            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/CredentialsProvider.java src/main/java/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials.java src/main/java/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl.java src/main/java/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl.java src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/help-description.html src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/help-description_ja.html src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/help-id.html src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/id-and-description.jelly src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/id-and-description_de.properties src/main/resources/com/cloudbees/plugins/credentials/impl/BaseStandardCredentials/id-and-description_ja.properties src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/credentials.jelly src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/credentials_de.properties src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/credentials_ja.properties src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/help-description.html src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/help-description_ja.html src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/credentials.jelly src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/credentials_de.properties src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/credentials_ja.properties src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/help-description.html src/main/resources/com/cloudbees/plugins/credentials/impl/UsernamePasswordCredentialsImpl/help-description_ja.html src/test/java/com/cloudbees/plugins/credentials/MockFolderCredentialsProvider.java src/test/java/com/cloudbees/plugins/credentials/impl/BaseStandardCredentialsTest.java http://jenkins-ci.org/commit/credentials-plugin/f2639a47ab25274069c6d1fc7ee10e1817724f95 Log: Merge pull request #21 from jenkinsci/config-id- JENKINS-26099 [FIXED JENKINS-26099] Pick an ID for credentials Compare: https://github.com/jenkinsci/credentials-plugin/compare/fc7055dd1795...f2639a47ab25
            Hide
            jglick Jesse Glick added a comment -

            Changes to credentials and plain-credentials released. Changes to ssh-credentials merged, ready for release.

            Show
            jglick Jesse Glick added a comment - Changes to credentials and plain-credentials released. Changes to ssh-credentials merged, ready for release.
            jglick Jesse Glick made changes -
            Status In Progress [ 3 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            Hide
            morgwai Morgwai Kotarbinski added a comment -

            This is a very handy improvement: thanks!
            However as of 1.602 I can see ID configurable only for 'Username with password' kind in advanced settings. For 'SSH Username with private key' it's not available (advanced settings contain only passphrase for the key). Am I missing something? Do I need to install some plugin maybe?

            Thanks!

            Show
            morgwai Morgwai Kotarbinski added a comment - This is a very handy improvement: thanks! However as of 1.602 I can see ID configurable only for 'Username with password' kind in advanced settings. For 'SSH Username with private key' it's not available (advanced settings contain only passphrase for the key). Am I missing something? Do I need to install some plugin maybe? Thanks!
            Hide
            morgwai Morgwai Kotarbinski added a comment -

            New version of SSH Credential Plugin needs to be released to pick-up Jesse Glick's changes. Reassigning to Stephen Connolly as he is the maintainer of the plugin according to https://wiki.jenkins-ci.org/display/JENKINS/SSH+Credentials+Plugin

            Show
            morgwai Morgwai Kotarbinski added a comment - New version of SSH Credential Plugin needs to be released to pick-up Jesse Glick's changes. Reassigning to Stephen Connolly as he is the maintainer of the plugin according to https://wiki.jenkins-ci.org/display/JENKINS/SSH+Credentials+Plugin
            morgwai Morgwai Kotarbinski made changes -
            Resolution Fixed [ 1 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            Assignee Jesse Glick [ jglick ] stephenconnolly [ stephenconnolly ]
            Hide
            jglick Jesse Glick added a comment -

            Morgwai Kotarbinski JIRA tracks work in progress. Once the fix is merged to master it is Fixed.

            Show
            jglick Jesse Glick added a comment - Morgwai Kotarbinski JIRA tracks work in progress. Once the fix is merged to master it is Fixed .
            jglick Jesse Glick made changes -
            Assignee stephenconnolly [ stephenconnolly ] Jesse Glick [ jglick ]
            jglick Jesse Glick made changes -
            Status Reopened [ 4 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            Hide
            morgwai Morgwai Kotarbinski added a comment -

            So where should I file an issue related to releasing a merged code in general? after all that's what end users see: it doesn't really matter how perfect is the code in master until it's released...

            Thanks!

            Show
            morgwai Morgwai Kotarbinski added a comment - So where should I file an issue related to releasing a merged code in general? after all that's what end users see: it doesn't really matter how perfect is the code in master until it's released... Thanks!
            pablaasmo Per Arnold Blaasmo made changes -
            Link This issue is related to JENKINS-27500 [ JENKINS-27500 ]
            Hide
            jglick Jesse Glick added a comment -

            There is no place to file such things, other than pestering the plugin maintainer, in this case Stephen Connolly.

            Show
            jglick Jesse Glick added a comment - There is no place to file such things, other than pestering the plugin maintainer, in this case Stephen Connolly .
            stephenconnolly Stephen Connolly made changes -
            Link This issue is duplicated by JENKINS-27500 [ JENKINS-27500 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 160089 ] JNJira + In-Review [ 196312 ]
            abayer Andrew Bayer made changes -
            Labels workflow pipeline workflow
            abayer Andrew Bayer made changes -
            Labels pipeline workflow pipeline
            anudeeplalam Anudeep Lalam made changes -
            Attachment CredentailID.png [ 35019 ]
            Hide
            anudeeplalam Anudeep Lalam added a comment -

            Jesse Glick - I am using Jenkins ver. 2.9. I want to customise my Jenkins Credential ID. When I try to configure, the edit option is not present for ID. Please see below.

            Where can I edit the ID ??

            Show
            anudeeplalam Anudeep Lalam added a comment - Jesse Glick - I am using Jenkins ver. 2.9. I want to customise my Jenkins Credential ID. When I try to configure, the edit option is not present for ID . Please see below. Where can I edit the ID ??
            Hide
            jglick Jesse Glick added a comment -

            Anudeep Lalam the ID can only be customized on new credentials. Once created it is immutable.

            Show
            jglick Jesse Glick added a comment - Anudeep Lalam the ID can only be customized on new credentials. Once created it is immutable.

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                jglick Jesse Glick
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: