Jenkins has a pretty nice Pipeline plugin to manage build, test and
deploy steps in a single file named Jenkinsfile
. This file should be stored
alongside with the project code just like python
, javascript
, html
or
whatever files.
The only problem with Jenkinsfile
is that it must be written in Groovy.
To me this is the same problem as with Vagrantfile
which must be written in
Ruby.
There is something strange forcing users to study language in order to have
proper configuration file.
It took some time to prepare workable Jenkinsfile
which works for
Multibranch Workflows so I decided to create a gist with it.
Here it is:
It works pretty good for me providing slack notifications to production or staging channels and having links to Bitbucket diff page to see changes commited between builds.
This Jenkinsfile
is suitable for python
or nodejs
projects and requires
just minimal tuning - to provide proper repository name and url and build,
test and deploy commands for the project.
Deployment happens only for develop
(staging server) and master
(production
server) branches.
Hope somebody will find this gist usefull.