Skip to content

Commit

Permalink
Create Lab2
Browse files Browse the repository at this point in the history
  • Loading branch information
snehakokil authored Sep 25, 2019
1 parent ce7fad1 commit 15ba02d
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions Lab2
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
pipeline {
agent any
stages {
stage('Checkout'){
agent {
docker {
image 'golang'
args ' -u 0 -v ${WORKSPACE}:/go/src/govwa:rw'
}
}
steps {
git(url: 'https://github.com/snehakokil/govwa.git', branch: 'master')
stash name:'dockerfile', includes: '**/Dockerfile'
}
}//stage

stage('Build') {
agent {
docker {
image 'golang'
args ' -u 0 -v ${WORKSPACE}:/go/src/govwa:rw'

}
}
steps {

sh 'cd /go/src'
sh 'go get github.com/go-sql-driver/mysql'
sh 'go get github.com/gorilla/sessions'
sh 'go get github.com/julienschmidt/httprouter'


// Build the app.
sh 'go build'
stash name:'CompiledSource', includes:'**/**'
}
}

stage('Build-time SAST') {

agent {
docker {
image 'golang'
args ' -u 0 -v ${WORKSPACE}:/go/src/govwa:rw'

}
}
steps {

sh 'cd /go/src'
sh 'go get github.com/go-sql-driver/mysql'
sh 'go get github.com/gorilla/sessions'
sh 'go get github.com/julienschmidt/httprouter'

echo 'cloning Gosec'
sh 'curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $GOPATH/bin'
echo 'listing current folder contents for verification'
sh 'cd /go/src/govwa'
echo 'SAST running with GOSEC'
script {
def status = sh returnStatus: true, script:'gosec -fmt=json -out=results.json ./...'
echo 'printing results'

archiveArtifacts '*.json'
print "SAST scanning complete"

if(status != 0) {
input message: 'SAST results violate severity threshold. Do you want to proceed?', submitter: 'ciuser'
}
} //end script
}
}

0 comments on commit 15ba02d

Please sign in to comment.