-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
39 lines (35 loc) · 779 Bytes
/
Jenkinsfile
File metadata and controls
39 lines (35 loc) · 779 Bytes
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
properties(
[
buildDiscarder(
logRotator(
numToKeepStr: '5'
)
)
]
)
node('go1.24') {
container('run'){
def tag = ''
stage('Checkout') {
checkout scm
tag = sh(script: 'git tag -l --contains HEAD', returnStdout: true).trim()
}
stage('Fetch dependencies') {
// using ID because: https://issues.jenkins-ci.org/browse/JENKINS-32101
sshagent(credentials: ['18270936-0906-4c40-a90e-bcf6661f501d']) {
sh('go mod download')
}
}
stage('Run test') {
sh('make test')
}
if (env.BRANCH_NAME == 'main' && tag != '') {
stage('Generate and push docker image'){
docker.withRegistry("https://quay.io", 'docker-registry') {
strippedTag = tag.replaceFirst('v', '')
sh("make push VERSION=${strippedTag}")
}
}
}
}
}