-
Notifications
You must be signed in to change notification settings - Fork 76
/
Jenkinsfile-jira-deploy-to-stage
36 lines (32 loc) · 1.21 KB
/
Jenkinsfile-jira-deploy-to-stage
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
def component = ''
def version = ''
@Library('shared-library') _
pipeline {
agent none
triggers {
eventTrigger jmespathQuery("event=='deploy-to-stage'")
}
stages {
stage('Example') {
agent any
when {
triggeredBy "EventTriggerCause"
beforeAgent true
}
steps {
echo "****************************************"
echo "The class type that triggered this run: " + currentBuild?.getBuildCauses()[0]?._class?.toString()
echo "****************************************"
echo "****************************************"
echo "The full message received:"
echo groovy.json.JsonOutput.prettyPrint(currentBuild?.getBuildCauses()?.toString())
echo "****************************************"
script {
component = currentBuild.getBuildCauses()[0]?.event?.component?.toString()
version = currentBuild.getBuildCauses()[0]?.event?.version?.toString()
}
sh "echo deploy-to-stage for $component:$version"
}
}
}
}