-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
61 lines (53 loc) · 1.61 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
pipeline {
agent {
node {
label 'master'
}
}
triggers {
upstream(upstreamProjects: 'psikon-org/psistats/master', threshold: hudson.model.Result.SUCCESS)
}
libraries {
lib('psikon-jenkins-aptly@master')
lib('psikon-jenkins-mailer@master')
}
stages {
stage('Publish') {
steps {
script {
def causes = currentBuild.getBuildCauses()
causes.each {
if (it._class == 'hudson.model.Cause$UpstreamCause') {
def projectName = it.upstreamProject;
def buildNumber = it.upstreamBuild;
echo "Triggered by ${projectName}:${buildNumber}"
copyArtifacts(
filter: '**/*.deb',
projectName: projectName,
selector: specific(buildNumber.toString()),
flatten: true,
target: 'target/artifacts'
)
def debs = findFiles glob: 'target/artifacts/*.deb'
debs.each { deb ->
echo "Publishing debian file: $deb"
publishDeb component: 'testing', distribution: 'psikon', debFile: deb, repoName: 'psikon-testing'
}
} else {
echo "Not triggered by upstream build. We can ignore"
}
}
}
echo "${currentBuild.buildCauses}"
}
}
}
post {
success {
psikonMailer(currentBuild, env)
}
failure {
psikonMailer(currentBuild, env)
}
}
}