Class EphemeralCredentialsAccessorGlobalVariable

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

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

Registers ephemeralCredentials as a global variable (no @Library import needed), resolving to an EphemeralCredentialsAccessor bound to the current run - lets a pipeline write ephemeralCredentials['FOO'] = someCredentials / ephemeralCredentials['FOO'] / ephemeralCredentials.containsKey('FOO') / ephemeralCredentials.remove('FOO') directly.

Cached in the script's Binding after first resolution, the same way WithEphemeralCredentialsGlobalVariable caches its own instance - EphemeralCredentialsAccessor only holds a plain runId String, so re-resolving it repeatedly would be harmless, but there's no reason to redo the CpsRuns.current() lookup on every single ephemeralCredentials[...] access within one script run.

See Also:
  • Constructor Details

    • EphemeralCredentialsAccessorGlobalVariable

      public EphemeralCredentialsAccessorGlobalVariable()
  • 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