forked from DODAS-TS/rclone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
77 lines (70 loc) · 1.88 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
def getReleaseVersion(String tagName) {
if (tagName) {
return tagName.replaceAll(/^v/, '')
} else {
return null
}
}
pipeline {
agent none
environment {
// Set RELEASE_VERSION only if TAG_NAME is set
RELEASE_VERSION = getReleaseVersion(TAG_NAME)
}
stages {
stage('Cleanup Workspace') {
agent {
node { label 'jenkinsworker00' }
}
options { skipDefaultCheckout() }
steps {
cleanWs()
}
}
stage('Build') {
agent {
docker {
label 'jenkinsworker00'
image 'harbor.cloud.infn.it/jenkins-ci/go1.21.0:main'
reuseNode true
}
}
steps {
script {
sh '''
export GOCACHE=$WORKSPACE/.cache/go-build
export GOPATH=$WORKSPACE/go
make build
mv $GOPATH/bin/rclone $WORKSPACE/rclone_linux
'''
}
}
}
stage('Upload to Nexus'){
when { tag "v*" }
agent {
node { label 'jenkinsworker00' }
}
options { skipDefaultCheckout() }
steps{
nexusArtifactUploader(
nexusVersion: 'nexus3',
protocol: 'https',
nexusUrl: 'repo.cloud.cnaf.infn.it',
version: RELEASE_VERSION,
repository: 'rclone',
groupId: '',
credentialsId: 'nexus-credentials',
artifacts: [
[ artifactId: 'rclone-linux', type: '', classifier: '', file: "rclone_linux" ],
]
)
}
post {
always {
cleanWs()
}
}
}
}
}