Ooooh... I wonder if this is an unintended side-effect of Jesse's hack
<https://github.com/jenkinsci/workflow-multibranch-plugin/blob/04d93559028b97172ece072ca315b6fb13324380/src/main/java/org/jenkinsci/plugins/workflow/multibranch/BranchJobProperty.java#L68>.
You might be able to work around it if you enable the hidden by default
credentials permissions
<https://github.com/jenkinsci/credentials-plugin/blob/master/src/main/java/com/cloudbees/plugins/credentials/CredentialsProvider.java#L126-L152>
as
likely the findCredentialsById
<https://github.com/jenkinsci/credentials-plugin/blob/master/src/main/java/com/cloudbees/plugins/credentials/CredentialsProvider.java#L834-L907>
method is just not seeing the permissions it requires

On 28 July 2016 at 04:06, Francis Lalonde <[email protected]> wrote:

> It just doesn't run.
>
> I've seen this behavior with the maven settings file, if you specify
> something that could not be found, the code within the block is just
> skipped.
>
> I've made sure to use the ugly ID in my script, but I didn't put it in my
> example for clarity.
>
> That no credentials appear in the generator combobox looks like it's more
> than just a bad ID. I'm not entirely clear how credentials propagate to
> child jobs / folders, maybe I need to do something at the multibranch
> pipeline level to propagate credentials to generated child jobs?
>
> On Wednesday, July 27, 2016 at 7:08:51 PM UTC-4, Michael Neale wrote:
>>
>> Should the credentialsId be the horrible ugly ID in advanced in
>> credentials?
>>
>> is there no error, but it just doesn't run?
>>
>> On Thursday, July 28, 2016 at 7:34:51 AM UTC+10, Francis Lalonde wrote:
>>>
>>> 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/66c1edb5-6358-43d6-b36a-05f62aab77d2%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/66c1edb5-6358-43d6-b36a-05f62aab77d2%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2BnPnMzQ45VNgG-fhtsjV8cvnq0eS3MRiY7M248Fmz5v-wKwQg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to