According to documentation, it should be possible to include *.txt
file with help/documentation:
(root) +- src # Groovy source files | +- org | +- foo | +- Bar.groovy # for org.foo.Bar class +- vars | +- foo.groovy # for global 'foo' variable/function | +- foo.txt # help for 'foo' variable/function +- resources # resource files (external libraries only) | +- org | +- foo | +- bar.json # static helper data for org.foo.Bar
...
The vars directory hosts scripts that define global variables accessible from Pipeline scripts. The basename of each *.groovy file should be a Groovy (~ Java) identifier, conventionally camelCased. The matching *.txt, if present, can contain documentation, processed through the system’s configured markup formatter (so may really be HTML, Markdown, etc., though the txt extension is required).
Unfortunately it hasn't worked for me by simply creating *.txt
with some arbitrary content.
Am I missing something? Or does Global Shared Library doesn't shown documentation in usual Jenkins places:
What is a Shared Library in Jenkins? A shared library is a collection of independent Groovy scripts which you pull into your Jenkinsfile at runtime. The best part is, the Library can be stored, like everything else, in a Git repository. This means you can version, tag, and do all the cool stuff you're used to with Git.
To access the Jenkins environment variables in a pipeline, you can use the env object, eg. env.BUILD_NUMBER will give the current build number of a pipeline. The reference to Jenkins pipeline environment variables is made by surrounding it by ${} in the following way: ${env.BUILD_NUMBER}
In order to use shared libraries inside of a pipeline in Jenkins we need to configure the library. Open up the Jenkins instance and navigate to Manage Jenkins -> Configure System. Scroll down until you locate the Global Pipeline Libraries section. Enter the relevant information as it pertains to your Git repository and checkout details:
Open up the Jenkins instance and navigate to Manage Jenkins -> Configure System. Scroll down until you locate the Global Pipeline Libraries section. Enter the relevant information as it pertains to your Git repository and checkout details: Configuring a Global Shared Library in Jenkins.
Seems like there is a way to configure "global pipeline scripts" for a jenkins instance. The documentation says the configuration is "Manage Jenkins » Configure System » Global Pipeline Libraries". However, the Jenkins 2.7.2 instance doesn't have "Global Pipeline Libraries" configuration.
Add Github Shared Library Repo to Jenkins. Now that we have a basic git checkout library ready lets add it to Jenkins configurations. Step 1: Go to Manage Jenkins –> Configure System. Step 2: Find the Global Pipeline Libraries section and add your repo details and configurations as shown below.
Please note that the PipelineSyntax/Global Variables Reference page is ONLY updated when the pipeline's run is successful. And therefore ONLY for this pipeline (and not any others).
Here's a link!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With