forked from descriptify/UiPath_Jenkins_CICDDemo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
116 lines (89 loc) · 2.95 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
pipeline {
agent any
// Environment Variables
environment {
MAJOR = '1'
MINOR = '0'
//Orchestrator Services
UIPATH_ORCH_URL = "https://cloud.uipath.com/"
UIPATH_ORCH_LOGICAL_NAME = "persoezesypg"
UIPATH_ORCH_TENANT_NAME = "DefaultTenant"
UIPATH_ORCH_FOLDER_NAME = "Shared"
}
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 BranhName ${env.BRANCH_NAME}"
checkout scm
}
}
// Build Stages
stage('Build') {
steps {
echo "Building..with ${WORKSPACE}"
UiPathPack (
outputPath: "Output\\${env.BUILD_NUMBER}",
projectJsonPath: "project.json",
version: [$class: 'ManualVersionEntry', version: "${MAJOR}.${MINOR}.${env.BUILD_NUMBER}"],
useOrchestrator: false,
traceLevel: 'None'
)
}
}
// Test Stages
stage('Test') {
steps {
bat """
C:/Users/Shreenidhi/AppData/Local/Programs/Python/Python310/python.exe -m pytest -vv
"""
}
}
// Deploy Stages
stage('Deploy to Orechestrator') {
steps {
// echo "Deploying ${BRANCH_NAME} to UAT "
UiPathDeploy (
packagePath: "Output\\${env.BUILD_NUMBER}",
orchestratorAddress: "${UIPATH_ORCH_URL}",
orchestratorTenant: "${UIPATH_ORCH_TENANT_NAME}",
folderName: "${UIPATH_ORCH_FOLDER_NAME}",
environments: 'DEV',
//credentials: [$class: 'UserPassAuthenticationEntry', credentialsId: 'APIUserKey']
credentials: Token(accountName: "${UIPATH_ORCH_LOGICAL_NAME}", credentialsId: 'APIUserKey'),
traceLevel: 'None',
entryPointPaths: 'Main.xaml'
)
}
}
// Deploy to Production Step
stage('Deploy to Production') {
steps {
echo 'Deploy to Production'
}
}
}
// 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()
}
}
}