Code Monkey home page Code Monkey logo

devopsproject's Introduction

CSC591 - DevOps project Milestone 1

Team and Contribution

  • Chetan Pawar - Triggered Builds script, Multiple Branches Multiple Jobs script, Video recording
  • Payal Soman - Maven and Jenkins set up, Post-Build success task, Documentantion
  • Viralkumar Sanghavi - Maven and Jenkins set up, Post-Build failure task , Documentation

Build

Task 1 - Trigger build in response to git commit

  • Install Git Plugin in jenkins
  • Create build a new job on jenkins. Take care of following parameter
	Repository URL:  Enter local path to git repository
	Branch to build: Enter the branch name to which you want to trigger the build
  • Create hooks post-commit file with following content
	#!/bin/sh
	curl http://localhost:8080/job/MavenTestAppLocal-master/build
  • Change one of the local file and commit it
  • Go to Jenkins project where it will show new build has been triggered automatically.

Task 2- Ability to execute a build job via a build manager

  • We have used maven which takes care of dependency management and running clean build every time. Maven manages dependency by adding packages into pom.xml file in dependencies section. It is also capable performing build and creating package from the source code.

Task 3: Build Status + External Post-Build Job Triggers

  • The build status is displayed in the Jenkins console output.
  • On an unsuccessful and unstable build, we have set up an email trigger using the Email notification option in Jenkins.
  • On a successful build, we executed a script that writes the Build Number, Build Time and the Build Url into a temporary build log file. We used the Post-Build Script Plugin in Jenkins for this. Following are the contents of post-build script.
	BUILDTEXT1="Build number "$BUILD_NUMBER" successful for dev branch.\n"
	BUILDTEXT2="Time: $(date)\nFind details of build at "
	echo "$BUILDTEXT1$BUILDTEXT2$BUILD_URL\n-----------------------------------\n" >> /tmp/buildLog

Task 4: Multiple Branches, Multiple Jobs

  • We are executing each job corresponding to each branch using the git post-commit hook.
  • In the post-commit hook, we wrote a script to get the name of the branch committed and then trigger the build for that particular branch.
  • The script for this in post-commit file is as follows:
	#!/bin/sh
	BRANCHNAME=$(git rev-parse --abbrev-ref HEAD)
	MASTERBRANCH="master"

	if [ $BRANCHNAME = $MASTERBRANCH ]; then
		curl http://localhost:8080/job/MavenTestAppLocal-master/build
	else
	        curl http://localhost:8080/job/MavenTestAppLocal-devBranch/build
	fi
	
	echo "Build triggered successfully on branch: $BRANCHNAME"

Task 5: Build history

  • Jenkins maintains the history of all the builds executed for a job and shows it on its UI.

  • The build history can also be obtained from the available XML or JSON API in Jenkins which contains the urls for all the builds that have been executed for that particular job.

  • Currently our project does not have many test cases as we are using a sample maven project with simple 'hello world' program. Screencast of all the steps are explained in this video.

devopsproject's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.