Codefresh Steps: Reusable Code for Common Operations
This page provides code you can use to perform common operations in the Codefresh CI/CD platform.
service-now service-now
Integration with ServiceNow Change Management
arguments
returns
createChange:
title: Create a Service Now Change Request
type: service-now
stage: deploy
arguments:
CR_ACTION: createCR
TOKEN: '${CF_API_TOKEN}'
SN_INSTANCE: 'https://instance.service-now.com'
SN_USER: '${{SN_USER}}'
SN_PASSWORD: '${{SN_PASSWORD}}'
CR_CONFLICT_POLICY: reject
CR_DATA: >-
{"short_description":"This is a Change Request created by
Codefresh","description":"long description for Codefresh build
${{CF_BUILD_ID}}","justification":"because our app is awesome"}
modifyCR:
title: Modify the CR
type: service-now
stage: deploy
arguments:
CR_ACTION: closeCR
CR_SYSID: '${{CR_SYSID}}'
SN_INSTANCE: 'https://instance.service-now.com'
SN_USER: '${{SN_USER}}'
SN_PASSWORD: '${{SN_PASSWORD}}'
CR_DATA: >-
{"test_plan":"We ran all the test in the awesome test suite. Test pass
rate: ${{TEST_RATE}}"}
closeCR:
title: Close the CR
type: service-now
stage: cleaning
arguments:
CR_ACTION: closeCR
CR_SYSID: '${{CR_SYSID}}'
SN_INSTANCE: 'https://instance.service-now.com'
SN_USER: '${{SN_USER}}'
SN_PASSWORD: '${{SN_PASSWORD}}'
CR_CLOSE_CODE: successful
CR_CLOSE_NOTES: 'CR closed by Codefresh build ${{CF_BUILD_ID}}'
CR_DATA: '{"work_notes":"Closed automatically by Codefresh build ${{CF_BUILD_ID}}"}'