Let’s take a moment to think about the picture above. The guy with the ball may have spent a little more time to get started. He may have received some bad feedback about his late start and the first results of others. A bit further along the line, though, he caught up with and overtook the others, and the gap between them has been growing since then.
With this in mind, using a tool to automate and integrate all your pipeline from “push” to “deploy” will speed up your work and provide your team the ability to fail fast and fix faster. Even if this takes a little more time from you to set up, it will buy you some distance in the future.
You have probably already heard of Jenkins, an awesome tool with a lot of plugins that we have already introduced in this post.
Well, now we are going to connect it with Github, Openshift and Slack. And not just the work but also your team will be integrated.
First of all, it is pretty simple to have your own Jenkins on our platform: once you select it on applications in few seconds it is ready to use.
Here is an example. Let’s consider a PHP sample application, in 3 environments: Development, QA and Production. Our Dev environment will be the only one to build, after that, Jenkins will run tests and tag its image to use in QA, and will wait for a manual approval to promote the changes to Production.
So as not to mess things up, I wrote another post entitled Create and Tag images, but if you are comfortable with this tasks, keep walking.
Grant Jenkins access to administer applications on openshift: oc policy
add-role-to-user admin system:serviceaccount:jenkins:default
After that, Jenkins needs to be set up to connect and integrate with your
account and application, so let’s do it:
Configure jenkins openshift plugin: With our image we already export your
credentials and configs to jenkins, so just go to plugins area and install the
github and slack plugins and update all others.
Configure jenkins github plugin: In the “Manage Jenkins” area you can set it up like this example. Pro-Tip: you need to generate the token first.
Configure jenkins slack plugin: Generate your chanel token ->
https://api.slack.com/tokens and fill the form.
Create new jenkins project with pipeline option:
This Jenkinsfile is almost self explanatory. Its integration with openshift
occurs like magic, the DeployConfig and Project names just need to be set up and voilà! Everything is connected, and you’ll be free to manage your project from here. Everything in your hands with versioning and control.
In the "Approval" stage, use the "submitter" parameter on to set the user that is allowed to interact with it.
On TAG, QA is a DEV TAG, and PROD is a QA TAG not DEV.
Use Environment Variables on your project, so your app will have different behaviors in different environments, yet with the same app.
**Build manually: **let’s see the magic!
Configure Github Webhook: As you have already set up the github plugin, you do not need to click every time on the build button. A github webhook can be set up, just go to you project settings (https://github.com/USER/PROJECT/settings/hooks) and add a new webhook
like this (http://jenkinsURL/github-webhook/).
All you need now is code, commit and push to start your pipeline, and from now till forever you just code, you just think about your product and your customers. And happy customers means more money to your business which, in turn, make you even happier.
Jenkins has a lot of others plugins, more than you imagine, and you are free to adjust it to your needs.
Bonus: I have been using an new Jenkins UI called “Blue-Ocean”. It is material design and brings a beautiful interface to Jenkins… see it for yourself:
You have come this far, thank you!
*Before you go…. think again! *For new achievements, new approaches are needed !