 Hello, this video is about deploying applications into OpenShift using Jenkins. In order to follow this video, it's a prerequisite that you would want to watch my previous video on promoting applications across environments, across the projects. So if you have not seen that, please see that video and then come back to this video. I'm using an external Jenkins environment here, although you could be running Jenkins within OpenShift itself. And there are a lot of improvements coming in that area on running Jenkins in OpenShift, which can deploy applications into OpenShift. So these things will change as we move into the future. But in the meantime, how can you use Jenkins and existing Jenkins in your environment to deploy applications into OpenShift is what I'm going to show you. I'm building up on my previous video that talks about promotion of applications across the environments. If you have watched my previous video, you would have seen that I have a development project. I have a QA project and I have set up necessary access. For example, the developer would have edit access to the development project and the tester would have edit access to the QA project and the tester has view access to the development project, things like that. Also, the QA project, the testing project would have image pull access from the development project, which means that if a Docker image got created in the development project, the testing project can pull it from the development project. So we are going to build upon the same approach as that we have used in my previous video. All I'm doing here is I have set up two Jenkins projects. So how did I create this? I clicked on this new item. Once I logged on to Jenkins, I clicked on this new item, chose a freestyle project and I call it deploy to development. Now, let me show you what is there in this project. This script logs your user in. I have some environment variables that I passed to this Jenkins script. This script logs in using the OC command line tool. I installed OC command line tool on the Jenkins server. It gets into the development project and if the application doesn't exist, it goes ahead and creates a new application. If the application exists, it starts a new build and then once the build is complete, it goes ahead and deploys the application and I have written the script in such a way that you could include your test scripts at this stage if you wanted to and that's it. That's the deploy to development part. Now, there is also another project deploy to QA which takes the code from the, that takes the Docker image from the, from the development project. It tags that image just like how I explained in the, in my previous video of how you can promote across the projects. It tags the image and it takes that image that is tagged as promote and it goes ahead and deploys that application into QA. If the image already exists, it doesn't have to create the new application. The application that was already there will get redeployed, right? Very simple. Also note that I have made this code available. The scripts that, that you would use in those Jenkins projects available as part of my GitHub. There is the deploy to dev script is here and the deploy to QA script is here. I also have two empty projects development which is, which has nothing in it as well as the testing project which has nothing. Now, before we start running, I have in the Jenkins project for development, I have set some environment variables which the script uses. One is the application name which is, which I call it my app for the application host name. Since this is running in development, I said my app dot dev dot my URL. And then for the git URL, I'm, I'm using the same exact code that we used in the previous video. This is the kitchen sink application. And I passed the other things like my username, where is my OpenShift environment and things like that. In the same way in the QA project, I have the environment variables defined. And here I am calling the, I'm giving the host name as my app dot QA. The application name I'm keeping the same. The rest of the parameters are the same. I'm passing the QA project name in the development project. I have created a deployment pipeline by using those two Jenkins projects or Jenkins steps. So there is a deploy to dev and deploy to QA in this pipeline. Let's start this pipeline now. I'm going to issue a run. This starts the deploy to dev part of step in the pipeline. Let's see what the output, the console output is. This is nothing existed in the development project. It created a new application. Now it is waiting for the build to start. The build has started. The build is now complete. And also it created the Docker image for the application and it has pushed that into the Docker registry and deployed it Jenkins job that we have created will make sure that the application is deployed and it is you are able to connect to that. And after that it it comes out with the finished success status. Now let's go back to the web console and check. There is nothing in the testing project yet. And there is this is the application running in the development project earlier. It was empty. Let me open this in the new tab to make sure it is running. Here is the application that is deployed. Now, let's say we are happy with this version of application and we want to promote this to QA all the steps that we discussed in the previous video are now automated. Go back to the pipeline, right? And it is waiting for the next step to start and I can run this deploy to QA step. Looking at the logs of this deploy to QA project in Jenkins, the application was not there. So it ended up tagging the image creating a new app from that from the newly tagged Docker image. The application got deployed and it's it waited till the applications has scaled up and then it is successful. Now, let's go back to the web console. Move into the testing project. You can see that it was empty before and this testing project is now it now has a application running so let's try this here is the app. Now, this is the same version one as the developer. Now, just like in the previous example, I made I went back to the source control repository. I made a bad change and this is I tagged it as version 2. Let's just for us to know and then I committed these changes. Now I come back to the deployment pipeline and I start a new build again for the development. This will take a minute. I'll pause the build is now complete and let's check the application Dev environment and this is a bad change, right? There is a spelling mistake. Now, I don't have any test cases. Otherwise the build itself would have failed but you don't like this change. So you don't want to promote this into into the QA anyway. Again, just like my previous video, I'll go back and fix that I fix the mistake and this is version 3 now back to deployment pipeline. I'll rerun this again. The new build has now started now. This time again, the application is already existing. So it will just start a new build based on the code changes we made. The build is complete. So let's go back and check. So here is the version 3 of the application. Now, since we're happy with this build, we're back on the pipeline. I'll start the deployment to QA. Now it will take the latest version of the image development and it will tag it as promote to QA and it will deploy into QA. So we currently we don't have, we are still running version 1 version 2 was bad. We didn't promote that into QA version 3 is good. We are trying to promote that into QA and applied there. Now the deployment to QA is complete. It's it's turned green and let's go back and check the image in QA and this is also version 3. The intent of this video is just to show that you can deploy applications into OpenShift using an external CI CD tool such as Jenkins. In the future for Jenkins specifically, you can expect additional improvements. For example, you may have a plug-in that would deploy applications into OpenShift. This is not a prescribed approach or anything. I made the code available as part of the repository. You can take that and improve upon it and make changes to whatever you want to do while deploying applications to OpenShift. Thanks for watching this video.