This section is not about what Jenkins is. We are going to dig in deeper and configure the build and release of an application!
As mentioned in the Jenkins introduction, when working with Jenkins, it is all about the plugins.
Jenkins plugins are separated in to sections by the type of action they perform. This information is pretty reliable, but it is also self selected by plugin authors and not a curated list. Such is the life of open source projects, but going to the official Jenkins Plugins page and searching for any plugins related to tools you use is still a great starting point.
There is no magic. There is just experience from playing with the tool. Configuring Jenkins plugins can be a lot of trial and error. But that is okay! You are not going to hurt anything when making a mistake in your testing environments. Unfortauntely not all of the plugins have the best documentation. But you will eventually get to your desired end state/configuration. Which means - just like your code, you want to take advantage of development environments. You do not want to configure jobs the first time when editing production Jenkins environments. Figure out the configuration for development processes and then move it out to production.
Remember - Jenkins will only do what you tell it to do.
The standard starting point is to have Jenkins build, or compile, something. So we've got a sample web application we are going to start with. After it has been built, we will want to store the build artifact and notify users the build ran.
Not a lot to talk about here - but lots to do. So let's dive in!
- Get in the
deploymentsdirectory of the Automation Tools git repo and
vagrant upour trusty VM.
- Start up a Jenkins server using Docker container.
docker run -p 8080:8080 -p 50000:50000 -v /home/vagrant/jenkins_home:/var/jenkins_home jenkins:1.625.2
- Install the following list of plugins on your new Jenkins server.
- SCM Sync Configuration Plugin
- NodeJS Plugin
- GitHub Plugin
- Copy Artifact Plugin
- Slack Plugin
- Gatling Plugin
- Configure SCM Sync to use a new public repo on GitHub. (For today this is good, in general don't use this with a public repo)
- Configure the NodeJS plugin to install the latest version (or 5.x version) of NodeJS for our test project to use.
- Make your own room in Automation Tools Slack
- Configure the Slack plugin with your own Slack room's API key.
create-build-artifactthat checks out our example application you forked and have write access to.
npm install; npm testin an Execute Shell.
*/2 * * * *, or "when a change is pushed to GitHub".
create-build-artifactto your new job's workspace in a folder you will call
docker build -t localhost:5002/atbcommand generate a container of the example Node.js app.
docker push localhost:5002/atb:0.0.1command.
docker-dev-local2repo and see your uploaded container!
git commitmessage and see what integrations happen then.
0.0.2in your GitHub repository.
git pushthem and watch the entire pipeline run again.