Hi -

I am writing a Jenkinsfile script to automate the creation of pipelines 
using the multibranch plugin. The Jenkinsfile appears at the root of a 
github repo. Branch Indexing is working fine and the first stages (Maven 
commands) go trough without a hitch.

But then I am trying to deploy using ansible, for which I need ssh. I have 
defined a global-scoped "secret-file" credentials, which regular jobs can 
see and use. But my script-generated jobs do not get access to the 
credentials.

In the following sample code, the echo command never runs : 

node() {
    withCredentials([[$class: 'FileBinding', credentialsId: 'secret-file', 
variable: 'SECRET_FILE']]) {
        echo "${SECRET_FILE}"
    }
}

Moreover, using the "withCredentials" Pipeline Syntax Snippet Generator at 
the branch job level, the combobox does not list any available credentials. 
But doing the same thing a level above (in the multibranch job), the 
combobox shows all global-scoped credentials, including the "secret-file" 
which I am looking to use in my script.

I don't know if this is an intentional limitation, either by design or for 
security, that can be configured or worked around or if it is a plain bug 
that I should file an issue for. I tried both freshly installed Windows 
Jenkins 2.15 and an older 1.651.3 Linux Jenkins with updated plugins and 
got the same behvaior.

If anybody has a clue, this would make my week!

Francis


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f7234a21-3017-408c-a4a8-8ef1d731205f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to