Hands on with Jenkins

Freestyle and Pipeline project using Jenkins and Docker

  1. We would be checking the options when to rebuild our project using Build Triggers We can either set up a build

    • through scripts or after some other project

    • after a specific time

    • through commits in a particular branch

    • when a pull request is made

    • through GitHub hooks (on w In Build Steps we would also type certain commands so that docker-compose run creates and runs a container through YAML file

  2. If we want to receive mail for failed builds we can also set up notifications.

  3. We can also check the Build history in the left sidebar to see the console output for debugging.

    Also for commits, we can Click on #Build number to check the status of our build and for debugging purposes.

On port 8001 mentioned in yaml file our web application would be built.

Building the project in jenkin through pipeline

  1. In the pipeline, we would be defining stages (Code, Build, Test, Deploy) and steps in pipeline script once we have created the project. The config menu would be having this option

    • pipeline is always written at top of the pipeline script file

    • agent defines on which Operating system this code would be executed.

    • stages defines SDLC stages and script are the commands that get executed on the host machine

  2. Then through Full Stage View we can see all the stages

  3. Our app would be built using the Jenkins pipeline and would be accessible according to the port defined in Dockerfile or YAML file.

References

  1. Train with Shubham Zero To Hero DevOps Bootcamp