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

credentials('some-id') should support Secret Zip type of credentials

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Instead of uploading a secret file, one can upload a zip file which is treated differently on usage.

      In essence, creation of the credential is just "Secret File" but when using the credential in withCredentials one either uses "Secret File" or "Secret ZIP File" in the snippet generator.

      A Declarative Pipeline does not expand the ZIP file correctly when it access the credential via:

      pipeline {
        environment {
          THING = credentials('my-zip-file-id')
        }
      }
      

      As best as I can tell, the file is being referenced, but it's not being unzipped into a temporary directory the way the following snippet might:

              withCredentials([zip(credentialsId: 'docker-config',
                                        variable: 'DOCKER_CONFIG')]) {
               }
      

        Attachments

          Activity

          Hide
          abayer Andrew Bayer added a comment -

          Well, this is actually hard to do. ZipFileBinding and FileBinding actually both use FileCredentials as their type - there is, so far as I can tell, no separate credentials type for zip files. And the way CredentialsBindingHandler works in Declarative is that it keys off of the credential type. So...looks like the answer is gonna be no, this can't be done with the current architecture.

          Show
          abayer Andrew Bayer added a comment - Well, this is actually hard to do. ZipFileBinding and FileBinding actually both use FileCredentials as their type - there is, so far as I can tell, no separate credentials type for zip files. And the way CredentialsBindingHandler works in Declarative is that it keys off of the credential type. So...looks like the answer is gonna be no, this can't be done with the current architecture.

            People

            • Assignee:
              abayer Andrew Bayer
              Reporter:
              rtyler R. Tyler Croy
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: