0
0
Jenkinsdevops~5 mins

CI/CD tools landscape in Jenkins - Commands & Configuration

Choose your learning style9 modes available
Introduction
CI/CD tools help automate the process of building, testing, and delivering software. They solve the problem of manual, error-prone deployments by making software delivery faster and more reliable.
When you want to automatically test your code every time you save changes.
When you need to deploy your app to a server without doing it by hand.
When multiple developers work on the same project and need a shared build process.
When you want to catch bugs early by running tests automatically.
When you want to deliver updates to users quickly and safely.
Commands
This command starts the Jenkins server on your machine so you can access the web interface to create and manage your CI/CD pipelines.
Terminal
java -jar jenkins.war
Expected OutputExpected
Running from: /home/user/jenkins.war 2024-06-01 12:00:00.000+0000 [id=1] INFO org.eclipse.jetty.server.Server#doStart: Started @12345ms Jenkins is fully up and running
This command checks if Jenkins is running by requesting its API endpoint. It returns JSON data about the Jenkins server status.
Terminal
curl http://localhost:8080/api/json
Expected OutputExpected
{"assignedLabels":[{}],"mode":"NORMAL","nodeDescription":"the master Jenkins node","numExecutors":2,"description":null,"jobs":[],"overallLoad":{},"primaryView":{"name":"All"},"quietingDown":false,"slaveAgentPort":50000,"unlabeledLoad":{},"useCrumbs":true,"useSecurity":true,"views":[{"name":"All"}]}
This command lists all jobs configured in Jenkins using the Jenkins CLI tool. It helps verify what pipelines are available.
Terminal
java -jar jenkins-cli.jar -s http://localhost:8080/ list-jobs
Expected OutputExpected
No output (command runs silently)
-s - Specifies the Jenkins server URL
Key Concept

If you remember nothing else from this pattern, remember: CI/CD tools automate software building, testing, and deployment to save time and reduce errors.

Common Mistakes
Trying to start Jenkins without Java installed
Jenkins runs on Java, so without Java the server won't start and you get errors.
Install Java (version 11 or newer) before running Jenkins.
Not checking if Jenkins is running before using CLI commands
CLI commands fail if the Jenkins server is not running or reachable.
Always verify Jenkins is running by accessing the web UI or using curl before running CLI commands.
Summary
Start Jenkins server with 'java -jar jenkins.war' to access the web interface.
Check Jenkins status using its API with curl to ensure it is running.
Use Jenkins CLI to list and manage jobs for automation pipelines.