forked from yeka/zip
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
65 lines (59 loc) · 2.27 KB
/
Copy pathJenkinsfile
File metadata and controls
65 lines (59 loc) · 2.27 KB
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
56
57
58
59
60
61
62
63
64
65
pipeline {
agent any
options {
timestamps()
timeout(time: 3600, unit: 'SECONDS')
}
environment{
BUILD_PATH="/home/jenkins/gopath/src/github.com/cloudtrust/zip"
}
stages {
stage('Build') {
agent {
label 'jenkins-slave-go-ct'
}
steps {
script {
sh 'printenv'
def isBranch = ""
if (!env.CHANGE_ID) {
isBranch = " || true"
}
withCredentials([usernamePassword(credentialsId: 'sonarqube', usernameVariable: 'USER', passwordVariable: 'PASS')]) {
sh """
set -eo pipefail
mkdir -p "${BUILD_PATH}"
cp -r "${WORKSPACE}/." "${BUILD_PATH}/"
cd "${BUILD_PATH}"
golint ./... | tee golint.out || true
dep init
go test -coverprofile=coverage.out -json ./... | tee report.json
go tool cover -func=coverage.out
bash -c \"go vet ./... > >(cat) 2> >(tee govet.out)\" || true
gometalinter --vendor --disable=gotype --disable=golint --disable=vet --disable=gocyclo --exclude=/usr/local/go/src --deadline=300s ./... | tee gometalinter.out || true
nancy -no-color Gopkg.lock || true
JAVA_TOOL_OPTIONS="" sonar-scanner \
-Dsonar.host.url=https://sonarqube-cloudtrust-cicd.apps.okd-pp.west.ch.elca-cloud.com \
-Dsonar.login="${USER}" \
-Dsonar.password="${PASS}" \
-Dsonar.sourceEncoding=UTF-8 \
-Dsonar.projectKey=zip \
-Dsonar.projectName=zip \
-Dsonar.projectVersion="${env.GIT_COMMIT}" \
-Dsonar.sources=. \
-Dsonar.exclusions=**/*_test.go,**/vendor/**,**/mock/** \
-Dsonar.tests=. \
-Dsonar.test.inclusions=**/*_test.go \
-Dsonar.test.exclusions=**/vendor/** \
-Dsonar.go.coverage.reportPaths=./coverage.out \
-Dsonar.go.tests.reportPaths=./report.json \
-Dsonar.go.govet.reportPaths=./govet.out \
-Dsonar.go.golint.reportPaths=./golint.out \
-Dsonar.go.gometalinter.reportPaths=./gometalinter.out ${isBranch}
"""
}
}
}
}
}
}