GitHub pipeline actions
Use these actions in your GitHub pipeline to interact with the DevOps Config data model.
Important: Starting with the Washington D.C. release, DevOps Config is being prepared for future deprecation. It will be hidden and no longer activated on new instances but will continue to be supported.
GitHub scripted and declarative pipelines are supported.
The ServiceNow DevOps Config Validate (servicenow-devops-config-validate) and DevOps Config Export (servicenow-devops-config-export) GitHub Actions are provided to create a specific pipeline definition.
DevOps Config Validate (servicenow-devops-config-validate)
Upload and validate configuration data in a ServiceNow instance.
- Input arguments
| Argument | Description |
|---|---|
| instance-url | ServiceNow instance URL. |
| devops-integration-username | DevOps Config integration username. |
| devops-integration-user-password | DevOps Config integration user password. |
| application-name | DevOps Config application name. |
| target | Data model target where configuration files are uploaded. Example data model targets are: - `component` - `collection` - `deployable` |
| deployable-name | Deployable name in the DevOps Config data model. |
| collection-name | \(Optional\) Collection name in the data model. Required when target is collection. |
| name-path | \(Optional\) Name path of the node in the data model where the configuration files are uploaded. |
| config-file-path | File path when uploading a single file or file path pattern based on the Ant-style pattern when uploading multiple files to the data model. See Directory-based Tasks for information on Ant-style patterns in the Apache Ant.1.10.14 Manual documentation. |
| data-format | Data format of the configuration files. Example data formats are: - `CSV` - `INI` - `JSON` - `Properties` - `RAW` - `XML` - `YAML` |
| data-format-attribute | \(Optional\) Extended data format attributes for parsing configuration data. |
| auto-commit | Boolean \(true or false\) input to commit configuration data after successful upload.Default value: `true` |
| auto-validate | Boolean \(true or false\) input to validate configuration data after successful commit.Default value: `true` |
| auto-publish | Boolean \(true or false\) input to publish configuration data after successful validation.Default value: `true` |
| changeset | \(Optional\) Open changeset associated with the upload action. If not provided, a new changeset is created. |
| snapshot-validation-timeout | \(Optional\) Maximum time in minutes for validation to complete before failing the action.Default value: `60` |
| terminate-on-policy-validation-failures | \(Optional\) Boolean \(true or false\) input to terminate the GitHub workflow after policy validation failures.Default value: `false` |
Outputs
changeset-number
Changeset number associated with the upload action.
snapshot-name
Name of the latest snapshot of the deployable.
validation-status
Validation status of the snapshot. Example:
passed,passed_with_exception,failed,execution_error,not_validatedvalidation-results
Validation results in the JSON format for the snapshot.
Example — Uploading config files to a deployable
upload_and_validate_job: name: Upload and validate needs: <upstream job> runs-on: ubuntu-latest steps: - name: ServiceNow Devops Config Validate uses: ServiceNow/servicenow-devops-config-validate@v1.0.0-beta with: instance-url: ${{ secrets.SN_INSTANCE_URL }} devops-integration-username: ${{ secrets.SN_DEVOPS_CONFIG_USERNAME }} devops-integration-user-password: ${{ secrets.SN_DEVOPS_CONFIG_PASSWORD }} application-name: PaymentDemo target: deployable deployable-name: Production name-path: web-api-v1.0 auto-commit: true auto-validate: true auto-publish: true config-file-path: data/k8s/helm/*.yml data-format: yaml snapshot-validation-timeout: 60 terminate-on-policy-validation-failures: trueExample — Uploading config files to a collection
upload_and_validate_job: name: Upload and validate needs: <upstream job> runs-on: ubuntu-latest steps: - name: ServiceNow Devops Config Validate uses: ServiceNow/servicenow-devops-config-validate@v1.0.0-beta with: instance-url: ${{ secrets.SN_INSTANCE_URL }} devops-integration-username: ${{ secrets.SN_DEVOPS_CONFIG_USERNAME }} devops-integration-user-password: ${{ secrets.SN_DEVOPS_CONFIG_PASSWORD }} application-name: PaymentDemo target: collection deployable-name: Production collection-name: release-1.0 name-path: web-api-v1.0 auto-commit: true auto-validate: true auto-publish: true config-file-path: data/k8s/helm/*.yml data-format: yaml snapshot-validation-timeout: 60 terminate-on-policy-validation-failures: trueExample — Uploading config files to a component
upload_and_validate_job: name: Upload and validate needs: <upstream job> runs-on: ubuntu-latest steps: - name: ServiceNow Devops Config Validate uses: ServiceNow/servicenow-devops-config-validate@v1.0.0-beta with: instance-url: ${{ secrets.SN_INSTANCE_URL }} devops-integration-username: ${{ secrets.SN_DEVOPS_CONFIG_USERNAME }} devops-integration-user-password: ${{ secrets.SN_DEVOPS_CONFIG_PASSWORD }} application-name: PaymentDemo target: component deployable-name: Production name-path: web-api-v1.0 auto-commit: true auto-validate: true auto-publish: true config-file-path: data/k8s/helm/*.yml data-format: yaml snapshot-validation-timeout: 60 terminate-on-policy-validation-failures: trueExample — Uploading multiple config files in a single commit
upload_and_validate_job: name: Upload and validate needs: <upstream job> runs-on: ubuntu-latest # Upload an XML file to a component steps: - name: ServiceNow Devops Config Validate id: upload_and_validate_xml uses: ServiceNow/servicenow-devops-config-validate@v1.0.0-beta with: instance-url: ${{ secrets.SN_INSTANCE_URL }} devops-integration-username: ${{ secrets.SN_DEVOPS_CONFIG_USERNAME }} devops-integration-user-password: ${{ secrets.SN_DEVOPS_CONFIG_PASSWORD }} application-name: PaymentDemo target: component deployable-name: Production name-path: web-api-v1.0 auto-commit: false auto-validate: true auto-publish: true config-file-path: data/infra/v1/*.xml data-format: xml snapshot-validation-timeout: 60 terminate-on-policy-validation-failures: true # Upload a JSON file to the vars folder of a deployable steps: - name: ServiceNow Devops Config Validate id: upload_and_validate_json uses: ServiceNow/servicenow-devops-config-validate@v1.0.0-beta with: instance-url: ${{ secrets.SN_INSTANCE_URL }} devops-integration-username: ${{ secrets.SN_DEVOPS_CONFIG_USERNAME }} devops-integration-user-password: ${{ secrets.SN_DEVOPS_CONFIG_PASSWORD }} application-name: PaymentDemo target: component deployable-name: Production name-path: web-api-v1.0 auto-commit: true auto-validate: true auto-publish: true config-file-path: data/infra/prod/*.json data-format: json snapshot-validation-timeout: 60 terminate-on-policy-validation-failures: true changeset : ${{ steps.upload_and_validate_xml.outputs.changeset-number }}
DevOps Config Export (servicenow-devops-config-export)
Export configuration data using ServiceNow DevOps Config.
- Input arguments
| Argument | Description |
|---|---|
| instance-url | ServiceNow instance URL. |
| devops-integration-username | DevOps Config integration username. |
| devops-integration-user-password | DevOps Config integration user password. |
| application-name | DevOps Config application name. |
| deployable-name | Deployable name in the DevOps Config data model. |
| exporter-name | Exporter name that exports configuration data from the DevOps Config data model. |
| snapshot-name | \(Optional\) Snapshot from which to export data. If a snapshot is not specified, the latest snapshot for the deployable is used. |
| exporter-data-format | \(Optional\) Format to export the snapshot data. Example data formats are: - `CSV` - `INI` - `JSON` - `Properties` - `RAW` - `XML` - `YAML` |
| exporter-arguments | \(Optional\) Arguments to be used along with the exporter. The value must be a JSON object represented as a string. |
Output
exporter-content
Configuration data that the exporter exports.
Example — Export specific snapshot
export: name: Export config needs: <upstream job> runs-on: ubuntu-latest steps: - name: ServiceNow DevOps Config Export uses: ServiceNow/servicenow-devops-config-export@v1.0.0-beta with: instance-url: ${{ secrets.SN_INSTANCE_URL }} devops-integration-username: ${{ secrets.SN_DEVOPS_CONFIG_USERNAME }} devops-integration-password: ${{ secrets.SN_DEVOPS_CONFIG_PASSWORD }} application-name: PaymentDemo deployable-name: Production exporter-name: returnDataforNodeName-now snapshot-name: Production-v1.dpl exporter-arguments: '{ "nodeName": "node1" }'Example — Export the latest deployed snapshot with additional parameters
export: name: Export config needs: <upstream job> runs-on: ubuntu-latest steps: - name: ServiceNow DevOps Config Export uses: ServiceNow/servicenow-devops-config-export@v1.0.0-beta with: instance-url: ${{ secrets.SN_INSTANCE_URL }} devops-integration-username: ${{ secrets.SN_DEVOPS_CONFIG_USERNAME }} devops-integration-password: ${{ secrets.SN_DEVOPS_CONFIG_PASSWORD }} application-name: PaymentDemo deployable-name: Production exporter-name: returnDataforNodeName-now exporter-arguments: '{ "nodeName": "node1" }' exporter-data-format: XML