forked from getanteon/anteon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
55 lines (48 loc) · 1.44 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
pipeline {
agent {
dockerfile {
filename 'Dockerfile.dev'
}
}
environment {
PROXY_TEST_USERNAME = credentials('proxy-test-username')
PROXY_TEST_PASSWORD = credentials('proxy-test-password')
}
options {
disableConcurrentBuilds()
}
stages {
stage('Unit Test') {
steps {
sh 'go test -coverpkg=./... -coverprofile=coverage.out ./... -timeout 100s -parallel 4'
}
}
stage('Coverage') {
steps {
sh 'go tool cover -html=coverage.out -o coverage.html'
archiveArtifacts '*.html'
sh 'echo "Coverage Report: ${BUILD_URL}artifact/coverage.html"'
sh '''t=$(go tool cover -func coverage.out | grep total | tail -1 | awk \'{print substr($3, 1, length($3)-1)}\')
if [ "${t%.*}" -lt 80 ]; then
echo "Coverage failed ${t}/80"
exit 1
fi'''
}
}
stage('Main Race Condition') {
steps {
lock('multi_branch_server') {
sh 'go run --race main.go -t https://proxytest.ddosifytech.com/ -d 1 -n 1500 -a ${PROXY_TEST_USERNAME}:${PROXY_TEST_PASSWORD} -p https'
}
}
}
}
post {
unstable {
slackSend(channel: '#jenkins', color: 'danger', message: "${currentBuild.currentResult}: ${currentBuild.fullDisplayName} - ${BUILD_URL}")
}
failure {
slackSend(channel: '#jenkins', color: 'danger', message: "${currentBuild.currentResult}: ${currentBuild.fullDisplayName} - ${BUILD_URL}")
}
}
}