Jenkins Notes
Jenkins Notes
CI/CD refers to the Continuous Integration and Continuous Delivery/Deployment process. It’s a
process of taking the code, packaging it and deploying it to a System(EC2, VM, Container,
Serverless). During Continuous Integration process we do unit tests, integration tests, and
security checks on the code, check the dependencies,
Jenkins is an Automation Server. We can use Jenkins to automate routine system administration
tasks.
We can host Jenkins on a VM, local system, containers, EC2. Java is a prerequisite for Jenkins
installation.
sudo systemctl enable jenkins #you can enable jenkins to start at the boot
sudo systemctl status jenkins #to check the status of the jenkins service
If you have a firewall installed, you must add Jenkins as an exception. You must change
YOURPORT in the script below to the port you want to use. Port 8080 is the most common.
YOURPORT=8080
PERM="--permanent"
SERV="$PERM --service=jenkins"
When you first access a new Jenkins instance, you are asked to unlock it using an automatically-
generated password.
(1). Browse to http://localhost:8080 (or whichever port you configured for Jenkins when installing
it) and wait until the Unlock Jenkins page appears.
(2). The command: sudo cat /var/lib/jenkins/secrets/initialAdminPassword will print the password
at console.
(3). If you are running Jenkins in Docker using the official jenkins/jenkins image you can use sudo
docker exec ${CONTAINER_ID or CONTAINER_NAME} cat
/var/jenkins_home/secrets/initialAdminPassword to print the password in the console without
having to exec into the container.
After unlocking Jenkins, the Customize Jenkins page appears. Here you can install any number of
useful plugins as part of your initial setup.
Install suggested plugins - to install the recommended set of plugins, which are based on
most common use cases.
Select plugins to install - to choose which set of plugins to initially install. When you first
access the plugin selection page, the suggested plugins are selected by default.
Finally, after customizing Jenkins with plugins, Jenkins asks you to create your first administrator
user.
When the Create First Admin User page appears, specify the details for your administrator user
in the respective fields and click Save and Finish.
When the Jenkins is ready page appears, click Start using Jenkins.
We can use Jenkins CLI if you are comfortable with the CLI.
let us begin interacting with Jenkins over ssh with the user mike:
mike@jenkins-server:~$ ssh -i /home/mike/.ssh/jenkins_key -l mike -p 8022 jenkins-server help