Class EphemeralCredentialsPutGlobalVariable

java.lang.Object
org.jenkinsci.plugins.workflow.cps.GlobalVariable
io.jenkins.plugins.ephemeral_credentials.EphemeralCredentialsPutGlobalVariable
All Implemented Interfaces:
ExtensionPoint

@Extension public class EphemeralCredentialsPutGlobalVariable extends org.jenkinsci.plugins.workflow.cps.GlobalVariable

Registers ephemeralCredentialsPut(...) as a global step (no @Library import needed), caching a credential into EphemeralCredentialsProvider for the current run directly - the pipeline-facing equivalent of EphemeralCredentialsAccessor.put(java.lang.String, com.cloudbees.plugins.credentials.Credentials). Two call shapes, both keyword-argument only (deliberately - see below):

  • ephemeralCredentialsPut(id: 'FOO', credentials: someCredentials) - caches an already-built Credentials object directly.
  • ephemeralCredentialsPut(spec: ephemeralUsernamePassword(id: 'FOO', description: '...'), values: [username: 'u', password: 'p']) - materializes spec from values first, the same shape input's answer would have been, letting a pipeline pre-populate a credential from data it already has (fetched mid-pipeline, computed, ...) without ever pausing on input.

Both shapes are handled by one single-Map-argument doCall rather than two overloaded doCall methods distinguished by parameter count/type - Closure subclasses do not reliably support Java-style overload resolution for doCall the way a plain Java class would, so two separate overloads risk one shape being silently mis-dispatched (no exception, but nothing findable afterwards). One doCall(Map), branching on which keys are present, is the same shape every other GlobalVariable factory in this plugin already uses.

See Also:
  • Constructor Details

    • EphemeralCredentialsPutGlobalVariable

      public EphemeralCredentialsPutGlobalVariable()
  • Method Details

    • getName

      @NonNull public String getName()
      Specified by:
      getName in class org.jenkinsci.plugins.workflow.cps.GlobalVariable
    • getValue

      @NonNull public Object getValue(@NonNull org.jenkinsci.plugins.workflow.cps.CpsScript script)
      Specified by:
      getValue in class org.jenkinsci.plugins.workflow.cps.GlobalVariable