-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
82 lines (74 loc) · 4.06 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
pipeline {
agent {
node {
label 'master'
customWorkspace 'C:\\Jenkins\\workspace\\SDR\\SDR_V1.0\\NodeAPiPipeline'
}
}
stages {
stage('Preparation') { // for display purposes
steps {
git(
url: '[email protected]:emersonprocess/FIELD-SERVICE-API.git',
credentialsId: '9796d75e-de18-4c12-b5c1-b83c21b0aed5',
branch: "${gitBranch}"
)
}
}
stage('Build') {
steps {
echo "Git checkout has been completed"
echo 'workspace location `$WORKSPACE` ${pwd} $ENV:WORKSPACE'
}
}
stage('Get Node modules') {
steps {
echo "Installation of node modules"
bat 'cd .\\FieldServiceAPINode && npm install'
echo "Node modules have been added Successfully"
}
}
stage('Code analysis') {
steps {
echo "Code analysis"
writeFile file: "sonar-project.properties", text: """
sonar.projectKey=emerson:nodejs:fieldServiceApi
sonar.projectName=fieldServiceNodeApi
sonar.projectVersion=1.0
sonar.sources=FieldServiceAPINode
"""
script {
sonarScanner = tool 'SonarScanner';
}
withSonarQubeEnv('SonarQube') {
bat "${sonarScanner}\\bin\\sonar-scanner.bat -X"
}
}
}
stage('Creating Archive') {
steps {
bat '''set src=.\\FieldServiceAPINode
set Dest=.\\ApiNodeArchive\\EmersonDbcsApi-v1.0.zip
IF EXIST %Dest% (
del %Dest%
) ELSE (
echo file missing.
)
"C:\\Program Files\\7-Zip\\7z.exe" a .\\ApiNodeArchive\\EmersonApi.zip .\\FieldServiceAPINode\\*'''
}
}
stage('Upload Archives to ObjectStorage') {
steps {
bat 'echo "Git checkout has been completed"'
bat 'echo "Git checkout has been completed"'
bat 'C:\\curl-7.61.0-win64-mingw\\bin\\curl.exe -i -X PUT -H "X-Auth-Token: AUTH_tk48d17783bf273befd8817ec62be9992d" https://a472144.us.storage.oraclecloud.com/v1/Storage-a472144/%containerName%/EmersonDbcsApi-v1.zip -T .\\ApiNodeArchive\\EmersonApi.zip'
}
}
stage('Update Archives to AccS Instance') {
steps {
bat 'echo "Git checkout has been completed"'
bat 'C:\\curl-7.61.0-win64-mingw\\bin\\curl.exe -X PUT -u [email protected]:PASSWORD -H "X-ID-TENANT-NAME:a472144" -H "Content-Type: multipart/form-data" -F "manifest=@C:\\Jenkins\\workspace\\SDR\\SDR_V1.0\\NodeAPiPipeline\\manifest.json" -F "archiveURL=%containerName%/EmersonDbcsApi-v1.zip" -F "notes=Emerson Node Api Deployment Instance" https://apaas.us.oraclecloud.com/paas/service/apaas/api/v1.1/apps/a472144/%AccSInstanceName%'
}
}
}
}