Execute groovy pipeline code on remote jenkins server and monitor the output with client console(I prefer Atom editor).
Install Example:
- download tar package file from release
- tar xf jenkins-pipeline-go-linux-bin.tgz
- mv jenkins-pipeline-go-linux-bin/jenkins-pipeline-go /usr/local/bin
- jenkins-pipeline-go -h
Create pipeline job in jenkins
Command
jenkins-pipeline-go -file <path to groovy file> -url <http://jenkins.host:port> -job <path-to-pipeline-job> -username <jenkins-username> -api-token <api-token of the username> -trigger-token <any string,keep default value is fine>
Example command line
jenkins-pipeline-go -file ~/pipeline_demo.groovy -job /job/test-pipeline -template ~/config.xml.template -url http://localhost:8080 -username admin -api-token 11111460a1115de06456a83ed16822c8eb
To configure this command in Atom Editor, make sure you have build package installed in your atom editor and add .atom-build.yml
file in project folder with below yml code. For more information on how to build, please check this link
Save this as .atom-build.yml
, and build(ctrl+Alt+b) your groovy file.
cmd: "jenkins-pipeline-go"
args:
- "-file {FILE_ACTIVE}"
- "-url http://localhost:8080"
- "-job /job/test-pipeline"
- "-username admin"
- "-api-token 11111460a1115de06456a83ed16822c8eb"
- "-template ~/config.xml.template"
sh: true
Before compile,please make sure Go environment installed
go mod download
for linux platform:
make build4linux
for windows platform:
make build4windows
Groovy pipeline code should be saved as with .groovy
extension
https://github.com/jainath/jenkins-pipeline