How to configure Jenkins?

Jenkins is an open-source automation server widely used for continuous integration and continuous delivery (CI/CD) of software projects. It helps automate various tasks in the software development process, such as building, testing, and deploying applications.

Here are some key features that Jenkins offers:

  • Jobs: Jenkins allows you to define and configure jobs, which are individual tasks or stages. Jobs can be triggered manually or automatically based on specific events, such as changes in a version control repository.

  • Pipelines: Jenkins supports the concept of pipelines, which are a series of steps that define the build, test, and deployment process for your application. Pipelines can be created using either the traditional script-based approach or the newer declarative syntax.

  • Plugins: Jenkins has a vast ecosystem of plugins that extend its functionality. These plugins provide additional features, integrations with external tools, and support for different programming languages, version control systems, and build tools.

Configuration

To configure Jenkins, you need to perform several steps, including installing Jenkins, setting up the initial configuration, managing plugins, and configuring jobs or pipelines.

Please note that this Answer assumes you're using macOS.

Here's a general guide to get you started:

  1. Install Jenkins: To install Jenkins, you can follow this Answer.

  2. Start server: To start Jenkins server, open a terminal or command prompt and run the following command:

brew services start jenkins-lts
Command to start Jenkins server

Wait for Jenkins to start and access it through your web browser using the URL http://localhost:8080.

  1. Unlock Jenkins: The Unlock Jenkins screen provides information on where to find the initial password.

widget
  • Navigate to the directory( in our case its /Users/dev/.jenkins/secrets/) in unlock window by running command below:

cd /Users/dev/.jenkins/secrets/
Command to switch to directory containing password file
  • List the files in the directory using the command:

ls -a
Command to list files in current directory
  • Once you've located the file, you can read its contents using a text editor or a command-line tool like cat:

cat initialAdminPassword
Command to read contents of initialAdminPassword file
  1. Install plugins: Install or update the desired plugins based on your requirements. You can search for plugins by name or browse the available categories.

widget

Some commonly used plugins include Git, GitHub, Maven, Gradle, Pipeline, and various testing frameworks.

widget

 4. Jenkins URL Configuration: The last step is to configure the URL for the server.

widget

After confirming the relevant information, click on the Save and Finish button. A confirmation page will indicate that Jenkins is now ready to use.

widget

Once you click on the Start using Jenkins button, you will be directed to a dashboard where you can access and manage Jenkins.

widget

Stop and restart Jenkins

To stop the Jenkins server, execute the following command:

brew services stop jenkins-lts
Command to stop Jenkins server

Run the following command to restart the server again:

brew services restart jenkins-lts
Command to restart Jenkins Server

Copyright ©2024 Educative, Inc. All rights reserved