Work Smarter, Not Harder
Tags: kubernetes, jenkins, devops, cicd
Published: 2019-01-07 16:12:26

---
title: Work Smarter, Not Harder
published: true
description: Smart CI/CD Pipeline that boosts your team’s productivity, speed and joy.
tags: kubernetes, jenkins, devops, cicd
---

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](https://blog.getupcloud.com/from-dev-to-prod-image-promotion-made-easy-8fb1b0f9a705).
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](https://blog.getupcloud.com/creating-app-from-image-with-tag-8fb1b0f9a705)**, 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](http://jenkins-meu-teste.getup.io/manage)” area you can set it up like this example. *Pro-Tip: you need to generate the token first*.

![](https://cdn-images-1.medium.com/max/1600/1*ZcPqyT_E1y0vFPY0pgN2JQ.png)

**Configure jenkins slack plugin:** Generate your chanel token ->
[https://api.slack.com/tokens](https://api.slack.com/tokens) and fill the form.

![](https://cdn-images-1.medium.com/max/1600/1*r-ldtrko3UojX2R1RTztag.png)

**Create new jenkins project with pipeline option:**

![](https://cdn-images-1.medium.com/max/1600/1*GJfetW_8VvICftLqOXcEWg.png)

**Jenkinsfile Sample:**

> 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!

![](https://cdn-images-1.medium.com/max/1600/1*9CJe2WajVJlfrCOAiIbmsQ.png)
<span class="figcaption_hack">Inside your job, click to run your build!</span>

**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:

![](https://cdn-images-1.medium.com/max/1600/1*hhTchMN9e11n616Sqn2Wtg.png)
<span class="figcaption_hack">The Old or current interface :(</span>

![](https://cdn-images-1.medium.com/max/1600/1*joF9j8heOPqASYy4EtXmdA.png)
<span class="figcaption_hack">The new UI project</span>

![](https://cdn-images-1.medium.com/max/1600/1*esICrLsnjzM9SEIegFdJZA.png)
<span class="figcaption_hack">The pipeline view :D</span>

> You have come this far, thank you!

Learn more:

— [Pipeline with openshift](https://blog.openshift.com/pipelines-with-jenkins-2-on-openshift/)

— [Openshift Jenkins Plugin](https://github.com/openshift/jenkins-plugin)

— [Jenkins CI](https://wiki.jenkins-ci.org/display/JENKINS/Home)

*****

> *Before you go…. think again! *For new achievements, new approaches are needed !

![](https://cdn-images-1.medium.com/max/2000/1*uIwDesGWBik5LfHcfURFmw.jpeg)

*****

* [Jenkins](https://blog.getupcloud.com/tagged/jenkins?source=post)
* [Continuous
Integration](https://blog.getupcloud.com/tagged/continuous-integration?source=post)
* [Openshift](https://blog.getupcloud.com/tagged/openshift?source=post)
* [Kubernetes](https://blog.getupcloud.com/tagged/kubernetes?source=post)
* [Pipeline](https://blog.getupcloud.com/tagged/pipeline?source=post)