jx step credential

list of jx commands

jx step credential

Returns a secret entry for easy scripting in pipeline steps

Synopsis

Returns a credential from a Secret for easy scripting in pipeline steps.

Supports the https://jenkinsci.github.io/kubernetes-credentials-provider-plugin/examples/

If you specify –optional then if the key or secret doesn’t exist then the command will only print a warning and will not error.

jx step credential [flags]

Examples

  # get the password of a secret 'foo' which uses the Jenkins Credentials Provider labels
  export MY_PWD="$(jx step credential -s foo)"
  
  # get the password entry of a secret 'foo' as an environment variable
  export MY_PWD="$(jx step credential -s foo -k passwordj)"
  
  # create a local file from a file based secret using the Jenkins Credentials Provider labels
  export MY_KEY_FILE="$(jx step credential -s foo)"
  
  # create a local file called cheese from a given key
  export MY_KEY_FILE="$(jx step credential -s foo -f cheese -k data)"
  
  # create a local file called cheese from a given key, if the key exists'
  export MY_KEY_FILE="$(jx step credential -s foo -f cheese -k data --optional)"

Options

  -f, --file string        the key for the filename to use if this is a file based Secret
  -h, --help               help for credential
  -k, --key string         the key in the Secret to output
  -s, --name string        the name of the Secret
  -n, --namespace string   the namespace to look for a Secret
      --optional           if true, then the command will only warn (not error) if the secret or the key doesn't exist

Options inherited from parent commands

  -b, --batch-mode   Runs in batch mode without prompting for user input
      --verbose      Enables verbose output. The environment variable JX_LOG_LEVEL has precedence over this flag and allows setting the logging level to any value of: panic, fatal, error, warn, info, debug, trace

SEE ALSO

Auto generated by spf13/cobra on 2-Sep-2020