Skip to content

Commit

Permalink
Merge a87fba5 into 5fe4569
Browse files Browse the repository at this point in the history
  • Loading branch information
vloup committed Mar 11, 2020
2 parents 5fe4569 + a87fba5 commit 0ad0ecf
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
67 changes: 67 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
pipeline {
agent any
options {
timestamps()
timeout(time: 3600, unit: 'SECONDS')
}
environment{
BUILD_PATH="/home/jenkins/gopath/src/github.com/cloudtrust/common-service"
}
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 ensure
go generate ./...
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=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.openshift.west.ch.elca-cloud.com \
-Dsonar.login="${USER}" \
-Dsonar.password="${PASS}" \
-Dsonar.sourceEncoding=UTF-8 \
-Dsonar.projectKey=common-service \
-Dsonar.projectName=common-service \
-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}
"""
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion validation/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func TestValidateParameterNotNil(t *testing.T) {
t.Run("Not nil value", func(t *testing.T) {
assert.Nil(t, NewParameterValidator().ValidateParameterNotNil("param", t).Status())
})
t.Run("Nil interface{}", func(t *testing.T) {
t.Run("Nil interface", func(t *testing.T) {
// Skip this test as it fails on the CI
t.Skip()
var s = mystruct{OneField: nil}
Expand Down

0 comments on commit 0ad0ecf

Please sign in to comment.