- Open source integration tool.
- It can be made as centralised server by integrating multiple source like source code management , build tools , deployment environment .
- Complete INTEGRATION TOOL
- Its Java based.
- To automate the repeated task.
- CI/CD ( continuous integration and continuous delivery )
- Even you can do patching.
- In simple , its a centralised server.
Advantages
- CI/CD
- Open source
- Community driven
- Browser based
- Supports all Operating system.
- Distributed build --> Master and Slave node , how ? If you are setting up Jenkins , it uses resource of the system where its installed and accordingly the Jobs will take the RAM , CPU and resources. To avoid this "Distributed build" was introduced , so that "Master and Slave node" with that the load will be distributed.
- We can increase the scalability of master and slave.
CI/CD Workflow
- Commit
- Build
- Test
- Stage
- Deploy
- Stages will be different in other CI/CD process. Purpose will be the same.
- Dedicated branch for each environment it will be a best practice to avoid any confusion here.
Installation & Configuration
sudo apt-get update
java -version
Add the official key of Jenkins and then the repo.
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]" \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins
Now JENKINS had been installed , please check with command also whether its installed or not.
dpkg -l | grep -i jenkins
As we have encountered error , install higher version of Java from 11 to 17 or 21.
sudo systemctl start jenkins
sudo systemctl enable jenkins
sudo systemctl status jenkins
- Now open the console with the IP of the system.
- If you want to know the username , then go to below location.
cat /var/lib/jenkins/users/users.xml
/var/lib/jenkins/users/admin_17980521444909415742
want to change the password , edit and restart the jenkins.
<hudson.security.HudsonPrivateSecurityRealm_-Details> <passwordHash>#jbcrypt:$2a$10$OTYB2osGPi/rasutjHcYOOhByiCoaEZTEQk52CABOwYdrtxeIPnBu</passwordHash>
</hudson.security.HudsonPrivateSecurityRealm_-Details>
- Give no password for jenkins user ( as its a internal user )
- Check whether able to get output without sudo password.
User Management & security
- Manage Jenkins > Security
- Trying to use the OS user for security features , lets try.
- Add the user to the group shadow like below and restart the Jenkins.
- Now its integrated with the OS user (sathishpy1808) , you can even login with the OS users after integrating.
Jenkins own database
- User created in Jenkins only can login , OS users can't.
User creation
- Change to "Jenkins own database" then only you can view the user creation option like below ,
- Go to the ravi user profile and explore.
- Even you can terminate all sessions from the console.
- You can change the password also and delete option is also available.
Authorisation
- what type of authorisation is given to the users , you can see many options in the below screen.
- BY default --> "logged-in users can do anything" its equal to admin access --> its not advisable.
- Try to use with user based ,
- Also ROLE based plugin it will be useful , lets install ( mostly used plugin for role based authorisation )
- Manage & roles won't be available at first , it will come after the plugin installation only.
- Manage roles and assign roles are very important option.
- Lets create a role and then assign the users.
- Pattern based users are created only in "Item Roles". Here if any user starts with word "Manage" , it should the managing job roles.
- Create some Jobs to test this user specification.
- Item roles in "Assign Roles" will be useful for pattern description for users.
- You can see all roles which are added.
- All users are added in this console.
Job Management
- Jobs needs to be created to perform a task.
Build Triggers
- "Trigger builds remotely (e.g., from scripts)" --> it will trigger once some other task gets triggered.
- "GitHub hook trigger for GITScm polling" --> once the code gets committed then only the job needs to be triggered.
Build Environment
Build Steps
- This is the main step , you can add number of steps here.
- Raw commands , shell script , etc.
- Can be added like stages.
Post-build Actions
Notes
- https://www.jenkins.io/doc/book/installing/linux/ --> In this site , you can get the details of the key and the repo details which we have added in the first of the installation part. [TBD]
- What is "openjdk-17-jdk-headless package" ?
- Default port of Jenkins is 8080.
- jenkins user will be always running.
Commands Used
java -version
locate jdk
whereis java
List of errors
Job for jenkins.service failed because the control process exited with error code.
- Now you can get the details by typing ,
journalctl -xeu jenkins.service
Error clearly says , ( version not supported )
Dec 01 22:03:57 meet.sathishpy1808.org jenkins[40153]: Running with Java 11 from /usr/lib/jvm/java-11-openjdk-amd64, which is older than the minimum required version (J>
Dec 01 22:03:57 meet.sathishpy1808.org jenkins[40153]: Supported Java versions are: [17, 21]
Dec 01 22:03:57 meet.sathishpy1808.org jenkins[40153]: See https://jenkins.io/redirect/java-support/ for more information.
Dec 01 22:03:57 meet.sathishpy1808.org systemd[1]: jenkins.service: Main process exited, code=exited, status=1/FAILURE
Access Denied
- change the ownership to the current user,
sudo chown -R sathishpy1808:sathishpy1808 /var/lib/jenkins/
sudo chown $(whoami) /var/lib/jenkins
Top comments (0)