-
Notifications
You must be signed in to change notification settings - Fork 0
/
scenarios
44 lines (38 loc) · 1.26 KB
/
scenarios
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
// Define variables
def SCENARIO = ''
def BRANCH = env.BRANCH_NAME
def MANUAL_TRIGGER = false
def SCHEDULED_TRIGGER = false
def TAG_ID = ''
// Check for scenario 1
if (BRANCH == 'develop') {
SCENARIO = 'Scenario 1'
}
// Check for scenario 2
if (BRANCH == 'release') {
SCENARIO = 'Scenario 2'
}
// Check for scenario 3
if (BRANCH != 'develop' && BRANCH != 'release') {
SCENARIO = 'Scenario 3'
}
// Check for manual trigger
if (params.TAG_ID) {
SCENARIO = 'Manual Trigger - Target Tag'
TAG_ID = params.TAG_ID
MANUAL_TRIGGER = true
} else if (currentBuild.currentResult == 'SUCCESS' && currentBuild.getBuildCauses('hudson.timer.TimerTriggerCause').size() > 0) {
SCENARIO = 'Scenario 5'
SCHEDULED_TRIGGER = true
} else if (env.CHANGE_ID) {
SCENARIO = 'Scenario 4'
} else if (env.CAUSE_USER_ID) {
SCENARIO = 'Manual Trigger - New Build'
MANUAL_TRIGGER = true
}
// Print the scenario and trigger information
echo "SCENARIO: ${SCENARIO}"
echo "MANUAL_TRIGGER: ${MANUAL_TRIGGER}"
echo "TAG_ID: ${TAG_ID}"
echo "SCHEDULED_TRIGGER: ${SCHEDULED_TRIGGER}"
// Add your pipeline stages and steps here...