In practice, this build step MUST be executed in the same node where the checkout was performed. Anyway, technically I should not assume it will always happen. Better be on the safe side anyway and implement the credentials there. Thanks Stephen!
On Tuesday, August 9, 2016 at 8:02:45 PM UTC+2, Stephen Connolly wrote: > > > > On Tuesday 9 August 2016, Rafael Rezende <[email protected] > <javascript:>> wrote: > >> - is there any use case where a user may actually want to use different >>> credentials in the build step than in the checkout? >>> >> *No.* They should be always the same. >> >> - are you writing a pipeline capable build step or one specifically >>> tailored for use in old-style jobs only? >>> >> *Yes.* Should be pipeline capable. >> >> > So this one here is the killer on zero config as the node step within > which you run your build step may not be the same node step instance where > the checkout took place. > > Thus you have no way to capture the config of the (potentially many) node > step that did the checkout you want to use the credentials of. > > Now you could have two build step implementations, one for pipeline that > takes config, the other for old style jobs that goes hunting for the scm > > >> - are there use cases where a user may want to use eg the multi-scm and >>> check out more than one perhaps even with divergent credentials? >>> >> *No.* There is a single SCM source. I don't even think Team Concert SCM >> can cope with multi-SCM. >> >> > Yeah well then at some point somebody will fix that bug (if it doesn't > work with it) and then you'd be scuppered... > > >> >> >> Thanks Stephen for the quick answer! I'll implement the credentials field >> in the Build Step. >> >> >> On Tuesday, August 9, 2016 at 9:44:15 AM UTC+2, Stephen Connolly wrote: >>> >>> >>> >>> On Monday 8 August 2016, Rafael Rezende <[email protected]> wrote: >>> >>>> I'm developing a plugin that depends on the Team Concert plugin >>>> <https://wiki.jenkins-ci.org/display/JENKINS/Team+Concert+Plugin>. *TC >>>> plugin* has a Credentials field, used to connect to the Team Concert >>>> server. >>>> My plugin -- as a Build Step -- should reconnect to the server using >>>> the same credentials, but I would like to avoid the user having to select >>>> his credentials twice: first in the SCM configuration, then in the Build >>>> Step. >>>> >>>> >>>> The Team Concert plugin does not provide any environment variable to >>>> help me with that. No user ID, no credentials hash... >>>> >>>> Is there any way to reuse the SCM credentials? Or is that simply >>>> forbidden because of security concerns? >>>> >>> >>> So questions: >>> >>> - is there any use case where a user may actually want to use different >>> credentials in the build step than in the checkout? >>> >>> - are you writing a pipeline capable build step or one specifically >>> tailored for use in old-style jobs only? >>> >>> - are there use cases where a user may want to use eg the multi-scm and >>> check out more than one perhaps even with divergent credentials? >>> >>> If the answers are all yes, then you probably need to just accept that >>> it is a config option. >>> >>> If the answers are all no, then you can use run.getParent().getScm() and >>> borrow the credentials directly... But in doing this you prevent all three >>> use cases I hinted at with my questions >>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Jenkins Developers" 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-dev/02375c1a-91a1-46b9-92fc-9198861946a1%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/jenkinsci-dev/02375c1a-91a1-46b9-92fc-9198861946a1%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> -- >>> Sent from my phone >>> >> > > > >> -- >> You received this message because you are subscribed to the Google Groups >> "Jenkins Developers" 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-dev/feb7d9be-e96c-4f60-98a7-6242d425bdb8%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jenkinsci-dev/feb7d9be-e96c-4f60-98a7-6242d425bdb8%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > Sent from my phone > -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" 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-dev/348ea221-2c40-4913-82d2-c576903890b5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
