Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-52850] Improve credentials helper section and add SSH support #2171

Merged
merged 2 commits into from May 4, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 17 additions & 7 deletions content/doc/book/pipeline/syntax.adoc
Expand Up @@ -465,13 +465,7 @@ depending on where the `environment` directive is located within the Pipeline.

This directive supports a special helper method `credentials()` which can be
used to access pre-defined Credentials by their identifier in the Jenkins
environment. For Credentials which are of type "Secret Text", the
`credentials()` method will ensure that the environment variable specified
contains the Secret Text contents. For Credentials which are of type "Standard
username and password", the environment variable specified will be set to
`username:password` and two additional environment variables will be
automatically be defined: `MYVARNAME_USR` and `MYVARNAME_PSW` respectively.

environment.

[cols="^10h,>90a",role=syntax]
|===
Expand All @@ -485,6 +479,22 @@ automatically be defined: `MYVARNAME_USR` and `MYVARNAME_PSW` respectively.
| Inside the `pipeline` block, or within `stage` directives.
|===

===== Supported Credentials Type

Secret Text::
the environment variable specified will be set to the Secret Text content
Secret File::
the environment variable specified will be set to the location of the File
file that is temporarily created
Username and password::
the environment variable specified will be set to `username:password` and two
additional environment variables will be automatically defined: `MYVARNAME_USR`
MarkEWaite marked this conversation as resolved.
Show resolved Hide resolved
and `MYVARNAME_PSW` respectively.
SSH with Private Key::
the environment variable specified will be set to the location of the SSH key
file that is temporarily created and two additional environment variables may
MarkEWaite marked this conversation as resolved.
Show resolved Hide resolved
be automatically defined: `MYVARNAME_USR` and `MYVARNAME_PSW` respectively.

[[environment-example]]
===== Example

Expand Down