-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathJenkinsfile.windows
89 lines (85 loc) · 4.57 KB
/
Jenkinsfile.windows
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
pipeline {
agent any
parameters {
/* These values would be better moved to a configuration file and provided by */
/* the Config File Provider plugin (or equivalent), but this is good enough */
/* for a demo of ACE pipelines that isn't intended as a Jenkins tutorial. */
string(name: 'databaseName', defaultValue: 'BLUDB', description: 'JDBC database name')
string(name: 'serverName', defaultValue: '19af6446-6171-4641-8aba-9dcff8e1b6ff.c1ogj3sd0tgtu0lqde00.databases.appdomain.cloud', description: 'JDBC database host')
string(name: 'portNumber', defaultValue: '30699', description: 'JDBC database port')
string(name: 'integrationNodeHost', defaultValue: '10.0.0.2', description: 'Integration node REST API host or IP address')
string(name: 'integrationNodePort', defaultValue: '4414', description: 'Integration node REST API port')
string(name: 'integrationServerName', defaultValue: 'default', description: 'Integration server name')
}
environment {
ACE_COMMAND = "C:\\Program Files\\IBM\\ACE\\13.0.1.0\\ace"
CT_JDBC = credentials('CT_JDBC')
}
stages {
stage('Build and UT') {
steps {
bat '''
dir /o:d
IF EXIST "%TEMP%\\ace-server" (
rmdir /q /s %TEMP%\\ace-server
)
IF EXIST "junit-reports" (
rmdir /q /s junit-reports
)
CALL "%ACE_COMMAND%" mqsicreateworkdir %TEMP%\\ace-server
CALL "%ACE_COMMAND%" ibmint deploy --input-path . --output-work-directory %TEMP%\\ace-server --project TeaSharedLibraryJava --project TeaSharedLibrary --project TeaRESTApplication --project TeaRESTApplication_UnitTest
CALL "%ACE_COMMAND%" ibmint optimize server --work-dir %TEMP%\\ace-server --disable NodeJS
CALL "%ACE_COMMAND%" IntegrationServer -w %TEMP%\\ace-server --test-project TeaRESTApplication_UnitTest --test-junit-options --reports-dir=junit-reports
'''
}
post {
always {
junit '**/junit-reports/TEST*.xml'
}
}
}
stage('Test DB interactions') {
steps {
bat '''
mkdir %TEMP%\\ace-server\\run\\CTPolicies
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ns2:policyProjectDescriptor xmlns=\"http://com.ibm.etools.mft.descriptor.base\" xmlns:ns2=\"http://com.ibm.etools.mft.descriptor.policyProject\"><references/></ns2:policyProjectDescriptor>" > %TEMP%\\ace-server\\run\\CTPolicies\\policy.descriptor
echo.Defaults: > %TEMP%\\ace-server\\overrides\\server.conf.yaml
echo. policyProject: CTPolicies >> %TEMP%\\ace-server\\overrides\\server.conf.yaml
CALL "%ACE_COMMAND%" mqsisetdbparms -w %TEMP%\\ace-server -n jdbc::tea -u %CT_JDBC_USR% -p %CT_JDBC_PSW%
'''
bat "powershell -Command \"get-content demo-infrastructure\\TEAJDBC.policyxml | %%{\$_ -replace \\\"DATABASE_NAME\\\",\\\"${params.databaseName}\\\"} | %%{\$_ -replace \\\"SERVER_NAME\\\",\\\"${params.serverName}\\\"} | %%{\$_ -replace \\\"PORT_NUMBER\\\",\\\"${params.portNumber}\\\"}\" > %TEMP%\\ace-server\\run\\CTPolicies\\TEAJDBC.policyxml"
bat '''
type %TEMP%\\ace-server\\run\\CTPolicies\\TEAJDBC.policyxml
IF EXIST "%TEMP%\\ace-server\\run\\TeaRESTApplication_ComponentTest" (
rmdir /q /s %TEMP%\\ace-server\\run\\TeaRESTApplication_ComponentTest
)
IF EXIST "junit-reports" (
rmdir /q /s junit-reports
)
CALL "%ACE_COMMAND%" ibmint deploy --input-path . --output-work-directory %TEMP%\\ace-server --project TeaRESTApplication_ComponentTest
CALL "%ACE_COMMAND%" IntegrationServer -w %TEMP%\\ace-server --test-project TeaRESTApplication_ComponentTest --test-junit-options --reports-dir=junit-reports
'''
}
post {
always {
junit '**/junit-reports/TEST*.xml'
}
}
}
stage('Next stage BAR build') {
steps {
bat '''
IF EXIST "tea-application-combined.bar" (
del /q tea-application-combined.bar
)
CALL "%ACE_COMMAND%" ibmint package --input-path . --output-bar-file tea-application-combined.bar --project TeaSharedLibraryJava --project TeaSharedLibrary --project TeaRESTApplication
'''
}
}
stage('Next stage deploy') {
steps {
bat "CALL \"%ACE_COMMAND%\" mqsideploy -i ${params.integrationNodeHost} -p ${params.integrationNodePort} -e ${params.integrationServerName} -a tea-application-combined.bar"
}
}
}
}