CONTINUOUS INTEGRATION
A GROB
M WEINTRAUB
Alex Grob and Michael Weintraub
MOTIVATION
Developing in teams means modules from different team members needs to integrated together into a system and then validated
Integration testing takes time
Want to find and swat bugs faster and earlier
Improve software
How to inspire confidence when changes happen frequently
TYPICAL PROCESS
The system is
built
Developers make
changes to codeThe system is
deployed
Errors are found
Errors are found Enhancementsadjustments are needed
The system is
validated
CODE MAY HAVE LOCAL DEPENDENCIES
Production
DEVELOPMENT VS PRODUCTION
Running our code locally in our own IDE allows us to keep our development separate from our production pipeline
This becomes increasingly important when we are not sure how our code changes will behave and do not want to interfere with our client facing (production) application
It also simplifies development as we are not dependent on our IDE to deploy our changes
OS
Host
ARCHITECTURAL DIAGRAM
OS Ubuntu 16
VMWareOther Host
Hardware
IntellijEclipse
Java junit
Development EnvironmentProduction EnvironmentExternal User
Client
Terminal
Host
DONrsquoT STACK UP COMMITS BEFORE RUNNING INTEGRATION TESTS
Each commit can have its own problems but also makes it easier to find bugs as your code is segmented
The more commits between integration test runs the more places (commits) the root cause may sit
The more places you have to explore to find bugs vs one big blob of code
Bigger build scopes mean longer test intervals which means you may be sitting around waiting for results for a while
c1 c2 c3 c4 c5 c6
1 Developers commit changes to the source repo frequently
2 Each commit is then built and validated ndash depending on policy staged or deployed
WHAT IS CONTINUOUS INTEGRATION
Code
Repository
Continuous
Integration
Service
Build
Test
Deploy
change
execute
POPULAR CI TOOLS
JENKINS
Open source automation server
Written in Java
Integrates via plug-ins
Git
Puppetchef
Selenium
Mavenhellip
We use it to automate building testing reporting and deployment of the code
KEY JENKINS CONCEPT PIPELINES
A set of tasks that trigger when an event occurs
eg on git commit
Implemented via a text file that defines a suite of tasks required by your software dev process
Each step calls a plug-in that does the task
By convention the file is usually called Jenkinsfile
LOG INTO YOUR TEAM REPO ON GITHUBCCSNEUEDU
This should be something along of the lines of
TASK-1 httpsgithubccsneueducs5500-fseTeam-X-su20 where X is your team number Or browse to httpsgithubccsneuedu and select the team repo from the Repositories you contribute to submenu
TASK-2 Please edit your teams READMEmd and add your Khoury-usernames Create a pull-request once you have added all your usernames We will use this information to add you as collaborators and turn your repos private
TASK-2 At the same time have another team member navigate to Jenkins
httpswww5500jenkins-1khourycloudcomjobFSEjobteam-x-su20jobmaster where X is your team number
You will be able to follow along once you open your PR request and Jenkins tries to build it
We have already provided a JenkinsfileYou should NOT edit the Jenkinsfile
This file may be updated by the course admins without notice or warning
If you have an idea for something cool for your pipeline please see the course admins
LOG INTO YOUR TEAM SLACK CHANNEL ON CS5500-SP2020SLACKCOM
You should have gotten an invite on your husky account
TASK-1 Log into httpsnortheasternuhqslackcom
TASK-2 Find the channel belonging to your Team-X where X and add yourself as a member
We will turn your channels private once all members have joined
PIPELINE TERMS
Step
A single task that defines an action
Example compile code
Node
A container for steps that Jenkins uses to manage its run queue
A workspace where Jenkins does work on files pulled from source control
Stage
A named set of steps
Stages
A set of Stage
Post
Wrap-up activities
Agent
Where the pipeline will run
Environment
Where you may define environment variables
A STANDARD USE CASE
1 Build the system
2 Test the system
3 Save the results
4 Let everyone know the results
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn ndashf
someawesomepath clean
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
MOTIVATION
Developing in teams means modules from different team members needs to integrated together into a system and then validated
Integration testing takes time
Want to find and swat bugs faster and earlier
Improve software
How to inspire confidence when changes happen frequently
TYPICAL PROCESS
The system is
built
Developers make
changes to codeThe system is
deployed
Errors are found
Errors are found Enhancementsadjustments are needed
The system is
validated
CODE MAY HAVE LOCAL DEPENDENCIES
Production
DEVELOPMENT VS PRODUCTION
Running our code locally in our own IDE allows us to keep our development separate from our production pipeline
This becomes increasingly important when we are not sure how our code changes will behave and do not want to interfere with our client facing (production) application
It also simplifies development as we are not dependent on our IDE to deploy our changes
OS
Host
ARCHITECTURAL DIAGRAM
OS Ubuntu 16
VMWareOther Host
Hardware
IntellijEclipse
Java junit
Development EnvironmentProduction EnvironmentExternal User
Client
Terminal
Host
DONrsquoT STACK UP COMMITS BEFORE RUNNING INTEGRATION TESTS
Each commit can have its own problems but also makes it easier to find bugs as your code is segmented
The more commits between integration test runs the more places (commits) the root cause may sit
The more places you have to explore to find bugs vs one big blob of code
Bigger build scopes mean longer test intervals which means you may be sitting around waiting for results for a while
c1 c2 c3 c4 c5 c6
1 Developers commit changes to the source repo frequently
2 Each commit is then built and validated ndash depending on policy staged or deployed
WHAT IS CONTINUOUS INTEGRATION
Code
Repository
Continuous
Integration
Service
Build
Test
Deploy
change
execute
POPULAR CI TOOLS
JENKINS
Open source automation server
Written in Java
Integrates via plug-ins
Git
Puppetchef
Selenium
Mavenhellip
We use it to automate building testing reporting and deployment of the code
KEY JENKINS CONCEPT PIPELINES
A set of tasks that trigger when an event occurs
eg on git commit
Implemented via a text file that defines a suite of tasks required by your software dev process
Each step calls a plug-in that does the task
By convention the file is usually called Jenkinsfile
LOG INTO YOUR TEAM REPO ON GITHUBCCSNEUEDU
This should be something along of the lines of
TASK-1 httpsgithubccsneueducs5500-fseTeam-X-su20 where X is your team number Or browse to httpsgithubccsneuedu and select the team repo from the Repositories you contribute to submenu
TASK-2 Please edit your teams READMEmd and add your Khoury-usernames Create a pull-request once you have added all your usernames We will use this information to add you as collaborators and turn your repos private
TASK-2 At the same time have another team member navigate to Jenkins
httpswww5500jenkins-1khourycloudcomjobFSEjobteam-x-su20jobmaster where X is your team number
You will be able to follow along once you open your PR request and Jenkins tries to build it
We have already provided a JenkinsfileYou should NOT edit the Jenkinsfile
This file may be updated by the course admins without notice or warning
If you have an idea for something cool for your pipeline please see the course admins
LOG INTO YOUR TEAM SLACK CHANNEL ON CS5500-SP2020SLACKCOM
You should have gotten an invite on your husky account
TASK-1 Log into httpsnortheasternuhqslackcom
TASK-2 Find the channel belonging to your Team-X where X and add yourself as a member
We will turn your channels private once all members have joined
PIPELINE TERMS
Step
A single task that defines an action
Example compile code
Node
A container for steps that Jenkins uses to manage its run queue
A workspace where Jenkins does work on files pulled from source control
Stage
A named set of steps
Stages
A set of Stage
Post
Wrap-up activities
Agent
Where the pipeline will run
Environment
Where you may define environment variables
A STANDARD USE CASE
1 Build the system
2 Test the system
3 Save the results
4 Let everyone know the results
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn ndashf
someawesomepath clean
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
TYPICAL PROCESS
The system is
built
Developers make
changes to codeThe system is
deployed
Errors are found
Errors are found Enhancementsadjustments are needed
The system is
validated
CODE MAY HAVE LOCAL DEPENDENCIES
Production
DEVELOPMENT VS PRODUCTION
Running our code locally in our own IDE allows us to keep our development separate from our production pipeline
This becomes increasingly important when we are not sure how our code changes will behave and do not want to interfere with our client facing (production) application
It also simplifies development as we are not dependent on our IDE to deploy our changes
OS
Host
ARCHITECTURAL DIAGRAM
OS Ubuntu 16
VMWareOther Host
Hardware
IntellijEclipse
Java junit
Development EnvironmentProduction EnvironmentExternal User
Client
Terminal
Host
DONrsquoT STACK UP COMMITS BEFORE RUNNING INTEGRATION TESTS
Each commit can have its own problems but also makes it easier to find bugs as your code is segmented
The more commits between integration test runs the more places (commits) the root cause may sit
The more places you have to explore to find bugs vs one big blob of code
Bigger build scopes mean longer test intervals which means you may be sitting around waiting for results for a while
c1 c2 c3 c4 c5 c6
1 Developers commit changes to the source repo frequently
2 Each commit is then built and validated ndash depending on policy staged or deployed
WHAT IS CONTINUOUS INTEGRATION
Code
Repository
Continuous
Integration
Service
Build
Test
Deploy
change
execute
POPULAR CI TOOLS
JENKINS
Open source automation server
Written in Java
Integrates via plug-ins
Git
Puppetchef
Selenium
Mavenhellip
We use it to automate building testing reporting and deployment of the code
KEY JENKINS CONCEPT PIPELINES
A set of tasks that trigger when an event occurs
eg on git commit
Implemented via a text file that defines a suite of tasks required by your software dev process
Each step calls a plug-in that does the task
By convention the file is usually called Jenkinsfile
LOG INTO YOUR TEAM REPO ON GITHUBCCSNEUEDU
This should be something along of the lines of
TASK-1 httpsgithubccsneueducs5500-fseTeam-X-su20 where X is your team number Or browse to httpsgithubccsneuedu and select the team repo from the Repositories you contribute to submenu
TASK-2 Please edit your teams READMEmd and add your Khoury-usernames Create a pull-request once you have added all your usernames We will use this information to add you as collaborators and turn your repos private
TASK-2 At the same time have another team member navigate to Jenkins
httpswww5500jenkins-1khourycloudcomjobFSEjobteam-x-su20jobmaster where X is your team number
You will be able to follow along once you open your PR request and Jenkins tries to build it
We have already provided a JenkinsfileYou should NOT edit the Jenkinsfile
This file may be updated by the course admins without notice or warning
If you have an idea for something cool for your pipeline please see the course admins
LOG INTO YOUR TEAM SLACK CHANNEL ON CS5500-SP2020SLACKCOM
You should have gotten an invite on your husky account
TASK-1 Log into httpsnortheasternuhqslackcom
TASK-2 Find the channel belonging to your Team-X where X and add yourself as a member
We will turn your channels private once all members have joined
PIPELINE TERMS
Step
A single task that defines an action
Example compile code
Node
A container for steps that Jenkins uses to manage its run queue
A workspace where Jenkins does work on files pulled from source control
Stage
A named set of steps
Stages
A set of Stage
Post
Wrap-up activities
Agent
Where the pipeline will run
Environment
Where you may define environment variables
A STANDARD USE CASE
1 Build the system
2 Test the system
3 Save the results
4 Let everyone know the results
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn ndashf
someawesomepath clean
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
CODE MAY HAVE LOCAL DEPENDENCIES
Production
DEVELOPMENT VS PRODUCTION
Running our code locally in our own IDE allows us to keep our development separate from our production pipeline
This becomes increasingly important when we are not sure how our code changes will behave and do not want to interfere with our client facing (production) application
It also simplifies development as we are not dependent on our IDE to deploy our changes
OS
Host
ARCHITECTURAL DIAGRAM
OS Ubuntu 16
VMWareOther Host
Hardware
IntellijEclipse
Java junit
Development EnvironmentProduction EnvironmentExternal User
Client
Terminal
Host
DONrsquoT STACK UP COMMITS BEFORE RUNNING INTEGRATION TESTS
Each commit can have its own problems but also makes it easier to find bugs as your code is segmented
The more commits between integration test runs the more places (commits) the root cause may sit
The more places you have to explore to find bugs vs one big blob of code
Bigger build scopes mean longer test intervals which means you may be sitting around waiting for results for a while
c1 c2 c3 c4 c5 c6
1 Developers commit changes to the source repo frequently
2 Each commit is then built and validated ndash depending on policy staged or deployed
WHAT IS CONTINUOUS INTEGRATION
Code
Repository
Continuous
Integration
Service
Build
Test
Deploy
change
execute
POPULAR CI TOOLS
JENKINS
Open source automation server
Written in Java
Integrates via plug-ins
Git
Puppetchef
Selenium
Mavenhellip
We use it to automate building testing reporting and deployment of the code
KEY JENKINS CONCEPT PIPELINES
A set of tasks that trigger when an event occurs
eg on git commit
Implemented via a text file that defines a suite of tasks required by your software dev process
Each step calls a plug-in that does the task
By convention the file is usually called Jenkinsfile
LOG INTO YOUR TEAM REPO ON GITHUBCCSNEUEDU
This should be something along of the lines of
TASK-1 httpsgithubccsneueducs5500-fseTeam-X-su20 where X is your team number Or browse to httpsgithubccsneuedu and select the team repo from the Repositories you contribute to submenu
TASK-2 Please edit your teams READMEmd and add your Khoury-usernames Create a pull-request once you have added all your usernames We will use this information to add you as collaborators and turn your repos private
TASK-2 At the same time have another team member navigate to Jenkins
httpswww5500jenkins-1khourycloudcomjobFSEjobteam-x-su20jobmaster where X is your team number
You will be able to follow along once you open your PR request and Jenkins tries to build it
We have already provided a JenkinsfileYou should NOT edit the Jenkinsfile
This file may be updated by the course admins without notice or warning
If you have an idea for something cool for your pipeline please see the course admins
LOG INTO YOUR TEAM SLACK CHANNEL ON CS5500-SP2020SLACKCOM
You should have gotten an invite on your husky account
TASK-1 Log into httpsnortheasternuhqslackcom
TASK-2 Find the channel belonging to your Team-X where X and add yourself as a member
We will turn your channels private once all members have joined
PIPELINE TERMS
Step
A single task that defines an action
Example compile code
Node
A container for steps that Jenkins uses to manage its run queue
A workspace where Jenkins does work on files pulled from source control
Stage
A named set of steps
Stages
A set of Stage
Post
Wrap-up activities
Agent
Where the pipeline will run
Environment
Where you may define environment variables
A STANDARD USE CASE
1 Build the system
2 Test the system
3 Save the results
4 Let everyone know the results
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn ndashf
someawesomepath clean
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
DEVELOPMENT VS PRODUCTION
Running our code locally in our own IDE allows us to keep our development separate from our production pipeline
This becomes increasingly important when we are not sure how our code changes will behave and do not want to interfere with our client facing (production) application
It also simplifies development as we are not dependent on our IDE to deploy our changes
OS
Host
ARCHITECTURAL DIAGRAM
OS Ubuntu 16
VMWareOther Host
Hardware
IntellijEclipse
Java junit
Development EnvironmentProduction EnvironmentExternal User
Client
Terminal
Host
DONrsquoT STACK UP COMMITS BEFORE RUNNING INTEGRATION TESTS
Each commit can have its own problems but also makes it easier to find bugs as your code is segmented
The more commits between integration test runs the more places (commits) the root cause may sit
The more places you have to explore to find bugs vs one big blob of code
Bigger build scopes mean longer test intervals which means you may be sitting around waiting for results for a while
c1 c2 c3 c4 c5 c6
1 Developers commit changes to the source repo frequently
2 Each commit is then built and validated ndash depending on policy staged or deployed
WHAT IS CONTINUOUS INTEGRATION
Code
Repository
Continuous
Integration
Service
Build
Test
Deploy
change
execute
POPULAR CI TOOLS
JENKINS
Open source automation server
Written in Java
Integrates via plug-ins
Git
Puppetchef
Selenium
Mavenhellip
We use it to automate building testing reporting and deployment of the code
KEY JENKINS CONCEPT PIPELINES
A set of tasks that trigger when an event occurs
eg on git commit
Implemented via a text file that defines a suite of tasks required by your software dev process
Each step calls a plug-in that does the task
By convention the file is usually called Jenkinsfile
LOG INTO YOUR TEAM REPO ON GITHUBCCSNEUEDU
This should be something along of the lines of
TASK-1 httpsgithubccsneueducs5500-fseTeam-X-su20 where X is your team number Or browse to httpsgithubccsneuedu and select the team repo from the Repositories you contribute to submenu
TASK-2 Please edit your teams READMEmd and add your Khoury-usernames Create a pull-request once you have added all your usernames We will use this information to add you as collaborators and turn your repos private
TASK-2 At the same time have another team member navigate to Jenkins
httpswww5500jenkins-1khourycloudcomjobFSEjobteam-x-su20jobmaster where X is your team number
You will be able to follow along once you open your PR request and Jenkins tries to build it
We have already provided a JenkinsfileYou should NOT edit the Jenkinsfile
This file may be updated by the course admins without notice or warning
If you have an idea for something cool for your pipeline please see the course admins
LOG INTO YOUR TEAM SLACK CHANNEL ON CS5500-SP2020SLACKCOM
You should have gotten an invite on your husky account
TASK-1 Log into httpsnortheasternuhqslackcom
TASK-2 Find the channel belonging to your Team-X where X and add yourself as a member
We will turn your channels private once all members have joined
PIPELINE TERMS
Step
A single task that defines an action
Example compile code
Node
A container for steps that Jenkins uses to manage its run queue
A workspace where Jenkins does work on files pulled from source control
Stage
A named set of steps
Stages
A set of Stage
Post
Wrap-up activities
Agent
Where the pipeline will run
Environment
Where you may define environment variables
A STANDARD USE CASE
1 Build the system
2 Test the system
3 Save the results
4 Let everyone know the results
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn ndashf
someawesomepath clean
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
OS
Host
ARCHITECTURAL DIAGRAM
OS Ubuntu 16
VMWareOther Host
Hardware
IntellijEclipse
Java junit
Development EnvironmentProduction EnvironmentExternal User
Client
Terminal
Host
DONrsquoT STACK UP COMMITS BEFORE RUNNING INTEGRATION TESTS
Each commit can have its own problems but also makes it easier to find bugs as your code is segmented
The more commits between integration test runs the more places (commits) the root cause may sit
The more places you have to explore to find bugs vs one big blob of code
Bigger build scopes mean longer test intervals which means you may be sitting around waiting for results for a while
c1 c2 c3 c4 c5 c6
1 Developers commit changes to the source repo frequently
2 Each commit is then built and validated ndash depending on policy staged or deployed
WHAT IS CONTINUOUS INTEGRATION
Code
Repository
Continuous
Integration
Service
Build
Test
Deploy
change
execute
POPULAR CI TOOLS
JENKINS
Open source automation server
Written in Java
Integrates via plug-ins
Git
Puppetchef
Selenium
Mavenhellip
We use it to automate building testing reporting and deployment of the code
KEY JENKINS CONCEPT PIPELINES
A set of tasks that trigger when an event occurs
eg on git commit
Implemented via a text file that defines a suite of tasks required by your software dev process
Each step calls a plug-in that does the task
By convention the file is usually called Jenkinsfile
LOG INTO YOUR TEAM REPO ON GITHUBCCSNEUEDU
This should be something along of the lines of
TASK-1 httpsgithubccsneueducs5500-fseTeam-X-su20 where X is your team number Or browse to httpsgithubccsneuedu and select the team repo from the Repositories you contribute to submenu
TASK-2 Please edit your teams READMEmd and add your Khoury-usernames Create a pull-request once you have added all your usernames We will use this information to add you as collaborators and turn your repos private
TASK-2 At the same time have another team member navigate to Jenkins
httpswww5500jenkins-1khourycloudcomjobFSEjobteam-x-su20jobmaster where X is your team number
You will be able to follow along once you open your PR request and Jenkins tries to build it
We have already provided a JenkinsfileYou should NOT edit the Jenkinsfile
This file may be updated by the course admins without notice or warning
If you have an idea for something cool for your pipeline please see the course admins
LOG INTO YOUR TEAM SLACK CHANNEL ON CS5500-SP2020SLACKCOM
You should have gotten an invite on your husky account
TASK-1 Log into httpsnortheasternuhqslackcom
TASK-2 Find the channel belonging to your Team-X where X and add yourself as a member
We will turn your channels private once all members have joined
PIPELINE TERMS
Step
A single task that defines an action
Example compile code
Node
A container for steps that Jenkins uses to manage its run queue
A workspace where Jenkins does work on files pulled from source control
Stage
A named set of steps
Stages
A set of Stage
Post
Wrap-up activities
Agent
Where the pipeline will run
Environment
Where you may define environment variables
A STANDARD USE CASE
1 Build the system
2 Test the system
3 Save the results
4 Let everyone know the results
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn ndashf
someawesomepath clean
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
DONrsquoT STACK UP COMMITS BEFORE RUNNING INTEGRATION TESTS
Each commit can have its own problems but also makes it easier to find bugs as your code is segmented
The more commits between integration test runs the more places (commits) the root cause may sit
The more places you have to explore to find bugs vs one big blob of code
Bigger build scopes mean longer test intervals which means you may be sitting around waiting for results for a while
c1 c2 c3 c4 c5 c6
1 Developers commit changes to the source repo frequently
2 Each commit is then built and validated ndash depending on policy staged or deployed
WHAT IS CONTINUOUS INTEGRATION
Code
Repository
Continuous
Integration
Service
Build
Test
Deploy
change
execute
POPULAR CI TOOLS
JENKINS
Open source automation server
Written in Java
Integrates via plug-ins
Git
Puppetchef
Selenium
Mavenhellip
We use it to automate building testing reporting and deployment of the code
KEY JENKINS CONCEPT PIPELINES
A set of tasks that trigger when an event occurs
eg on git commit
Implemented via a text file that defines a suite of tasks required by your software dev process
Each step calls a plug-in that does the task
By convention the file is usually called Jenkinsfile
LOG INTO YOUR TEAM REPO ON GITHUBCCSNEUEDU
This should be something along of the lines of
TASK-1 httpsgithubccsneueducs5500-fseTeam-X-su20 where X is your team number Or browse to httpsgithubccsneuedu and select the team repo from the Repositories you contribute to submenu
TASK-2 Please edit your teams READMEmd and add your Khoury-usernames Create a pull-request once you have added all your usernames We will use this information to add you as collaborators and turn your repos private
TASK-2 At the same time have another team member navigate to Jenkins
httpswww5500jenkins-1khourycloudcomjobFSEjobteam-x-su20jobmaster where X is your team number
You will be able to follow along once you open your PR request and Jenkins tries to build it
We have already provided a JenkinsfileYou should NOT edit the Jenkinsfile
This file may be updated by the course admins without notice or warning
If you have an idea for something cool for your pipeline please see the course admins
LOG INTO YOUR TEAM SLACK CHANNEL ON CS5500-SP2020SLACKCOM
You should have gotten an invite on your husky account
TASK-1 Log into httpsnortheasternuhqslackcom
TASK-2 Find the channel belonging to your Team-X where X and add yourself as a member
We will turn your channels private once all members have joined
PIPELINE TERMS
Step
A single task that defines an action
Example compile code
Node
A container for steps that Jenkins uses to manage its run queue
A workspace where Jenkins does work on files pulled from source control
Stage
A named set of steps
Stages
A set of Stage
Post
Wrap-up activities
Agent
Where the pipeline will run
Environment
Where you may define environment variables
A STANDARD USE CASE
1 Build the system
2 Test the system
3 Save the results
4 Let everyone know the results
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn ndashf
someawesomepath clean
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
1 Developers commit changes to the source repo frequently
2 Each commit is then built and validated ndash depending on policy staged or deployed
WHAT IS CONTINUOUS INTEGRATION
Code
Repository
Continuous
Integration
Service
Build
Test
Deploy
change
execute
POPULAR CI TOOLS
JENKINS
Open source automation server
Written in Java
Integrates via plug-ins
Git
Puppetchef
Selenium
Mavenhellip
We use it to automate building testing reporting and deployment of the code
KEY JENKINS CONCEPT PIPELINES
A set of tasks that trigger when an event occurs
eg on git commit
Implemented via a text file that defines a suite of tasks required by your software dev process
Each step calls a plug-in that does the task
By convention the file is usually called Jenkinsfile
LOG INTO YOUR TEAM REPO ON GITHUBCCSNEUEDU
This should be something along of the lines of
TASK-1 httpsgithubccsneueducs5500-fseTeam-X-su20 where X is your team number Or browse to httpsgithubccsneuedu and select the team repo from the Repositories you contribute to submenu
TASK-2 Please edit your teams READMEmd and add your Khoury-usernames Create a pull-request once you have added all your usernames We will use this information to add you as collaborators and turn your repos private
TASK-2 At the same time have another team member navigate to Jenkins
httpswww5500jenkins-1khourycloudcomjobFSEjobteam-x-su20jobmaster where X is your team number
You will be able to follow along once you open your PR request and Jenkins tries to build it
We have already provided a JenkinsfileYou should NOT edit the Jenkinsfile
This file may be updated by the course admins without notice or warning
If you have an idea for something cool for your pipeline please see the course admins
LOG INTO YOUR TEAM SLACK CHANNEL ON CS5500-SP2020SLACKCOM
You should have gotten an invite on your husky account
TASK-1 Log into httpsnortheasternuhqslackcom
TASK-2 Find the channel belonging to your Team-X where X and add yourself as a member
We will turn your channels private once all members have joined
PIPELINE TERMS
Step
A single task that defines an action
Example compile code
Node
A container for steps that Jenkins uses to manage its run queue
A workspace where Jenkins does work on files pulled from source control
Stage
A named set of steps
Stages
A set of Stage
Post
Wrap-up activities
Agent
Where the pipeline will run
Environment
Where you may define environment variables
A STANDARD USE CASE
1 Build the system
2 Test the system
3 Save the results
4 Let everyone know the results
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn ndashf
someawesomepath clean
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
POPULAR CI TOOLS
JENKINS
Open source automation server
Written in Java
Integrates via plug-ins
Git
Puppetchef
Selenium
Mavenhellip
We use it to automate building testing reporting and deployment of the code
KEY JENKINS CONCEPT PIPELINES
A set of tasks that trigger when an event occurs
eg on git commit
Implemented via a text file that defines a suite of tasks required by your software dev process
Each step calls a plug-in that does the task
By convention the file is usually called Jenkinsfile
LOG INTO YOUR TEAM REPO ON GITHUBCCSNEUEDU
This should be something along of the lines of
TASK-1 httpsgithubccsneueducs5500-fseTeam-X-su20 where X is your team number Or browse to httpsgithubccsneuedu and select the team repo from the Repositories you contribute to submenu
TASK-2 Please edit your teams READMEmd and add your Khoury-usernames Create a pull-request once you have added all your usernames We will use this information to add you as collaborators and turn your repos private
TASK-2 At the same time have another team member navigate to Jenkins
httpswww5500jenkins-1khourycloudcomjobFSEjobteam-x-su20jobmaster where X is your team number
You will be able to follow along once you open your PR request and Jenkins tries to build it
We have already provided a JenkinsfileYou should NOT edit the Jenkinsfile
This file may be updated by the course admins without notice or warning
If you have an idea for something cool for your pipeline please see the course admins
LOG INTO YOUR TEAM SLACK CHANNEL ON CS5500-SP2020SLACKCOM
You should have gotten an invite on your husky account
TASK-1 Log into httpsnortheasternuhqslackcom
TASK-2 Find the channel belonging to your Team-X where X and add yourself as a member
We will turn your channels private once all members have joined
PIPELINE TERMS
Step
A single task that defines an action
Example compile code
Node
A container for steps that Jenkins uses to manage its run queue
A workspace where Jenkins does work on files pulled from source control
Stage
A named set of steps
Stages
A set of Stage
Post
Wrap-up activities
Agent
Where the pipeline will run
Environment
Where you may define environment variables
A STANDARD USE CASE
1 Build the system
2 Test the system
3 Save the results
4 Let everyone know the results
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn ndashf
someawesomepath clean
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
JENKINS
Open source automation server
Written in Java
Integrates via plug-ins
Git
Puppetchef
Selenium
Mavenhellip
We use it to automate building testing reporting and deployment of the code
KEY JENKINS CONCEPT PIPELINES
A set of tasks that trigger when an event occurs
eg on git commit
Implemented via a text file that defines a suite of tasks required by your software dev process
Each step calls a plug-in that does the task
By convention the file is usually called Jenkinsfile
LOG INTO YOUR TEAM REPO ON GITHUBCCSNEUEDU
This should be something along of the lines of
TASK-1 httpsgithubccsneueducs5500-fseTeam-X-su20 where X is your team number Or browse to httpsgithubccsneuedu and select the team repo from the Repositories you contribute to submenu
TASK-2 Please edit your teams READMEmd and add your Khoury-usernames Create a pull-request once you have added all your usernames We will use this information to add you as collaborators and turn your repos private
TASK-2 At the same time have another team member navigate to Jenkins
httpswww5500jenkins-1khourycloudcomjobFSEjobteam-x-su20jobmaster where X is your team number
You will be able to follow along once you open your PR request and Jenkins tries to build it
We have already provided a JenkinsfileYou should NOT edit the Jenkinsfile
This file may be updated by the course admins without notice or warning
If you have an idea for something cool for your pipeline please see the course admins
LOG INTO YOUR TEAM SLACK CHANNEL ON CS5500-SP2020SLACKCOM
You should have gotten an invite on your husky account
TASK-1 Log into httpsnortheasternuhqslackcom
TASK-2 Find the channel belonging to your Team-X where X and add yourself as a member
We will turn your channels private once all members have joined
PIPELINE TERMS
Step
A single task that defines an action
Example compile code
Node
A container for steps that Jenkins uses to manage its run queue
A workspace where Jenkins does work on files pulled from source control
Stage
A named set of steps
Stages
A set of Stage
Post
Wrap-up activities
Agent
Where the pipeline will run
Environment
Where you may define environment variables
A STANDARD USE CASE
1 Build the system
2 Test the system
3 Save the results
4 Let everyone know the results
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn ndashf
someawesomepath clean
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
KEY JENKINS CONCEPT PIPELINES
A set of tasks that trigger when an event occurs
eg on git commit
Implemented via a text file that defines a suite of tasks required by your software dev process
Each step calls a plug-in that does the task
By convention the file is usually called Jenkinsfile
LOG INTO YOUR TEAM REPO ON GITHUBCCSNEUEDU
This should be something along of the lines of
TASK-1 httpsgithubccsneueducs5500-fseTeam-X-su20 where X is your team number Or browse to httpsgithubccsneuedu and select the team repo from the Repositories you contribute to submenu
TASK-2 Please edit your teams READMEmd and add your Khoury-usernames Create a pull-request once you have added all your usernames We will use this information to add you as collaborators and turn your repos private
TASK-2 At the same time have another team member navigate to Jenkins
httpswww5500jenkins-1khourycloudcomjobFSEjobteam-x-su20jobmaster where X is your team number
You will be able to follow along once you open your PR request and Jenkins tries to build it
We have already provided a JenkinsfileYou should NOT edit the Jenkinsfile
This file may be updated by the course admins without notice or warning
If you have an idea for something cool for your pipeline please see the course admins
LOG INTO YOUR TEAM SLACK CHANNEL ON CS5500-SP2020SLACKCOM
You should have gotten an invite on your husky account
TASK-1 Log into httpsnortheasternuhqslackcom
TASK-2 Find the channel belonging to your Team-X where X and add yourself as a member
We will turn your channels private once all members have joined
PIPELINE TERMS
Step
A single task that defines an action
Example compile code
Node
A container for steps that Jenkins uses to manage its run queue
A workspace where Jenkins does work on files pulled from source control
Stage
A named set of steps
Stages
A set of Stage
Post
Wrap-up activities
Agent
Where the pipeline will run
Environment
Where you may define environment variables
A STANDARD USE CASE
1 Build the system
2 Test the system
3 Save the results
4 Let everyone know the results
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn ndashf
someawesomepath clean
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
LOG INTO YOUR TEAM REPO ON GITHUBCCSNEUEDU
This should be something along of the lines of
TASK-1 httpsgithubccsneueducs5500-fseTeam-X-su20 where X is your team number Or browse to httpsgithubccsneuedu and select the team repo from the Repositories you contribute to submenu
TASK-2 Please edit your teams READMEmd and add your Khoury-usernames Create a pull-request once you have added all your usernames We will use this information to add you as collaborators and turn your repos private
TASK-2 At the same time have another team member navigate to Jenkins
httpswww5500jenkins-1khourycloudcomjobFSEjobteam-x-su20jobmaster where X is your team number
You will be able to follow along once you open your PR request and Jenkins tries to build it
We have already provided a JenkinsfileYou should NOT edit the Jenkinsfile
This file may be updated by the course admins without notice or warning
If you have an idea for something cool for your pipeline please see the course admins
LOG INTO YOUR TEAM SLACK CHANNEL ON CS5500-SP2020SLACKCOM
You should have gotten an invite on your husky account
TASK-1 Log into httpsnortheasternuhqslackcom
TASK-2 Find the channel belonging to your Team-X where X and add yourself as a member
We will turn your channels private once all members have joined
PIPELINE TERMS
Step
A single task that defines an action
Example compile code
Node
A container for steps that Jenkins uses to manage its run queue
A workspace where Jenkins does work on files pulled from source control
Stage
A named set of steps
Stages
A set of Stage
Post
Wrap-up activities
Agent
Where the pipeline will run
Environment
Where you may define environment variables
A STANDARD USE CASE
1 Build the system
2 Test the system
3 Save the results
4 Let everyone know the results
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn ndashf
someawesomepath clean
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
LOG INTO YOUR TEAM SLACK CHANNEL ON CS5500-SP2020SLACKCOM
You should have gotten an invite on your husky account
TASK-1 Log into httpsnortheasternuhqslackcom
TASK-2 Find the channel belonging to your Team-X where X and add yourself as a member
We will turn your channels private once all members have joined
PIPELINE TERMS
Step
A single task that defines an action
Example compile code
Node
A container for steps that Jenkins uses to manage its run queue
A workspace where Jenkins does work on files pulled from source control
Stage
A named set of steps
Stages
A set of Stage
Post
Wrap-up activities
Agent
Where the pipeline will run
Environment
Where you may define environment variables
A STANDARD USE CASE
1 Build the system
2 Test the system
3 Save the results
4 Let everyone know the results
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn ndashf
someawesomepath clean
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
PIPELINE TERMS
Step
A single task that defines an action
Example compile code
Node
A container for steps that Jenkins uses to manage its run queue
A workspace where Jenkins does work on files pulled from source control
Stage
A named set of steps
Stages
A set of Stage
Post
Wrap-up activities
Agent
Where the pipeline will run
Environment
Where you may define environment variables
A STANDARD USE CASE
1 Build the system
2 Test the system
3 Save the results
4 Let everyone know the results
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn ndashf
someawesomepath clean
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
A STANDARD USE CASE
1 Build the system
2 Test the system
3 Save the results
4 Let everyone know the results
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn ndashf
someawesomepath clean
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn ndashf
someawesomepath clean
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
BUILD STAGE EXAMPLE
pipeline
agent any
stages
stage(Build)
steps
sh mvn clean
The step sh means do shell step and assumes
this step is being run on a linux machine (You
would use bat if this is running on a windows machine)
This invokes mvn (maven) and will only continue
if the command returns a zero exit code
Any non-zero exit code will fail the Pipeline
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
Stage(Build)
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
TEST STAGE EXAMPLE
Jenkinsfile
pipeline
agent any
stages
stage(Test)
steps
`make check` returns non-zero on test failures
using `true` to allow the Pipeline to continue
nonetheless
sh mvn test || true
junit targetxml
This invokes mvn with parameter test
See httpmavenapacheorgsurefiremaven-surefire-
pluginexamplessingle-testhtml for more about using
maven to invoke unit tests
The || true insures the pipeline will continue to
the next step Here we want to run junit to
generate a report using files that match the
regex
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
POST SECTION
Defines actions run at the end of the Pipeline run or stage depending on what happens in the pipeline
Always Run regardless of the completion status of the Pipeline run
Changed Only run if the current Pipeline run has a different status from the previously completed Pipeline
Failure Only run if the current Pipeline has a failed status
Success Only run if the current Pipeline has a success status
Unstable Only run if the current Pipeline has an unstable status usually caused by test failures code violations etc
Aborted Only run if the current Pipeline has an aborted status usually due to the Pipeline being manually aborted
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job finishes successfully send a note to everyone on slack
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
POST EXAMPLE
post
success
slackSend (color 00FF00 message SUCCESSFUL Job
$envJOB_NAME)
failure
slackSend (color FF0000 message FAILED Job
$envJOB_NAME
If the Jenkins job fails for any reason send a note to everyone on slack
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
CURRENT JENKINSFILE
pipeline
environment
jobBaseName = $envJOB_NAMEsplit()first()
options
timeout(time 10 unit MINUTES)
option
agent none
stages
stage(Build and Test)
when
not
branch master
agent
docker
image maven3-alpine
args -v m2_reposrootm2
docker
agent
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
COMPILING YOUR CODE
stages
stage(Build)
steps
echo Building Chatter
sh mvn -f DevelopmentChatterpomxml install
echo Building Prattle
sh mvn -f DevelopmentPrattlepomxml compile
build
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
QUALITY FOCUSED STAGES IN CURRENT JENKINSFILE
stage(SonarQube)
when
not
branch master
steps
withSonarQubeEnv(SonarQube)
sh mvn -f DevelopmentPrattlepomxml clean install
sh mvn -f DevelopmentPrattlepomxml sonarsonar -DsonarprojectKey=$jobBaseName -
DsonarprojectName=$jobBaseName
sh sleep 30
timeout(time 10 unit SECONDS)
retry(5)
script
def qg = waitForQualityGate()
if (qgstatus = OK)
error Pipeline aborted due to quality gate failure $qgstatus
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
DEPLOYMENT STEP
stage(Master Branch Tasks) when branch master
agent anysteps echo Building Prattlesh mvn -f DevelopmentPrattlepomxml package -Dmaventestskip=true
script def json = readJSON fileconfigjsonsh cd $WORKSPACEsh chmod 400 $jsonserver[0]PEMsh scp -oStrictHostKeyChecking=no -i $jsonserver[0]PEM
DevelopmentPrattletarget$jsonserver[0]JARNAME $jsonserver[0]user$jsonserver[0]DNS$jsonserver[0]directory
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS pkill java amp
sh ssh -oStrictHostKeyChecking=no -i $jsonserver[0]PEM $jsonserver[0]user$jsonserver[0]DNS nohup java -jar $jsonserver[0]directory$jsonserver[0]JARNAME gtnohupout 2gtamp1 amp
script
STAGES
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
SLACK INTEGRATION
post
success
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color 00FF00 message
SUCCESSFUL Job $envJOB_NAME)
failure
slackSend (baseUrl httpsnu-cs5500slackcomserviceshooksjenkins-
ci token mVqPcmW02ZFbXE7lwaapIaCb channel team-X color FF0000 message
FAILED Job $envJOB_NAME)
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
SO HOW DO WE SUBMIT CODE TO OUR REPO
Before doing any new work make sure to create a new branch
git checkout ndashb ldquoname_of_branchrdquo
Once the code works you push the branch to GitHub
As master is protected you will have to create a pull request
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
CREATING A PULL REQUEST
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
WHY WE USE PULL REQUESTS
Master is a protected branch and should only have reviewed and tested code
Unlike your personal repo you cannot merge code into master directly
ldquoPull requests let you tell others about changes youve pushed to a branch in a repository on GitHub Once a pull request is opened you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the masterrdquo -helpgithubcom
Learn more at httpshelpgithubcomarticlesabout-pull-requests
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
AFTER SUBMITTING THE PULL REQUEST
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
TEAMMATE REVIEW OF THE PULL REQUEST
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
TEAMMATE NEEDS TO APPROVE OR REJECT
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
TEAMMATE NEEDS TO APPROVE OR REJECT
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
CAN WE MERGE YET
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
JENKINSFILE IN ACTION
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
WHY IS IT RED
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
SONARQUBE REPORT
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
PLEASE LOG INTO SONARQUBE
All team members should log into SonarQube
http5500sonar-1khourycloudcom
Username khoury-username
Password Mikersquos Password
Please now go to accountsecurity and change your password
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
SONARQUBE FAILED ndash WHAT DO YOU NEED TO DO
Review the SonarQube report in detail
Anything in blue or blue-underline is a link and can be clicked for more information
We have to go back to our IDE and resolve any issues flagged by SonarQube
You will have to push your fix to your branch and GitHub will require
A new teammate review
Jenkins to re-run
Please do not create a new branch trying to fix code on another branch Things will get complicated
quickly
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
PULL REQUEST OVERVIEW ndashEVERYTHING GREEN ABLE TO MERGE
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
BRANCH MERGED
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom
REMEMBER
http5500sonar-1 khourycloudcom
http5500jenkins-1khourycloudcom