OpenShift CI/CD Demo: Part I

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
you in this demo series we're going to go through how to set up a continuous integration and continuous delivery environment on OpenShift using rhythm or components that we usually use in Java development for example using maven using Jenkins as the CI CD engine Nexus repository for artifacts summer cube for static analysis and so on and in the first part we're going to look at how to set up this environment on top of open chip and to go through powered environment going to look like after we set this up is that we have a couple of components involved first we have the git repository where we're going to keep our source code we can use github for this purpose and we also have a version of battle uses got the git repo that is retaining go we're going to use that on off the ship to see how you can run the entire thing end to end on OpenShift you're gonna have jenkins of course that is driving the whole thing and they'll have sonar cue as the static and all this thing is backed by a Postgres database and they're going to be next to suppository also doesn't build our artifacts we push them into it so how does the pipeline gonna look like let me set this up you're gonna be Jenkins at taking out the source to flow in the source code from the git repo regardless of scoggs or github then we do a parallel task we at the same time you're on the unit test but since we want to save time we run the code coverage and static analysis at the taint at the same time through sonar cube and publish the result inside central cube so when the stennis tests are finished we can go look at at the same time how much powers you have had with the test have reviled any of our code quality rules and so on and if the test fails or if the code cover if because of the code coverage and so other criteria we fail the static analysis then the pythons not gonna execute any further if both of them were successful then Jenkins going to archive the artifacts in Nexus going to push them in Nexus the jar for the waterfalls in this case and we do version that they have and from that point if that step is also success fold them trigger an image build in open ship so we have the artifacts for our application and Jenkins going to trigger a build on open shifts opens you build the darker image off that waterfall that we have built in the process and we have pushed into Nexus then the image is ready we're going to create the application as a docker container on OpenShift deployed application on that run a couple of integration tests and if that is successful we're going to promote the image tag the docker image with with the version that we want in our staging environment and we recreate that container in the staging environment to for example notify the testers to go test it in the staging environments so let's go through the steps see how we can set this thing up from scratch we have the entire instructions for running this demo and set in this environment up on github on OpenShift demos slash OpenShift CD demo and you'll see exactly how does that look like and the series of steps that you need to go through to set this August pretty much a few it's not that long if you look at my operational environment and having this local environment there's no project setup on it yet so we're going to start by creating some projects for wrap and spinning off our Nexus janking and other components that we need see new project called CI CD also give it a nice name so it shows nice thick lip console alright get a project you can also create two new projects for men be deployed applications for the development environment a staged environment so I'll go through the dev project I call it a task task is the name of the application you're going to use in this pipeline it's a to-do list a simple application running on the JBoss EAP ok also staged for a stage environment if you're happy with our changes and develop an environment we're going to deploy it in this stage of our alright good project I have three projects created ready for me another thing I need to do is to allow the Jenkins continued access of the chief API so that we can interrogate it and figure out what other images are running or with Jenkins we're going to use Jenkins the slaves running as containers on Jenkins Jenkins going to discover what what images are available to use to be used as Jenkins slave and for that it needs to call drinking the opposite API also we're going to need to download images from one project the project and tag it into other projects or deploy containers based on images so we need to give access to Jenkins service account to be able to do this kind of operation through authorship API and we do that fruit OC policy command as role to user and we edit access to the SIS to the service account let's run the Jenkins and that is constraints going to be lining the CI CD project I'll use a default service account for that same dev and stage 5 all right now we're good to go and I switch to the CICE project look at the console also we have a project ready inside CI CD we haven't done any components how are we going to instantiate the components we have two templates here one uses github is a git repository the other one spins up the gods instance that it looks pretty much like github but going to run in on open ship as a container and you have those choices and in this time I'm going to use gods to show you the full full CIC defo copy the URL to this template c OC process stem play so that is replace the Parmenter Zenit bit with prop country values and then create that creates a bunch of objects for us number of services pods builds deployments and so on in the project all the components are up and running we have a number of containers instantiated for us you have dogs which is our git repository right now is empty let's register gog is using a task for login into dogs you don't have any repositories yet but the application that I talked about will shift tasks is available on github what we're going to do is that migrate that into gods you can just import that repository and manage within God's instead so what should we call it in god shift as my way and now we have a project available inside dogs running on openshift what else we have we have a Jenkins instance you have Nexus 4 managing our maven artifacts we have already configured Red Hat GA maven repository for a JBoss artifacts in it and we also have the Postgres backends for sonarqube and gods and sonar q which is our code analysis to since you haven't always anything with it yet so we don't have any projects empty once you want we'll get more data so and the last component is Jenkins we have one project defined in it already task city pipeline you edit and take a look at the pipeline definition it uses the pipeline plug-in which is really convenient way for building a continuous little bit of pipelines and Jenkins and a Jenkins - this plug-in actually is brought built-in integrated into Jenkins itself in a groovy we define our pipeline here say wanna run on nodes that are tagged with JDK 8 so that we have JDK installed there and these Jenkins is configured already to use open shift containers on open shift as a slave so it's going to spin up a new container an open ship that is tagged with this label JDK 8 and run the job there so we can scale become on many many jobs at the same time it runs the build so by default this is going to github to get the source code for open shift the task application we're gonna modify this to make it go to our guards instance on within our project so it's listening to on ports 3000 and the user we defined and in court to depart towards cog so this is the URL for our repository in dogs and the rest are the different steps of the pipeline we've on the unit tests and static analysis in in parallel so we see one of them fills the entire pipeline fail then we push the artifacts to nexus to manage them over there and if that is successful let's start deploying onto the development environment to build the project from scratch and if that is successful after running tests we promote the image to the stage environment tagowit diversion and deploy it into stage environment so let's run this pipeline once and see how it looks like say build down and instance for the pilot of pipelining instantiate it this job is actually wanting in one new continue on open shift look at achieve now and you continue parties you know it doesn't have name everything this is gonna by Jenkins it tells open ships to create this pod and you see it uses JDK drinking this way this is something that we built as a part of this demo in github we can see the code for that the source for that and it's running the job there so statute of pipeline and the Python plugin is really nice visualized as a platform as well to see the first step is the instantiated if I click on login' suit what's exactly happening be cloning the source code from God and afterward it's going to run the maven build and start testing and static analysis same time going to take a few seconds moves on to the next stage test and analysis and we kept the logs here we see the two stages running at the same time we have the two tests running made and tests and at the same time we are doing the sonar analysis so first download some artifacts if you like this for the first time and then start running the static analysis on the code it can do it code coverage and extract any bad patterns that are used in the code it's going to take you two seconds this one as well can look at the log you see the sonar starts running analysis at this stage download some guitar fall for sonar and there will be both a lock down all set and both since both stages have been successful belonging the tests and the static analysis and now we move on to next stage of our pipeline which is pushing to Nexus at this stage it pushes the water the fact that we have two - Nexus for archiving it in the repository this next isn't and successful deploy to the development environment that also went fine and want a few tests that has been fine magazine image and run field and deploy to the stage environment the whole pipeline isn't successful let's go analyze a little what's been going on within our pipeline and so if you go to sonar refresh see a new project shows up here give us ap tasks jax-rs up and well the code coverage is true you read you don't have any coverage under seven 17.6% if I click flu you can get a little more detail about which classes you have to coverage and which bachelor pad colors you want classes plane so we have two coverage in one of our services diversity that split and how much one having a lot of code how many bugs you see one and booties some signs of using bad bad patterns in the code if I go into it so we get some data about our code and in Sonora can you can define rule so that if some of the rules are violated and for example there and the bill fails and that's always a good way to guard the quality of our code when you're lying again you'll want to get pipeline so we get to two bars that are notified by sonar you create issues based on density development goals fix them and we also had Nexus as a part of the pipeline so that when we pull the artifacts they are pushed into Nexus if I go look into the repositories Internet snapshots let's see one more file is push there it's the version that is the point here and we used this war file for deploying into a container and openshift so in open ship if I look at the dev project see the application is up and running here the task app it doesn't have any GUI if I go to it but it instead of rest services that in the documentation we can conceive how to call for services to create tasks and get tasks out of that and since that has been successful look at the staging environment we also have a project here and with the tasks application with a component here with tasks application deployed if you look at the images during the time we see that we have an image tag with the version of the application and that version coming from the pom file that the same version we use indexes and so that we can recreate and new containers be based on this a specific version of the image into our stage or other environments so that's how it looks like a complete pipeline all the way from 10 minutes a source code to deploy them off to environmental environment and go through the pipeline as you want it right get more confidence in our build in the next part of this demos we're gonna look at how to make a change in the source code and trigger a deployment based on the changes between a configuration or the substrate thank you for watching this demo and then make sure you check out the next one
Info
Channel: OpenShift
Views: 98,028
Rating: 4.9010601 out of 5
Keywords: continuous integration, continuous deployment, demo, openshift, red hat, linux, community, jenkins, maven
Id: 65BnTLcDAJI
Channel Id: undefined
Length: 17min 1sec (1021 seconds)
Published: Tue Aug 23 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.