Домой United States USA — software Jenkins Tutorial: Get Started Quickly and Easily With CI

Jenkins Tutorial: Get Started Quickly and Easily With CI

314
0
ПОДЕЛИТЬСЯ

Learn how to build a Jenkins server and create a CI job, and finish up by starting an automatic build as the result of a code change.
Join the DZone community and get the full member experience. What’s the first thing you think of when someone refers to continuous integration (CI)? For many people, it’s Jenkins®. Originally developed just for CI, Jenkins manages and controls software delivery processes throughout the entire lifecycle. It’s now the most widely used software process automation, continuous integration and continuous delivery tool in the world. This tutorial focuses on CI. You’ll learn how to build a Jenkins server and create a CI job. Then you’ll finish up by starting an automatic build as the result of a code change. CI means integrating code quickly. Rather than operating on a schedule or waiting for the project to cross predefined gates, developers frequently push their changes to a shared repo. Then, Jenkins or another similar tool detects the changes and starts a build. There are many reasons to implement CI. When you integrate and build your code early and often, it helps you detect problems and conflicts early on, rather than weeks or even months after they’re created. You also help your developers by getting the feedback earlier too. Jenkins is an open-source automation server. You can use it to automate nearly any task. Most importantly, you can also trigger these tasks based on events like changes to a source code repository. That’s what makes it a powerful tool in the software development process. Let’s get Jenkins up and running quickly! The fastest way to get started with Jenkins is with the latest image. It contains everything you need to get a server up and running. So you’ll need a system with Docker installed. You’re also going to use Docker Compose to add a Jenkins agent to the server, so you’ll be able to set up a simple project. Finally, you’ll need access to a Git repo. For this example, I’ll use one on GitHub, which you can fork and use for this tutorial. First, you need to start a Jenkins server and unlock it. Create an empty directory. Then create a file named docker-compose.yaml with your favorite text editor. Here is the initial configuration. The service, which starts on line three, is the Jenkins server. It has several important properties. image: You’re using the latest long-term support Jenkins image. user: Jenkins will run as root in the container.

Continue reading...