Skip to content

Commit

Permalink
Service now create/query check yaml support
Browse files Browse the repository at this point in the history
  • Loading branch information
Tauhid committed Sep 10, 2020
1 parent f5d53b9 commit 77d36f7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"version": {
"Major": 2,
"Minor": 161,
"Minor": 162,
"Patch": 0
},
"instanceNameFormat": "ServiceNow change management",
Expand Down Expand Up @@ -130,26 +130,26 @@
"type": "string",
"label": "Short description",
"required": "true",
"defaultValue": "Deployment to $(Release.EnvironmentName) of Release $(Release.ReleaseName)",
"helpMarkDown": "Short description of the change request.",
"defaultValue": "Deployment from Azure DevOps",
"helpMarkDown": "Short description of the change request. For releases it can be 'Deployment to $(Release.EnvironmentName) of Release $(Release.ReleaseName)'. For checks it can be 'Deployment to $(system.stageName) of Build $(Build.DefinitionName)'",
"visibleRule": "changeRequestAction = createNew"
},
{
"name": "workNotes",
"type": "string",
"label": "Work notes",
"required": "false",
"defaultValue": "Deployment to $(Release.EnvironmentName) of Release $(Release.ReleaseName) \\r\\n Release: $(RELEASE.RELEASEWEBURL)",
"helpMarkDown": "Work notes to be added for the change request.",
"defaultValue": "Deployment from AzureDevOps",
"helpMarkDown": "Work notes to be added for the change request. For release - 'Deployment to $(Release.EnvironmentName) of Release $(Release.ReleaseName) \\r\\n Release: $(RELEASE.RELEASEWEBURL)'. For checks it can be : 'Deployment to $(system.stageName) of Build $(Build.DefinitionName)'",
"visibleRule": "changeRequestAction = useExisting"
},
{
"name": "description",
"type": "string",
"label": "Description",
"required": "false",
"defaultValue": "Deployment to $(Release.EnvironmentName) of Release $(Release.ReleaseName)",
"helpMarkDown": "Description of the change request.",
"defaultValue": "Deployment from AzureDevOps",
"helpMarkDown": "Description of the change request. For releases it can be 'Deployment to $(Release.EnvironmentName) of Release $(Release.ReleaseName)'. For checks it can be 'Deployment to $(system.stageName) of Build $(Build.DefinitionName)'",
"groupName": "optionalInputs"
},
{
Expand Down Expand Up @@ -354,7 +354,22 @@
},
"ExecutionOptions": {
"OutputVariables": "{\"CHANGE_SYSTEM_ID\" : \"jsonpath('$.result[0].sys_id')[0]\"}",
"SkipSectionExpression": "or(eq(eq(taskInputs['changeRequestAction'], 'createNew'), false), and(eq(taskInputs['changeRequestAction'], 'createNew'), eq(isNullOrEmpty(variables['CHANGE_SYSTEM_ID']), false)))"
"SkipSectionExpression": "or(eq(eq('$(system)', 'checks'), true), or(eq(eq(taskInputs['changeRequestAction'], 'createNew'), false), and(eq(taskInputs['changeRequestAction'], 'createNew'), eq(isNullOrEmpty(variables['CHANGE_SYSTEM_ID']), false))))"
}
},
{
"RequestInputs": {
"EndpointId": "$(ServiceNowConnection)",
"EndpointUrl": "$(endpoint.url)/api/now/import/x_mioms_azpipeline_change_request_import",
"Method": "POST",
"Body": "{ \"u_correlation_id\": \"{{#newGuid}}{{/newGuid}}\",\"u_type\": \"$(changeType)\",\"u_x_mioms_azpi_eline_metadata\": \"Build: $(build.buildUri) \\r\\n StageName: $(system.stageName)\", \"u_short_description\": \"$(shortdescription)\"{{#equals changeType 'Normal' 1}}{{#if description}}, \"u_description\": \"$(description)\"{{/if}}{{#if category}}, \"u_category\": \"$(category)\"{{/if}}{{#if priority}}, \"u_priority\": \"$(priority)\"{{/if}}{{#if risk}}, \"u_risk\": \"$(risk)\"{{/if}}{{#if impact}}, \"u_impact\": \"$(impact)\"{{/if}}{{#if configurationitem}}, \"u_cmdb_ci\": \"$(configurationitem)\" {{/if}}{{#if assignmentgroup}}, \"u_assignment_group\": \"$(assignmentgroup)\"{{/if}}{{/equals}}, \"u_requested_by_date\": \"{{toDateTimeFormat '$(system.checksStartTime)' 'dd-MM-yyyy HH:mm:ss UTC'}}\", \"u_start_date\": \"{{#if schedulestarttime}}{{toDateTimeFormat '$(schedulestarttime)' 'dd-MM-yyyy HH:mm:ss UTC'}}{{/if}}\", \"u_end_date\": \"{{#if scheduleendtime}}{{toDateTimeFormat '$(scheduleendtime)' 'dd-MM-yyyy HH:mm:ss UTC'}}{{/if}}\" {{#if otherParameters}}{{toCommaSeparatedKeyValueList otherParameters true}}{{/if}}{{#equals changeType 'Standard' 1}}{{#if standardChangeTemplate}} , \"template_id\": \"$(standardChangeTemplate)\" {{/if}}{{/equals}} }",
"Headers": "{\"Content-Type\":\"application/json\", \"Accept\":\"application/json\"}",
"WaitForCompletion": "false",
"Expression": "eq(jsonpath('$.result[0].status')[0], 'inserted')"
},
"ExecutionOptions": {
"OutputVariables": "{\"CHANGE_SYSTEM_ID\" : \"jsonpath('$.result[0].sys_id')[0]\"}",
"SkipSectionExpression": "or(eq(eq('$(system)', 'checks'), false), or(eq(eq(taskInputs['changeRequestAction'], 'createNew'), false), and(eq(taskInputs['changeRequestAction'], 'createNew'), eq(isNullOrEmpty(variables['CHANGE_SYSTEM_ID']), false))))"
}
},
{
Expand Down Expand Up @@ -411,7 +426,7 @@
},
"ExecutionOptions": {
"OutputVariables": "{\"CHANGE_REQUEST_NUMBER\" : \"jsonpath('$.result.number')[0]\"}",
"SkipSectionExpression": "or(eq('$(successCriteria)', 'desired'),eq(isNullOrEmpty(variables['CHANGE_SYSTEM_ID']), true))"
"SkipSectionExpression": "or(eq('$(successCriteria)', 'desiredStatus'),eq(isNullOrEmpty(variables['CHANGE_SYSTEM_ID']), true))"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Extensions/ServiceNow/Src/vss-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "vss-services-servicenowchangerequestmanagement",
"name": "ServiceNow Change Management",
"publisher": "ms-vscs-rm",
"version": "4.162.1",
"version": "4.162.2",
"public": true,
"description": "Integrate ServiceNow Change Management with Azure Pipelines",
"categories": [
Expand Down

0 comments on commit 77d36f7

Please sign in to comment.