forked from paroksh/govwa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce7fad1
commit 15ba02d
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |