-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUpdateScript
59 lines (54 loc) · 2.55 KB
/
UpdateScript
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
pipeline{
agent any
parameters {
booleanParam(name: 'ActivateIntegration', defaultValue: false)
}
stages{
stage('Updating of IAR Files to OIC'){
steps {
script {
def updateIntegFileCmd = "curl -X PUT --user ${params.Username}:${params.Password} --header \"Accept:application/json\" --form \"file=@\\\"${params.IARFileName}\\\"\" --form type=application/octet-stream ${params.InstanceURL}/ic/api/integration/v1/integrations/archive"
bat(updateIntegFileCmd)
}
}
}
stage('Configuring an old connection'){
steps {
script{
bat"""
curl --user ${params.Username}:${params.Password} --header "X-HTTP-Method-Override:PATCH" --header "Content-Type:application/json" -d @${params.ConnectionFileName} ${params.InstanceURL}/ic/api/integration/v1/connections/${params.ConnectionName}
"""
}
}
}
stage('Update an old lookup') {
steps {
script {
def updateLookupCmd = "curl -X PUT --user ${params.Username}:${params.Password} -F \"file=@${params.LookupFileName}\" -F type=application/octet-stream \"${params.InstanceURL}/ic/api/integration/v1/lookups/archive\""
bat(updateLookupCmd)
}
}
}
stage('Activation of the integration') {
steps {
script {
def integName = params.Integration_Identifier.toString()
if (params.ActivateIntegration) {
// Perform action when the checkbox is checked
echo 'Checkbox is checked'
def activateIntegrationCmd = "curl --user ${params.Username}:${params.Password} --header \"Content-Type: application/json\" --header \"X-HTTP-Method-Override: PATCH\" -d @${params.ActivationJsonFile} --location \"${params.InstanceURL}/ic/api/integration/v1/integrations/${integName}\""
bat(activateIntegrationCmd)
} else {
// Perform a different action when the checkbox is not checked
echo 'Checkbox is not checked'
// Add your desired logic here
def integURL = params.InstanceURL.toString()
def deactivateIntegrationCmd = "curl --user ${params.Username}:${params.Password} --header \"Content-Type: application/json\" --header \"X-HTTP-Method-Override: PATCH\" -d @${params.DeactivationJsonFile} -d 'enableAsyncActivationMode=true' \"${integURL}/ic/api/integration/v1/integrations/${integName}\""
bat(deactivateIntegrationCmd)
echo "Integration Configured"
}
}
}
}
}
}