Configure Build Tools in Jenkins and Jenkinsfile | Jenkins Tutorial
Key Takeaways
This video tutorial demonstrates how to configure build tools in Jenkins, including Gradle and Yarn, and use them in a Jenkinsfile for continuous integration and deployment. It covers installing plugins, configuring tools, and using wrappers in the Jenkinsfile.
Full Transcript
so in this video I'm going to show you how to configure different build tools in Jenkins so the development flow usually looks like this so you develop your application and now using Jenkins you want to build and package that application as an artifact so in order to build the application in the package you need some kind of build tool depending on which technology which language you use you are going to need a different build tool for example the four main tools that I've used commonly in projects and there some more but this four main are maven and Gradle four beckon applications like if you're developing your java application you probably use one of those and if you have a JavaScript application then you are going to be using either NPM or yarn so for example if you have front-end in JavaScript you will build it using NPM or yarn and back-end you will build it using maven on Gradle and you will need at least one of those build tools in your Jenkins build configuration because Jenkins bill has to run these commands so how does it work how does Jenkins allow you to use these build tools some of these tools are available or installed in Jenkins out of the box the rest of them you have to install as plugins and configure them so the first step that you need to do is to go to the Jenkins configuration and check whether your tool is already there out of the box if it is you just use it if not you go to the plugins you install it go back to the configuration and then you configure it once you have that already in a Jenkins configuration you can actually use it and the usage depends on what type of built of Jenkins use I'm going to show you example of using two of these tools actually in Jenkins file so let's actually go ahead and check it on Jenkins so the step one I said you need to go to Jenkins manage engines and global tool configurations that's where all the tools are configured here you can see the list of the out-of-the-box available tools so if I scroll here I see I have Gradle and I have maven which is already configured for me and I have docker what I don't have here is NPM or yarn so what I'm gonna do now is I'm gonna create an example Jenkins pipeline using a demo application that I have and this demo application that I have uses Gradle and yarn to build back-end and front-end respectively which means I don't need the maven installation radishes here I only need Grail from here and in addition to that I will need yarn and by the way when below the task of the tool you have this button button with installations dot the dot that means there is at least one of that installation configured if not you have to add one and to see how it looks like this is maven installations and I have one so if I hover here this is one installation of version three six three which is installed directly from Apache so from internet so how this configuration works is we can see it on Gradle example if I do add Gradle I just give it a name whenever I want and here I choose the version actually I'm gonna go with the latest one you can also fix it a different version if your project needs that and Jenkins will install that tool automatically for me I don't have to go and install that on a Jenkins server or whatever Jenkins does automatically form which is extremely convenient and this is basically the type of installer so if you see here the button it installer one of the options is installed from Gradle torg which is what I have by default here so I'm gonna leave it at that and that's it Gradle is configured I can use Gradle now in my Jenkins file right so I I can save that but as I showed you I don't have n PM or yarn installed in order to do that I go to manage plugins go to available there is a specific NPM plug-in as well and PM pipeline plug-in the way I do this is I'm gonna install in nodejs plug-in which will give me the NPM as well so install so I'm gonna install that success and after I restart my Jenkins because you need to restart it so that the plug-in changes take effect now if I go to global tool configuration I should see the no J's in the list so I'm gonna add nodejs and the project demo project that I'm using actually works with the older no J's version it has some backwards compatibility problem issues so I'm gonna fix a the no J's version to 10:17 so that's the version that the application works on and here's the part where you can automatically like in addition to Jenkins automatically installing the no J's with this version you can make it install global packages maintain packages and yarn is one of the NPM packages so if I write a yarn here it's gonna install that automatically as well so I'm gonna give it a name let's call it node there is a common practice to name the installation with the version because if you have multiple of them you want to differentiate between node 1 no 2 so you can do something like this 17 like this and you can also fix 8 the version of NPM packages and I'm gonna need that as well because again my app doesn't work with the latest yarn version so I'm gonna fix that it like this that's a syntax for it it it actually says here in the description and the yarn version I need is 113 0 and I'm gonna save that so now when I create a pipeline I should have both Gradle and yarn available so I'm gonna create that pipeline it's gonna be my Nemo project multi-branch pipeline so that's my repository I have the credentials already configured and I'm gonna build only master so let's master here and it's gonna scan the project for master and the Jenkins file and I don't have a drink as well in the master branch so let's go and create some very super simple Jenkins file just to demonstrate the usage of these two tools so here I'm gonna create a jenkees file so this is a very basic pipeline syntax that has two stages we run front-end or we build front-end and we build the backend and if you want to learn the details of it jenkees file syntax I have other videos about it so you can check them out so the plan is to use yarn command in the first step where we build the front-end and to use Gradle in the second step so the way to do that is using following syntax and this is called wrapper of those tools that we've configured so the the wrapper is no J's it's not called and here I have to provide the name of that installation which I don't remember actually so let's go back and check that so no J's installations and that's the name I'm gonna copy that and you have to provide it here so it knows that you are using that installation of node in here we create a block and the way you can run these commands is using SH so the shell command for windows you would use bench if your Jenkins is executing on a Windows node and here in this command I can already use yarn so imagine this is your command line for Jenkins and you have yarn installed so I'm gonna do a yarn I'm just gonna do yarn install just to demonstrate that the command is there so again a wrapper of that installation and inside of that I can execute yarn comments so if I have a second command I can do yarn build whatever and here we're gonna use the Gradle command and the wrapper for that is with Gradle which doesn't take anything as a parameter so it's just with Gradle and inside of that block we are gonna execute another shell command and it's gonna be Gradle W so the wrapper commends because it sound like project is set up so we're just gonna print out the version of Gradle so for now jsut have to provide the name of the installation for with Gradle upper you don't so I'm gonna commit that okay so you see the master branch is scanning jenkees file was found and if I go to this one here it's building master if I go inside let's actually check the console output and here you see that yarn is executing so yarn installed and this is a version that we provided 117 zero and yarn install is running and now the Gradle - be version command ran and output the Gradle so basically they just this just proves that those build tools were installed by Jenkins automatically with the versions that I specified and the commands rein successfully so obviously the same way you can use maven and npm as well so for example here since we have no J's which has NPM already installed instead of yarn you would just use NPM comments now there's an alternative to using those tools without the wrapper you may have seen it already in the jenkees file syntax there is an attribute called tools and inside that you can configure which tools you are gonna be using in a Jenkins file so it works the same as a wrapper however that tools plug-in or the tools attribute supports only three tools by now and these three tools are maven Gradle and JDK so the way I can use it is I'm gonna define cradle here so Jake is knows I need Gradle and the side I'm gonna have to define then the Gradle installation that I have configured in Jenkins so this will be the installation name so this one right here so I have to configure that so basically these indicates to Jenkins I want to use Gradle in my Jenkins file please go and fetch me the Gradle configuration that I've configured in the global tool configuration and now using that definition I can use Gradle commands without the wrapper so I can remove this and this should work as well so let's actually update this and I'm gonna scan my project go to master and see that it's building let's see okay so it's built and it ran so if I see the logs it locked the version so I guess my preferred way is to do it like this so all the tools that are supported using this tools attribute I'm gonna use them right like this because the steps part will be cleaner without the wrappers and for the rest you're just gonna have to use the wrapper like this so that's how you configure build tools and use them in Jenkins thanks for watching the video I hope it was helpful and if it was don't forget to like it if you want to be notified whenever a new video comes out then subscribe to my channel if you have any questions if something wasn't clear in the video please post them in a comment section below and I will try to answer them so thank you and see you in the next video
Original Description
Learn how to configure build tools in Jenkins. Configure Gradle and Yarn in Jenkins and use it in Jenkinsfile.
► Subscribe To Me on Youtube: https://bit.ly/2z5rvTV
Using Jenkins you want to build and package your application. So, depending on your application language you need a different build tool available on Jenkins. In this video I show you how to install and configure Gradle, Yarn and NPM build tools in Jenkins and how to use those tools in Jenkinsfile.
▬▬▬▬▬▬ T I M E S T A M P S
0:00 - Intro
1:13 - How to use build tools in Jenkins
1:57 - Check if your build tool is already available?
4:07 - Install npm and yarn from plugins
7:09 - Use build tools (gradle and yarn) in Jenkinsfile
10:43 - Alternative to using build tools in Jenkinsfile
⭐️Full Jenkins Playlist: https://www.youtube.com/playlist?list=PLy7NrYWoggjw_LIiDK1LXdNN82uYuuuiC
For any questions/issues/feedback, please leave me a comment and I will get back to you as soon as possible.
#devops #jenkins #docker #techworldwithnana
-------------------------------------------------------------------------------------------------------
✅ Connect with me
on Youtube: https://www.youtube.com/channel/UCdngmbVKX1Tgre699-XLlUA
on DEV: https://dev.to/techworld_with_nana
on Instagram: https://www.instagram.com/techworld_with_nana/ or my personal account: https://www.instagram.com/nanuchij/
on Twitter: https://twitter.com/Njuchi_/
on Tumblr: https://www.tumblr.com/blog/techworld-with-nana
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from TechWorld with Nana · TechWorld with Nana · 30 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
▶
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
What is Docker? Docker container concept explained || Docker Tutorial 1
TechWorld with Nana
What is a Docker Container? Docker Demo || Docker Tutorial 2
TechWorld with Nana
How to install docker? Step by Step || Docker Tutorial 3
TechWorld with Nana
8 Basic Docker Commands || Docker Tutorial 4
TechWorld with Nana
Debugging Docker Containers with docker exec and docker logs || Docker Tutorial 5
TechWorld with Nana
Docker vs Virtual Machine | simply explained || Docker Tutorial 6
TechWorld with Nana
Overview of Workflow with Docker - Docker in Practice || Docker Tutorial 7
TechWorld with Nana
Developing with Docker - Docker in Practice || Docker Tutorial 8
TechWorld with Nana
Docker Compose Tutorial - Docker in Practice || Docker Tutorial 9
TechWorld with Nana
Dockerfile Tutorial - Docker in Practice || Docker Tutorial 10
TechWorld with Nana
Private Repository explained | Registry on AWS - Docker in Practice || Docker Tutorial 11
TechWorld with Nana
Docker Volumes explained in 6 minutes
TechWorld with Nana
Deploying the containerized application with Docker Compose || Docker Tutorial 12
TechWorld with Nana
Docker Volumes Demo || Docker Tutorial 13
TechWorld with Nana
Docker vs Kubernetes vs Docker Swarm | Comparison in 5 mins
TechWorld with Nana
What is Kubernetes | Kubernetes explained in 15 mins
TechWorld with Nana
Kubernetes Components explained! Pods, Services, Secrets, ConfigMap | Kubernetes Tutorial 14
TechWorld with Nana
Kubernetes Architecture explained | Kubernetes Tutorial 15
TechWorld with Nana
Benefits of Kubernetes | Scalability, High Availability, Disaster Recovery | Kubernetes Tutorial 16
TechWorld with Nana
Minikube and Kubectl explained | Setup for Beginners | Kubernetes Tutorial 17
TechWorld with Nana
Top 3 programming languages to learn in 2020 | meta analysis
TechWorld with Nana
Kubectl Basic Commands - Create and Debug Pod in a Minikube cluster | Kubernetes Tutorial 18
TechWorld with Nana
Kubernetes YAML File Explained - Deployment and Service | Kubernetes Tutorial 19
TechWorld with Nana
Run Jenkins in Docker Container - Jenkins Pipeline Tutorial for Beginners 1/4
TechWorld with Nana
Create Multibranch Pipeline with Git - Jenkins Pipeline Tutorial for Beginners 2/4
TechWorld with Nana
Jenkinsfile - Jenkins Pipeline Tutorial for Beginners 3/4
TechWorld with Nana
Trigger Jenkins Build automatically - Jenkins Pipeline Tutorial for Beginners 4/4
TechWorld with Nana
Complete Application Deployment using Kubernetes Components | Kubernetes Tutorial 20
TechWorld with Nana
Kubernetes Namespaces Explained in 15 mins | Kubernetes Tutorial 21
TechWorld with Nana
Configure Build Tools in Jenkins and Jenkinsfile | Jenkins Tutorial
TechWorld with Nana
Complete Jenkins Pipeline Tutorial | Jenkinsfile explained
TechWorld with Nana
Kubernetes Ingress Tutorial for Beginners | simply explained | Kubernetes Tutorial 22
TechWorld with Nana
What is Helm in Kubernetes? Helm and Helm Charts explained | Kubernetes Tutorial 23
TechWorld with Nana
How Websites Work | simply explained with examples
TechWorld with Nana
What is JavaScript? | JavaScript Tutorial #1
TechWorld with Nana
What is Ansible | Ansible Playbook explained | Ansible Tutorial for Beginners
TechWorld with Nana
JavaScript Variables & JavaScript Data Types explained | JavaScript Tutorial #2
TechWorld with Nana
How Prometheus Monitoring works | Prometheus Architecture explained
TechWorld with Nana
Where to write JavaScript | Where to execute JavaScript Code | JavaScript Tutorial #3
TechWorld with Nana
JavaScript Operators & JavaScript Conditionals | JavaScript Tutorial #4
TechWorld with Nana
Pods and Containers - Kubernetes Networking | Container Communication inside the Pod
TechWorld with Nana
Kubernetes Volumes explained | Persistent Volume, Persistent Volume Claim & Storage Class
TechWorld with Nana
Kubernetes ConfigMap and Secret as Kubernetes Volumes | Demo
TechWorld with Nana
Pull Image from Private Docker Registry in Kubernetes cluster | Demo
TechWorld with Nana
Kubernetes StatefulSet simply explained | Deployment vs StatefulSet
TechWorld with Nana
Yaml Tutorial | Learn YAML in 18 mins
TechWorld with Nana
Terraform explained in 15 mins | Terraform Tutorial for Beginners
TechWorld with Nana
Setup Prometheus Monitoring on Kubernetes using Helm and Prometheus Operator | Part 1
TechWorld with Nana
Managed Kubernetes Cluster explained | Kubernetes on Cloud (1/2)
TechWorld with Nana
Step by Step Application Deployment on LKE using Helm | Kubernetes on Cloud (2/2)
TechWorld with Nana
Kubernetes Operator simply explained in 10 mins
TechWorld with Nana
What is Infrastructure as Code? Difference of Infrastructure as Code Tools
TechWorld with Nana
AWS EKS - Create Kubernetes cluster on Amazon EKS | the easy way
TechWorld with Nana
Prometheus Monitoring - Steps to monitor third-party apps using Prometheus Exporter | Part 2
TechWorld with Nana
GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker
TechWorld with Nana
Docker Tutorial for Beginners [FULL COURSE in 3 Hours]
TechWorld with Nana
Kubernetes Services explained | ClusterIP vs NodePort vs LoadBalancer vs Headless Service
TechWorld with Nana
Kubernetes Tutorial for Beginners [FULL COURSE in 4 Hours]
TechWorld with Nana
Containers on AWS Overview: ECS | EKS | Fargate | ECR
TechWorld with Nana
Kubernetes is dropping Docker support - What does it mean for YOU?
TechWorld with Nana
More on: AI Tools for PMs
View skill →Related AI Lessons
Chapters (6)
Intro
1:13
How to use build tools in Jenkins
1:57
Check if your build tool is already available?
4:07
Install npm and yarn from plugins
7:09
Use build tools (gradle and yarn) in Jenkinsfile
10:43
Alternative to using build tools in Jenkinsfile
🎓
Tutor Explanation
DeepCamp AI