Jenkinsfile
It is possible to write Jenkinsfile's as Groovy scripts (advanced) or using Declarative Pipeline Syntax.
Top 10 Best Practices for Jenkins Pipeline https://www.blazemeter.com/blog/how-to-use-the-jenkins-scripted-pipeline https://jenkins.io/doc/book/pipeline/syntax/#scripted-pipeline
node { stage("a") { } stage("b") { } stage("c") { parallel ( 'taskA': { stage("1") { }}, 'taskB': { stage("2") { }}, ) } stage("archive") { archiveArtifacts artifacts: 'out_*/*.*' archiveArtifacts artifacts: 'contiki/tools/cc2538-bsl/cc2538-bsl.py' } }
NOTE:
Creating your first Pipeline https://jenkins.io/doc/pipeline/examples/ https://www.blazemeter.com/blog/how-to-use-the-jenkins-scripted-pipeline Distributed builds
archiveArtifacts:
Directory//*.* → All the files recursively under Directory
*
/*.*
→ all the files in the workspace/*.xml → all xml files in your workspace.
*
Directory//*.xml
→ All the xml files recursively under DirectoryarchiveArtifacts artifacts: 'file.extension''' archiveArtifacts artifacts: 'teste.js' archiveArtifacts artifacts: '*.js' archiveArtifacts artifacts: 'teste.js', onlyIfSuccessful: true
pipeline { agent any stages { stage('Download') { steps { sh 'make config' sh 'echo "artifact file" > generatedFile.txt' } } } post { always { archiveArtifacts artifacts: 'generatedFile.txt', onlyIfSuccessful: true } } }
You may also declare whether scripts need to explicitly request that library (detailed below), or if it is present by default. Furthermore, if you specify a version in Jenkins configuration, you can block scripts from selecting a different version.
https://jenkins.io/doc/book/pipeline/shared-libraries/
https://stackoverflow.com/questions/38695237/create-resusable-jenkins-pipeline-script Share a standard Pipeline across multiple projects with Shared Libraries Exploring Jenkins Pipelines: Shared Libraries Extending with Shared Libraries https://cleverbuilder.com/articles/jenkins-shared-library/
/workspace/project@script is checked out on Master only to get Jenkinsfile - it can be safely deleted /workspace/project@2 - folder where build is performed (can be on slave) /workspace/project@tmp - ?