Skip to content
Browse files
Merge pull request #1472 from abayer/jenkins-49893
[JENKINS-49893] Declarative Directive Generator docs
  • Loading branch information
bitwiseman committed Apr 6, 2018
2 parents 9dd0735 + c10eb8f commit dce2fca0447e29128290a3926118ce9e78a14a82
Showing with 44 additions and 0 deletions.
  1. +41 −0 content/doc/book/pipeline/getting-started.adoc
  2. +3 −0 content/doc/book/pipeline/syntax.adoc
@@ -325,6 +325,47 @@ link:http://localhost:8080/pipeline-syntax/globals#currentBuild[Global Variable
for a complete, and up to date, list of properties available on `currentBuild`.

=== Declarative Directive Generator

While the Snippet Generator helps with generating steps for a Scripted
Pipeline or for the `steps` block in a `stage` in a Declarative Pipeline, it
does not cover the link:../syntax#declarative-sections[sections] and
link:../syntax#declarative-directives[directives] used to define a Declarative Pipeline.
The "Declarative Directive Generator" utility helps with that.
Similar to the <<snippet-generator>>, the Directive Generator allows you
to choose a Declarative directive, configure it in a form, and generate the
configuration for that directive, which you can then use in your Declarative Pipeline.

To generate a Declarative directive using the Declarative Directive Generator:

. Navigate to the *Pipeline Syntax* link (referenced above) from a configured Pipeline,
and then click on the *Declarative Directive Generator* link in the sidepanel,
or go directly to link:http://localhost:8080/directive-generator[localhost:8080/directive-generator].
. Select the desired directive in the dropdown menu
. Use the dynamically populated area below the dropdown to configure the selected directive.
. Click *Generate Directive* to create the directive's configuration to copy
into your Pipeline.

The Directive Generator can generate configuration for nested directives,
such as conditions inside a `when` directive, but it cannot generate Pipeline steps.
For the contents of directives which contain steps,
such as `steps` insde a `stage` or conditions like `always` or `failure` inside `post`,
the Directive Generator adds a placeholder comment instead.
You will still need to add steps to your Pipeline by hand.

// Declarative //
stage('Stage 1') {
steps {
// One or more steps need to be included within the steps block.
// Script //

== Further Reading

This section merely scratches the surface of what can be done with Jenkins
@@ -66,6 +66,9 @@ with the following exceptions:
* A property reference statement is treated as no-argument method invocation. So for
example, input is treated as input()

You can use the link://../getting-started#directive-generator[Declarative Directive Generator]
to help you get started with configuring the directives and sections in your
Declarative Pipeline.

=== Sections

0 comments on commit dce2fca

Please sign in to comment.