Jenkins is the most popular CI/CD server. There you create jobs that are triggered by some events (changed in a code repository, manually, etc). Those events invokes the steps like compiling to see if you can generate the executable. Then you run tests (unit tests) to confirm the desired behaviour at low-level. After the integration stage passes, you can build the executable to deliver them to a working environment.
Step 1: Install & start Docker container. If the image is not already available it will be downloaded from “Docker Hub”, i.e. https://hub.docker.com/ where you can search for the image “jenkins”.
[arulkumarankumaraswamipillai@MacBook-Pro-2:~]$ docker run --name my_jenkins -d \
-p 8080:8080 -p 50000:50000 \
-v /Users/arulkumarankumaraswamipillai/Desktop/jenkins_home:/var/jenkins_home \
Step 2: Get into the container and check for “/var/jenkins_home/secrets/initialAdminPassword”
[arulkumarankumaraswamipillai@MacBook-Pro-2:~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
c8a23dd1e443 jenkins/jenkins "/sbin/tini -- /usr/…" 4 minutes ago Up 4 minutes 0.0.0.0:8080->8080/tcp,
[arulkumarankumaraswamipillai@MacBook-Pro-2:~]$ docker exec -it c8a23dd1e443 /bin/bash
Show the password:
jenkins@c8a23dd1e443:/$ cat /var/jenkins_home/secrets/initialAdminPassword
Copy and paste the password on the Web UI in the next step.
Step 3: Open the Jenkins Web UI and paste password from last step.
Step 4: Install the suggested packages.
Step 5: Create an admin user with a password in the ensuing screens, and then you are ready to use Jenkins as shown below.
Step 6: Click on “New Item” menu within Jenkins, and type “test” and select “Freestyle project“.
Step 7: Go to the “Build” tab and in “Add build step” list select “Execute shell“.
Step 8: Enter some shell commands & click “save“.
Step 9: Click on the “Build Now” to build the project.
Step 10: Click on the build number as in “#4”, and the select “Console Output“.
Step 11: Get yourself familiarised by clicking on the “Configure” and playing around with various things.
What is next?
02: Getting started with Jenkins Multibranch pipeline on Docker tutorial. Most industrial applications will be using this as there will be many branches.
Mechanical Engineer to self-taught Java freelancer within 3 years. Freelancing since 2003. Preparation empowered me to attend 190+ job interviews & choose from 150+ job offers with sought-after contract rates. Authored & sold 35,000 copies via amazon.com. Books are outdated & superseded by this site with 1800+ registered users. Amazon.com profile | Amazon.com reviews | Good reads reviews | LinkedIn | LinkedIn Group | YouTube