forked from RedHatInsights/insights-results-aggregator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
77 lines (57 loc) · 2.26 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
@Library("github.com/RedHatInsights/insights-pipeline-lib@v3") _
node {
pipelineUtils.cancelPriorBuilds()
pipelineUtils.runIfMasterOrPullReq {
runStages()
}
}
def runStages() {
openShiftUtils.withNode(yaml: "ci/jenkins_slave_pod_template.yaml") {
checkout scm
gitUtils.stageWithContext("Style", shortenURL = false) {
styleStatus = sh(script: "make fmt vet lint cyclo shellcheck errcheck goconst gosec ineffassign abcgo", returnStatus: true)
if (styleStatus != 0) {
error("Style check failed")
}
}
}
openShiftUtils.withNode(image: "registry.access.redhat.com/rhscl/python-36-rhel7") {
checkout scm
gitUtils.stageWithContext("JSON", shortenURL = false) {
jsonCheckStatus = sh(script: "make json-check", returnStatus: true)
if (jsonCheckStatus != 0) {
error("Json check failed")
}
}
}
openShiftUtils.withNode(image: "openapitools/openapi-generator-cli") {
checkout scm
gitUtils.stageWithContext("OpenAPI", shortenURL = false) {
openapiCheckStatus = sh(script: "docker-entrypoint.sh validate -i openapi.json", returnStatus: true)
if (openapiCheckStatus != 0) {
error("OpenAPI check failed")
}
}
}
openShiftUtils.withNode(yaml: "ci/jenkins_slave_pod_template.yaml") {
checkout scm
gitUtils.stageWithContext("Unit-tests", shortenURL = false) {
unitTestsStatus = sh(script: "make test-postgres", returnStatus: true)
withEnv(["TERM=xterm"]){
sh "./check_coverage.sh"
}
withCredentials([string(credentialsId: "ira-codecov", variable: "CODECOV_TOKEN")]) {
sh "curl -s https://codecov.io/bash | bash -s -- -C ${gitUtils.getBaseCommit()}"
}
}
if (unitTestsStatus != 0) {
error("Unit tests failed")
}
gitUtils.stageWithContext("Integration-tests", shortenURL = false) {
unitTestsStatus = sh(script: "make integration_tests", returnStatus: true)
}
if (unitTestsStatus != 0) {
error("Integration tests failed")
}
}
}