Writing a Jenkins Pipeline: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 8: Line 8:
=Steps=
=Steps=


These steps are used invoking on <code>stage.</code>. In a Jenkinsfile, and inside a stage, invoke on <code>this.</code>
These steps are used invoking on <code>stage.</code>. In a Jenkinsfile, and inside a stage, invoke on <code>this.</code> or simply invoking directly like below:


* read-file step. Reading a file from the workspace: https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#readfile-read-file-from-workspace
* read-file step. Reading a file from the workspace: https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#readfile-read-file-from-workspace


<syntaxhighlight lang='groovy'>
<syntaxhighlight lang='groovy'>
def versionFile = stage.readFile("${stage.WORKSPACE}/terraform/my-module/VERSION")
def versionFile = readFile("${stage.WORKSPACE}/terraform/my-module/VERSION")
</syntaxhighlight>
</syntaxhighlight>


* error https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#error-error-signal
* error https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#error-error-signal

Revision as of 06:20, 21 November 2019

Internal

Steps

These steps are used invoking on stage.. In a Jenkinsfile, and inside a stage, invoke on this. or simply invoking directly like below:

def versionFile = readFile("${stage.WORKSPACE}/terraform/my-module/VERSION")