DevOps Classroom notes – 19/Dec/2019

Building Code and Unit Testing Using Jenkins

  • It depends on Technology (EcoSystem)
  • Every Technology/Application has different set of build tools and unit testing
  • In Jenkins Approach is
    • Install necessary tools
    • configure tools for Jenkins user
    • In the build section execute these commands

Example: Building Docker Image

  • Even if you are not familiar with docker, we can still build this.
  • First lets install Docker. Login as Jenkins user and do the following
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
sudo usermod -aG docker jenkins
sudo service jenkins restart # when it is configured in jenkins
exit
# relogin
docker info
  • Lets look at commands
git clone https://github.com/DevProjectsForDevOps/StudentCoursesRestAPI.git 
docker image build -t studentcourserestservice:1.0 .
  • Create a free style Jenkins project, Select the Source Code Management Tab and give git details, and then to build section and Execute shell
docker image build -t studentcourserestservice:1.0 .

Build/Compile/test Java Using Maven.

  • Building Java Code

    • Compiling Each and every .java file
    • archive (zip) all the generated .class files into war/jar/ear
  • To do this build activity, there are many build tools

    • ANT
    • Maven
    • Gradle
  • In this series we restrict ourselves to Maven

  • Maven Installation on ubuntu

sudo apt-get update
sudo apt-get install maven -y
mvn -v

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner