-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathJenkinsfile
164 lines (134 loc) · 4.7 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
pipeline {
agent any
// Environment Variables
environment {
MAJOR = '1'
MINOR = '1'
//Orchestrator Services
UIPATH_ORCH_URL = "https://cloud.uipath.com/"
UIPATH_ORCH_LOGICAL_NAME = "anupaminc"
UIPATH_ORCH_TENANT_NAME = "Descriptify"
UIPATH_ORCH_FOLDER_NAME = "Default"
}
stages {
// Printing Basic Information
stage('Preparing'){
steps {
echo "Jenkins Home ${env.JENKINS_HOME}"
echo "Jenkins URL ${env.JENKINS_URL}"
echo "Jenkins JOB Number ${env.BUILD_NUMBER}"
echo "Jenkins JOB Name ${env.JOB_NAME}"
echo "GitHub BranchName ${env.BRANCH_NAME}"
checkout scm
}
}
// Building Tests
stage('Build Tests') {
steps {
echo "Building package with ${WORKSPACE}"
UiPathPack (
outputPath: "Output\\Tests\${env.BUILD_NUMBER}",
outputType: 'Tests',
projectJsonPath: "project.json",
version: [$class: 'ManualVersionEntry', version: "${MAJOR}.${MINOR}.${env.BUILD_NUMBER}"],
useOrchestrator: false,
traceLevel: 'None'
)
}
}
// Deploy Stages
stage('Deploy Tests') {
steps {
echo "Deploying ${BRANCH_NAME} to orchestrator"
UiPathDeploy (
packagePath: "Output\\Tests\${env.BUILD_NUMBER}",
orchestratorAddress: "${UIPATH_ORCH_URL}",
orchestratorTenant: "${UIPATH_ORCH_TENANT_NAME}",
folderName: "${UIPATH_ORCH_FOLDER_NAME}",
environments: 'INT',
//credentials: [$class: 'UserPassAuthenticationEntry', credentialsId: 'APIUserKey']
credentials: Token(accountName: "${UIPATH_ORCH_LOGICAL_NAME}", credentialsId: 'APIUserKey'),
traceLevel: 'None',
entryPointPaths: 'Main.xaml'
)
}
}
// Test Stages
stage('Perform Tests') {
steps {
echo 'Testing the workflow...'
UiPathTest (
testTarget: [$class: 'TestSetEntry', testSet: "AnnounceFavouriteSinger_Tests"],
orchestratorAddress: "${UIPATH_ORCH_URL}",
orchestratorTenant: "${UIPATH_ORCH_TENANT_NAME}",
folderName: "${UIPATH_ORCH_FOLDER_NAME}",
timeout: 10000,
traceLevel: 'None',
testResultsOutputPath: "result.xml",
//credentials: [$class: 'UserPassAuthenticationEntry', credentialsId: "credentialsId"]
credentials: Token(accountName: "${UIPATH_ORCH_LOGICAL_NAME}", credentialsId: 'APIUserKey'),
parametersFilePath: ''
)
}
}
// Building Package
stage('Build Process') {
when {
expression {
currentBuild.result == null || currentBuild.result == 'SUCCESS'
}
}
steps {
echo "Building package with ${WORKSPACE}"
UiPathPack (
outputPath: "Output\\${env.BUILD_NUMBER}",
projectJsonPath: "project.json",
version: [$class: 'ManualVersionEntry', version: "${MAJOR}.${MINOR}.${env.BUILD_NUMBER}"],
useOrchestrator: false,
traceLevel: 'None'
)
}
}
// Deploy to Production Step
stage('Deploy Process') {
when {
expression {
currentBuild.result == null || currentBuild.result == 'SUCCESS'
}
}
steps {
echo 'Deploying process to orchestrator...'
UiPathDeploy (
packagePath: "Output\\${env.BUILD_NUMBER}",
orchestratorAddress: "${UIPATH_ORCH_URL}",
orchestratorTenant: "${UIPATH_ORCH_TENANT_NAME}",
folderName: "${UIPATH_ORCH_FOLDER_NAME}",
environments: 'INT',
//credentials: [$class: 'UserPassAuthenticationEntry', credentialsId: 'APIUserKey']
credentials: Token(accountName: "${UIPATH_ORCH_LOGICAL_NAME}", credentialsId: 'APIUserKey'),
traceLevel: 'None',
entryPointPaths: 'Main.xaml'
)
}
}
}
// Options
options {
// Timeout for pipeline
timeout(time:80, unit:'MINUTES')
skipDefaultCheckout()
}
//
post {
success {
echo 'Deployment has been completed!'
}
failure {
echo "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.JOB_DISPLAY_URL})"
}
always {
/* Clean workspace if success */
cleanWs()
}
}
}