Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
33 additions
and 36 deletions.
- +2 −2 README.md
- +1 −1 jenkinsfile-examples/README.md
- +3 −0 pipeline-examples/README.md
- +2 −2 {workflow-examples → pipeline-examples}/get-build-cause/README.md
- +1 −1 {workflow-examples → pipeline-examples}/get-build-cause/getBuildCause.groovy
- +7 −0 pipeline-examples/gitcommit/README.md
- +4 −4 {workflow-examples → pipeline-examples}/gitcommit/gitcommit.groovy
- 0 {workflow-examples → pipeline-examples}/jobs-in-parallel/README.md
- +5 −6 {workflow-examples → pipeline-examples}/jobs-in-parallel/jobs_in_parallel.groovy
- +1 −2 {workflow-examples → pipeline-examples}/parallel-from-list/README.md
- 0 {workflow-examples → pipeline-examples}/parallel-from-list/parallelFromList.groovy
- +2 −2 {workflow-examples → pipeline-examples}/push-git-repo/README.md
- +3 −3 {workflow-examples → pipeline-examples}/push-git-repo/pushGitRepo.Groovy
- 0 {workflow-examples → pipeline-examples}/slacknotify/README.md
- 0 {workflow-examples → pipeline-examples}/slacknotify/slackNotify.groovy
- 0 {workflow-examples → pipeline-examples}/timestamper-wrapper/README.md
- 0 {workflow-examples → pipeline-examples}/timestamper-wrapper/timestamperWrapper.groovy
- 0 {workflow-examples → pipeline-examples}/unstash-different-dir/README.md
- +2 −2 {workflow-examples → pipeline-examples}/unstash-different-dir/unstashDifferentDir.groovy
- +0 −3 workflow-examples/README.md
- +0 −8 workflow-examples/gitcommit/README.md
@@ -1,3 +1,3 @@ | ||
# Jenkinsfile examples | ||
|
||
This directory contains example Jenkinsfiles, which are used with the Multibranch Workflow functionality, or the Workflow script from SCM functionality. | ||
This directory contains example Jenkinsfiles, which are used with the Pipeline Multibranch functionality, or the Pipeline script from SCM functionality. |
@@ -0,0 +1,3 @@ | ||
# Pipeline examples | ||
|
||
This directory contains various Pipeline examples, showing how to use specific plugins, how the Pipeline DSL works, and more. |
@@ -1,6 +1,6 @@ | ||
# Synopsis | ||
Shows how to get the Cause(s) of a Workflow build from within the | ||
Workflow script. | ||
Shows how to get the Cause(s) of a Pipeline build from within the | ||
Pipeline script. | ||
|
||
# Credit | ||
Based on Stackoverflow answer at http://stackoverflow.com/questions/33587927/how-to-get-cause-in-workflow |
@@ -0,0 +1,7 @@ | ||
# Synopsis | ||
Demonstrate how to expose the git_commit to a Pipeline job. | ||
|
||
# Background | ||
|
||
The git plugin exposes some environment variables to a freestyle job that are not currently exposed to a Pipeline job. | ||
Here's how to recover that ability using a git command and Pipeline's readFile() function. |
@@ -1,15 +1,15 @@ | ||
// These should all be performed at the point where you've | ||
// These should all be performed at the point where you've | ||
// checked out your sources on the slave. A 'git' executable | ||
// must be available. | ||
// Most typical, if you're not cloning into a sub directory | ||
sh('git rev-parse HEAD > GIT_COMMIT') | ||
git_commit=readFile('GIT_COMMIT') | ||
// short SHA, possibly better for chat notifications, etc. | ||
// short SHA, possibly better for chat notifications, etc. | ||
short_commit=git_commit.take(6) | ||
|
||
//create a GIT_COMMIT file in workspace and read back into a string in workflow | ||
//create a GIT_COMMIT file in workspace and read back into a string in Pipeline | ||
// If you have your sources checked out in a 'src' subdir | ||
sh('cd src && git rev-parse HEAD > GIT_COMMIT') | ||
git_commit=readFile('src/GIT_COMMIT') | ||
// short SHA, possibly better for chat notifications, etc. | ||
// short SHA, possibly better for chat notifications, etc. | ||
short_commit=git_commit.take(6) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.