DevOps Classroom Series – 10/feb/2021

Why use Jenkins or any other CI/CD Engine

  • Refer the image below Preview
  • There are many alternatives to jenkins
    • Azure DevOps (VSTS)
    • Bamboo
    • TeamCity
    • Circle CI
  • From Jenkins we need to create a pipeline to
    • get the latest version of the code
    • build the code into some package
    • run some code quality tools
    • upload the package to some repository
    • deploy the application into various test environments

Lets understand how jenkins works and important terms of jenkins

  • Lets start the Jenkins server Preview
  • Jenkins Job: This is sequence of actions to be performed to realize a ci/cd pipeline or part of pipeline
    • To create a Jenkins job, in jenkins we need to create a jenkins project which specifies the steps to be performed as part of jenkins build. Preview Preview Preview Preview Preview Preview Preview
  • So when we execute a jenkins job/project then jenkins runs the steps mentioned in the job as a system user (default is jenkins) and shows the results Preview
  • Jenkins will store all of its configurations in JENKINS HOME Directory, In this case the jenkins home directory is /var/lib/jenkins Preview Preview Preview Preview
  • The jenkins project which we create will be stored as an xml file in JENKINS_HOME/jobs/<jobname>/config.xml
  • When we run the jenkins job, jenkins uses workspace folder to store the build generated files Preview Preview
  • Lets change the hellojenkins job to create some file and build the jenkins job Preview Preview Preview
  • Lets create a jenkins job which will clone git repository Refer Here Preview Preview Preview
  • So if we know manual steps for building the application, creating test environment and executing tests can we do that in jenkins
  • So jenkins can be looked as scheduler which can run commands provided by user
  • Jenkins has other features to make this simple. To make them simple Jenkins uses Plugins. A Plugin is a feature extension for jenkins which provides the user interface (in many cases) and some functionality
  • Now lets create a jenkins job to clone a game of life repository using these plugins Preview Preview Preview Preview
  • Now lets try to create a jenkins job to update ubuntu packages
sudo apt update

Preview Preview Preview

  • This fails as jenkins user does not have permissions to execute sudo commands
  • Now lets add jenkins user to sudoers group and then execute the same job Preview
  • Now, Can we run python –version in jenkins job. But the result whether this will be success or not depends on
    • Whether python is installed or not on the Jenkins Machine
    • Whether the user jenkins has permission to execute python or not.
  • Next Steps:
    • Lets learn how to build java code using maven

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Floating Social Media Icons by Acurax Wordpress Designers

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube