Jenkins & its use cases

๐๐ฎ๐ฟ๐ฎ๐ต๐ธ๐น๐ถ๐ฎ๐ท๐ฝ ๐๐ฎ๐ฏ๐ธ๐ป๐ฎ ๐๐ฎ๐ท๐ด๐ฒ๐ท๐ผ
Before the advent of Jenkins, developers had to complete code testing before they could check for errors.
โ๏ธDevelopers on teams, tending to work independently, each created large segments of code to add to the base code. The entire source code would be checked for errors a time-consuming and challenging undertaking.
โ๏ธMultiple developers would each send commits to version control, increasing the time required to identify and fix bugs. There was no iterative code improvement, and the software delivery process was slow.
Now letโs understand what actually is Jenkins & how it is usedโฆ
๐ฆ๐ฑ๐ช๐ฝ ๐ฒ๐ผ ๐๐ฎ๐ท๐ด๐ฒ๐ท๐ผ?
โ๏ธJenkins is a self-contained, open-source automation server that can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software.
โ๏ธJenkins can be installed through native system packages, Docker, or even run standalone by any machine with a Java Runtime Environment (JRE) installed.
โ๏ธIt works with multiple programming languages and can run on various platforms (Windows, Linux, and macOS). It is widely used as a CI (Continuous Integration) & CD (Continuous Delivery) tool.
โ๏ธIt has vast community support, and there are many plugins available for integrating it with other tools like Slack, GitHub, Docker. Also, anyone can develop a Jenkins plugin and contribute to it.
โ๏ธBy using Jenkins, software companies can accelerate their software development process, as Jenkins can automate a build and run tests to ensure the functionality is working fine.
โ๏ธJenkins supports the entire software development life cycle that includes building, testing, documenting the software, and deploying.
๐๐ธ๐ท๐ฝ๐ฒ๐ท๐พ๐ธ๐พ๐ผ ๐๐ท๐ฝ๐ฎ๐ฐ๐ป๐ช๐ฝ๐ฒ๐ธ๐ท ๐๐ฒ๐ฝ๐ฑ ๐๐ฎ๐ท๐ด๐ฒ๐ท๐ผ
โ๏ธContinuous Integration is a software development process where a code is continuously tested after a commit, to ensure there are no bugs.
โ๏ธIn large teams, many developers work on the same code base. Thus, any of the multiple commits can have a bug. With continuous integration, bugs can be identified early and fixed before pushing changes to production. Any new code is integrated into one executable form, termed a build. If the build is green (i.e. all ok), then the executable artifact can be deployed. If not, the bug needs to be fixed, and the new build is tested again.
Letโs see how to get started with Jenkins CI.

๐๐ธ๐ ๐ฝ๐ธ ๐ฌ๐ป๐ฎ๐ช๐ฝ๐ฎ ๐ช ๐๐ ๐น๐ฒ๐น๐ฎ๐ต๐ฒ๐ท๐ฎ ๐ฒ๐ท ๐๐ฎ๐ท๐ด๐ฒ๐ท๐ผ?
1. Declarative Pipeline
Jenkins pipeline can be written in a declarative manner with the โJenkins syntaxโ. Jenkins syntax is a Groovy DSL (Domain Specific Language) that is used to write stages of the pipeline. The DSL internally gets converted into XML to make the Jenkins pipeline. A โstageโ in a pipeline is a group of steps to be executed in the pipeline.

2. Jenkins Job Builder
โ๏ธJJB (Jenkins job builder) is a tool to create a pipeline using YAML configuration. The Jenkins pipeline can be written in YAML and with the help of the JJB tool, it converts the YAML configuration in XML format and pushes it into Jenkins to create pipelines. It is comparatively easy to write YAML configuration than writing full-fleshed code in Jenkins syntax.
โ๏ธThis tool also enables the use of โPipeline as Codeโ so that a pipeline code can be pushed into a git repo and the pipeline gets created or updated in Jenkins. The tool also helps with the templatization of the pipeline code.
๐๐ฎ๐ท๐ฎ๐ฏ๐ฒ๐ฝ๐ผ ๐ธ๐ฏ ๐พ๐ผ๐ฒ๐ท๐ฐ ๐๐ฎ๐ท๐ด๐ฒ๐ท๐ผ ๐๐
- Reduced development cycle: Since every commit is getting built and tested, it allows releasing new features to the user faster and with fewer errors
- Shorter time to integrate code: Before the use of Jenkins CI, integration of code was done manually, thus taking a few days. In some cases, it might happen that the code is not in a running state, and it is hard to debug as it might have gone through various commits in the repository. Integrating code after every commit ensures that at least the functionality is not broken after a commit
- Faster feedback to developer teams: Whenever a test breaks during a commit, developers get feedback and hence improve the code there and then. Otherwise, debugging the issue can be very difficult given teams would not be sure which commit resulted in the bug
- Automated workflow: Teams do not have to worry about running a manual test for each commit. The Jenkins CI pipeline checks the latest code and builds the code along with the tests. If the test is green, it can deploy the project in a specific environment else it can notify the developer by breaking the build
๐๐ธ๐ท๐ฌ๐ฎ๐ป๐ท๐ผ ๐พ๐ผ๐ฒ๐ท๐ฐ ๐๐ฎ๐ท๐ด๐ฒ๐ท๐ผ ๐๐
- Cost: Running a Jenkins CI server requires some infrastructure setup and its costly to deploy a Jenkins CI over the cloud
- Maintenance: Spinning up a Jenkins CI server is time-consuming. Jenkins CI also needs maintenance in case of adding a stage in the pipeline or upgrading the Jenkins CI server to incorporate new features.
๐ฆ๐ฑ๐ช๐ฝ ๐ช๐ป๐ฎ ๐ฝ๐ฑ๐ฎ ๐๐ฎ๐ท๐ด๐ฒ๐ท๐ผ ๐๐ฎ๐ช๐ฝ๐พ๐ป๐ฎ๐ผ?
Jenkins offers many attractive features for developers:
- Easy Installation
Jenkins is a platform-agnostic, self-contained Java-based program, ready to run with packages for Windows, Mac OS, and Unix-like operating systems.
- Easy Configuration
Jenkins is easily set up and configured using its web interface, featuring error checks and a built-in help function.
- Available Plugins
There are hundreds of plugins available in the Update Center, integrating with every tool in the CI and CD toolchain.
- Extensible
Jenkins can be extended using its plugin architecture, providing nearly endless possibilities for what it can do.
- Easy Distribution
Jenkins can easily distribute work across multiple machines for faster builds, tests, and deployments across multiple platforms.
- Free Open Source
Jenkins is an open-source resource backed by heavy community support.
๐๐ฎ๐ท๐ด๐ฒ๐ท๐ผ ๐๐ป๐ฌ๐ฑ๐ฒ๐ฝ๐ฎ๐ฌ๐ฝ๐พ๐ป๐ฎ
- Developers commit changes to the source code, found in the repository.
- The Jenkins CI server checks the repository at regular intervals and pulls any newly available code.
- The Build Server builds the code into an executable file. In case the build fails, feedback is sent to the developers.
- Jenkins deploys the build application to the test server. If the test fails, the developers are alerted.
- If the code is error-free, the tested application is deployed on the production server.
- The files can contain different codes and be very large, requiring multiple builds. However, a single Jenkins server cannot handle multiple files and builds simultaneously; for that, a distributed Jenkins architecture is necessary.
๐๐ฎ๐ท๐ด๐ฒ๐ท๐ผ ๐๐ช๐ผ๐ฝ๐ฎ๐ป-๐ข๐ต๐ช๐ฟ๐ฎ ๐๐ป๐ฌ๐ฑ๐ฒ๐ฝ๐ฎ๐ฌ๐ฝ๐พ๐ป๐ฎ

โ๏ธAs you can see in the diagram provided above, on the left is the Remote source code repository. The Jenkins server accesses the master environment on the left side and the master environment can push down to multiple other Jenkins Slave environments to distribute the workload.
โ๏ธThat lets you run multiple builds, tests, and production environments across the entire architecture. Jenkins Slaves can be running different build versions of the code for different operating systems and the server Master controls how each of the builds operates.
โ๏ธSupported on a master-slave architecture, Jenkins comprises many slaves working for a master. This architecture โ the Jenkins Distributed Build โ can run identical test cases in different environments. Results are collected and combined on the master node for monitoring.
The Bottom Line
โ๏ธJenkins provides developers with an excellent framework from which they can develop and test new codes, resulting in the faster delivery of better quality software. By avoiding costly delays and log jams, developers can become an organizationโs MVPs.
๐๐ฎ๐ท๐ด๐ฒ๐ท๐ผ ๐๐ช๐ผ๐ฎ ๐ข๐ฝ๐พ๐ญ๐: ๐ถ๐๐๐๐๐๐๐๐
๐When developing a thriving ecosystem of the best and smartest customer success technologies, a solid DevSecOps foundation is essential. Gainsight, a leading customer success platform provider, chose to humanize the customer experience with innovative technology.
๐How? The answer is two-fold. First, they built a CX platform that simplifies and facilitates day-to-day operations. Second, they turn disparate customer data from multiple sources into insights and actions that drive measurable business outcomes. By presenting related data, tasks, and workflows across the customer success tech stack, Gainsight can help drive more relevant customer engagement, faster, for the hundreds of clients they serve.
๐With a mantra to โnever stop looking for the next best thing,โ Gainsight is continuously creating cutting-edge products and services for their clients and their community. By empowering customer-focused businesses to deliver exceptional experiences every day, the Gainsight engineering team needs to be equally agile and deliver products and enhancements as fast as they can innovate. This drove the companyโs tech team to build a more fluid, dynamic DevOps process โ using infrastructure as code โ with Jenkins at the helm.
CHALLENGE:
Maintain an infrastructure-as-code approach while integrating various tools and programming languages within the platform, all while securing processes with better visibility and air-tight quality control.
SOLUTION:
A flexible and scalable DevSecOps infrastructure that provides Gainsight with keener operational insight, ease of collaboration, and the ability to accelerate releases to stay a step ahead of the competition.
Results :
- Infrastructure costs were reduced by 40%
- Builds are 30% faster
- Better and seamless communication on builds and releases
- 95% of infrastructure scalable with code
- Virtually no more manual processes

๐๐ฎ๐ท๐ด๐ฒ๐ท๐ผ ๐พ๐ผ๐ฎ-๐ฌ๐ช๐ผ๐ฎ๐ผ :
Continuous Integration (CI)
โ๏ธContinuous integration is a practice that forces developers to frequently integrate their code into a central repository.
โ๏ธInstead of building out new features to the end without any quality measurement, every change is tested against the central repository to anticipate errors.
Continuous Delivery (CD)
โ๏ธContinuous delivery is the ability to make changes of all types such as new features, configuration changes, error fixes, experiments into production safely and efficiently using short work cycles.
โ๏ธThe main goal is continuous delivery is to make deployments predictable as routine activities that can be achieved upon request.
Continuous Deployment (CD)
โ๏ธContinuous deployment, also known as continuous implementation, is an advanced stage of continuous delivery that the automation process does not end at the delivery stage. In this methodology, every change that is validated at the automatic testing stage is later implemented at the production stage.
โ๏ธThe fail-fast strategy is always of the utmost importance when deploying to production. Since every change is deployed to production, it is possible to identify edge cases and unexpected behaviors that would be very hard to identify with automated tests.
Automation
โ๏ธAs a job executor, Jenkins can be used to automate repetitive tasks like backup/restore databases, turn on or turn off machines, collect statistics about service and other tasks. Since every job can be scheduled, repetitive tasks can have the desired time interval (like once a day, once a week, every fifth day of the month, and so forth).
๐๐ฎ๐ท๐ด๐ฒ๐ท๐ผ ๐๐ต๐ฝ๐ฎ๐ป๐ท๐ช๐ฝ๐ฒ๐ฟ๐ฎ๐ผ
Although Jenkins is a good option for an automated, CI/CD server, there are other options on the market such as Gitlab CI/CD, Circle CI, Travis, or Bamboo.
GitLab CI/CD
โ๏ธGitLab is a full-featured software development platform that includes a module called GitLab CI/CD to leverage the ability to build, test, and deploy without external requirements (such as Jenkins). It is a single application that can be used in all stages of the developersโ work cycle on the same project: product, development, QA, security, and operations.
โ๏ธGitLab is a solution that enables teams to cooperate and work from a single step instead of managing thousands of threads across disparate tools. It provides a single data store, one user interface, and one permission model across the developersโ life cycle.
โ๏ธGitlab comes in a variety of flavors: there is a community, open-source edition that can be deployed locally, and some paid versions with an increasing number of features.
Circle CI
โ๏ธCircle CI is a hosted continuous integration server. After Circle CI is authorized on GitHub or Bitbucket, every code change triggers tests in a clean container or VM.
โ๏ธAfter this, an email is sent every time there is a successful test completed or a failure. Any project with a reporting library provides code test coverage results. Circle CI is simple to configure, has a comprehensive web interface, and can be integrated with multiple source code versioning tools.
Bamboo CI
โ๏ธBamboo is a solution for continuous integration, deployment, and delivery. Bamboo allows you to create a multi-stage build plan, set up triggers upon commits, and assign agents to builds and deployments.
โ๏ธIt also allows you to run automated tests in every code change which makes catching bugs easier and faster. Bamboo supports continuous deliveries as well.
Travis CI
โ๏ธTravis is another open-source solution that also offers a free hosted option for open source projects (paid for enterprise clients).
โ๏ธIt uses a solution similar to Jenkins Pipelines: you add a file called .travis.yml that describes the projectโs own build workflow. It also has parallel job builds but it does not have the same size of add-ons available for Jenkins.
Conclusion :
โจIntegration solutions are a key step towards reaching delivery reliability.
โจEvery developer commits daily to a shared mainline and every commit triggers an automated workflow for building and testing; if building and testing fail it is possible to repair what is wrong quickly and safely and thereby increase productivity in the workflow.
Tิฮฑษณฦ แงฯฯ ฯฯษพ ษพาฝฮฑิฮนษณษ ษฑแง ฮฑษพฦฮนฦส าฝ๐
Kาฝาฝฯ Lาฝฮฑษพษณฮนษณษ ๐คฉKาฝาฝฯ Sิฮฑษพฮนษณษ ๐ค
Gฯฯิ Dฮฑแง!