-
Notifications
You must be signed in to change notification settings - Fork 28
/
Jenkinsfile
52 lines (49 loc) · 1.02 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
pipeline {
environment {
REGISTRY_ENDPOINT = "https://registry.cn-hangzhou.aliyuncs.com/v2/"
IMAGE_WITH_TAG = "registry.cn-hangzhou.aliyuncs.com/ringtail/lucas:0.0.1"
REGISTRY_CERTS = "registry"
}
agent {
node {
label 'golang'
}
}
stages {
stage('Build') {
steps {
sh 'go build -o app'
}
}
stage('Test') {
steps {
sh 'go test'
}
}
stage('Code Quality') {
steps {
script {
try{
checkstyle canComputeNew: false, defaultEncoding: '', healthy: '', pattern: '', unHealthy: ''
}catch(e){
echo e
}
}
}
}
stage('Image Build&Publish') {
steps {
echo 'Build Images'
script {
docker.withRegistry("${REGISTRY_ENDPOINT}", "${REGISTRY_CERTS}") {
sh 'docker build -t ${IMAGE_WITH_TAG} .'
sh 'docker push ${IMAGE_WITH_TAG}'
}
}
}
}
}
triggers {
pollSCM('* * * * *')
}
}