|
| 1 | +# createcr |
| 2 | + |
| 3 | +## Summary |
| 4 | +Create a new Change Request on the ServiceNow instance |
| 5 | + |
| 6 | +## Inputs/Outputs |
| 7 | + |
| 8 | +### Inputs |
| 9 | +#### Parameters |
| 10 | +* TOKEN (required) - Secret name containing the Codefresh API Key |
| 11 | +* SN_INSTANCE (required) - URL of the ServiceNow instance aka https://instance.service-now.com |
| 12 | +* SN_AUTH (required) - Secret name containing the user and password to log into the instance |
| 13 | +* CR_DATA (required) - a string containing a JSON body to allow the creation of the Change Request. The exact content is dependent on your implementation of Change Management |
| 14 | +* STD_CR_TEMPLATE (optional) - name of a Standard Change template. Using this parameter will open a Standard Change (pre-approved) instead of a normal one. |
| 15 | +* CF_RUNTIME (required) - name of the GtiOps Runtime |
| 16 | +* CF_URL (required for onprem) - URL of your Codefresh instance. Default is 'https://g.codefresh.io' |
| 17 | +* CR_CONFLICT_POLICY (optional) - Policy to execute in case of schedule conflict. Accepted values are `ignore` (no check is done), `wait` (workflow will wait until the conflict is resolved) or `reject` (ServiceNow flow returns a deny answer). Default value is `ignore` |
| 18 | +* LOG_LEVEL (optional) - A flag to indicate log-level. Values are `info`, `debug`, `warning`, `error`, `critical`. Default value is `info`. |
| 19 | + |
| 20 | +### Outputs |
| 21 | +#### Parameters |
| 22 | +* CR_SYSID: the sysid of the record created that can be use to update or close the Change Request later on |
| 23 | +* CR_NUMBER: a more human readable Change Request Number |
| 24 | + |
| 25 | +## Examples |
| 26 | + |
| 27 | +### createcr Example |
| 28 | +#### Normal Change |
| 29 | +``` |
| 30 | +apiVersion: argoproj.io/v1alpha1 |
| 31 | +kind: Workflow |
| 32 | +metadata: |
| 33 | + generateName: create-cr |
| 34 | +spec: |
| 35 | + entrypoint: create-sn-cr |
| 36 | + templates: |
| 37 | + - name: main |
| 38 | + dag: |
| 39 | + tasks: |
| 40 | + - name: create-sn-cr |
| 41 | + templateRef: |
| 42 | + name: argo-hub.servicenow.1.4.0 |
| 43 | + template: createcr |
| 44 | + arguments: |
| 45 | + parameters: |
| 46 | + - name: TOKEN |
| 47 | + value: cf-token |
| 48 | + - name: SN_INSTANCE |
| 49 | + value: "https://XXXX.service-now.com" |
| 50 | + - name: SN_AUTH |
| 51 | + value: "sn-auth" |
| 52 | + - name: CF_RUNTIME |
| 53 | + value: csdp |
| 54 | + - name: LOG_LEVEL |
| 55 | + value: debug |
| 56 | + - name: CR_DATA |
| 57 | + value: >- |
| 58 | + {"short_description": "Application deployment to QA environment", |
| 59 | + "description": "Change for build {{workflow.id}}.\nThis change was created by the ServiceNow Workflow template", |
| 60 | + "justification": "I do not need a justification\nMy app is awesome", |
| 61 | + "cmdb_ci":"tomcat" |
| 62 | + } |
| 63 | +``` |
| 64 | + |
| 65 | +#### Standard Change |
| 66 | +``` |
| 67 | +apiVersion: argoproj.io/v1alpha1 |
| 68 | +kind: Workflow |
| 69 | +metadata: |
| 70 | + generateName: create-cr |
| 71 | +spec: |
| 72 | + entrypoint: create-sn-cr |
| 73 | + templates: |
| 74 | + - name: main |
| 75 | + dag: |
| 76 | + tasks: |
| 77 | + - name: create-sn-cr |
| 78 | + templateRef: |
| 79 | + name: argo-hub.servicenow.1.4.0 |
| 80 | + template: createcr |
| 81 | + arguments: |
| 82 | + parameters: |
| 83 | + - name: TOKEN |
| 84 | + value: cf-token |
| 85 | + - name: SN_INSTANCE |
| 86 | + value: "https://XXXX.service-now.com" |
| 87 | + - name: SN_AUTH |
| 88 | + value: "sn-auth" |
| 89 | + - name: CF_RUNTIME |
| 90 | + value: demo |
| 91 | + - name: STD_CR_TEMPLATE |
| 92 | + value: "Deploy pre-approved Application" |
| 93 | + - name: CR_DATA |
| 94 | + value: >- |
| 95 | + {"short_description": "Application deployment to Staging environment", |
| 96 | + "description": "Change for build {{workflow.id}}.\nThis change was created by the ServiceNow Workflow template", |
| 97 | + "justification": "I do not need a justification\nMy app is awesome" |
| 98 | + } |
| 99 | +``` |
0 commit comments