Day 30:Exploring Jenkins

Day 30:Exploring Jenkins

Short Jenkins CI/CD project


Previous day recap

In our previous blog post- https://aminchivilkar.hashnode.dev/day-29-jenkins, we took the first steps into the world of Jenkins by installing it on our system and getting everything prepared for action. We walked through the installation of Java and executed a series of commands in the shell to ensure that Jenkins was up and running.

Today, let's continue our journey and delve into accessing Jenkins via the user interface, unlocking it, and fetching code from GIT.

Jenkins Setup Wizard :

  • Open the Web Browser: Once Jenkins is up and running, open your preferred web browser and navigate to http://your_server_ip:8080. This will take you to the Jenkins setup wizard.

  • Unlock Jenkins: To unlock Jenkins and begin the setup process, you need to retrieve the initial admin password. Open a terminal on your Linux machine and use the following command:

      sudo cat /var/lib/jenkins/secrets/initialAdminPassword
    

    This command will display the initial admin password on the terminal. Copy the password.

  • Enter the Password: Back in your web browser, paste the copied password into the "Administrator password" field of the Jenkins setup wizard and click "Continue."

  • Install Recommended Plugins: Jenkins will present you with the option to either install recommended plugins or select them manually. For now, let's go with the recommended plugins. This will install a collection of essential tools that are important for DevOps practices.

  • Create First Admin User: After the plugins are installed, you'll be prompted to create the first admin user. Fill in the required details such as your username, password, full name, and email address. Make sure to note down the Jenkins URL displayed on this page, as you'll need it to access the Jenkins dashboard later. Click "Save and Continue."

  • Setup Jenkins link: The Jenkins URL is used to provide the root URL for absolute links to various Jenkins resources- http://0.0.0.0:8080/

  • Jenkins is Ready: You'll receive a confirmation that Jenkins is ready for action. Click "Start using Jenkins" to access the dashboard.


Setting Up Job: Django Todo App Delivery

With Jenkins all set up, it's time to create your first job. Let's take a look at how you can do that:

  1. Create a New Job:

    • From the Jenkins dashboard, click "New Item."

    • Name your job, e.g., "Django-todo-app-delivery"

    • Select "Freestyle project" and click "OK."

  2. Job Configuration:

    • In the job configuration page under "general", enter a description for the job, e.g. "Django Todo App"

    • Select "GitHub project" and provide the project URL.

    • For "Source Code Management," choose "Git" and enter the repository URL.

    • Specify the branch you want to build, e.g., /main.

  3. Build Steps:

    • In the "Build" section, you can add build steps to be executed during the job.

    • For simplicity, we'll use a Shell script. Add the following line:

  4. Save and Run:

    • Click "Save" to save the job configuration.

    • Back on the dashboard, you'll see your newly created job.

    • To execute the job, simply press the green play button (the build icon) next to the job name.

  5. Console Output:

    • Click on the project and select the run number

    • As the job runs, you can click on "Console Output" to see the live output of the build process.

    • This is particularly useful for debugging and understanding the steps that Jenkins is executing.

    • The below result shows that the code has run successfully.

  1. Exploring Automation:

    • As you'll notice, we've provided Jenkins with a URL, and it has automatically cloned the code from the specified Git repository to the intended machine.

    • This showcases the power of Jenkins in automating repetitive tasks and building a streamlined CI/CD pipeline.


Conclusion :

As we navigate further into the world of Jenkins, each step shows its capabilities in simplifying complex procedures and automating routine tasks.

From unlocking Jenkins to GitHub integration via UI, every facet showcases how Jenkins enhances efficiency and promotes seamless collaboration in the world of DevOps. Stay tuned as our journey through Jenkins unfolds, uncovering more insights and tools for your CI/CD endeavors. Onward to the next adventure!

Hope you like my post. Don't forget to like, comment, and share.