-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
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')]) { }
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.