Skip to content

kunal-gangaher-snow/DevOps-custom-action-register-artifact

Repository files navigation

ServiceNow DevOps Register Artifact GitHub Action

This custom action needs to be added at step level in a job to register artifact details in ServiceNow instance.

Usage

Step 1: Prepare values for setting up your secrets for Actions

  • credentials (Devops integration token of a GitHub tool created in ServiceNow DevOps or username and password for a ServiceNow devops integration user)
  • instance URL for your ServiceNow dev, test, prod, etc. environments
  • tool_id of your GitHub tool created in ServiceNow DevOps

Step 2: Configure Secrets in your GitHub Ogranization or GitHub Repository

On GitHub, go in your organization settings or repository settings, click on the Secrets > Actions and create a new secret.

For token based authentication which is available from v2.0.0, create secrets called

  • SN_INSTANCE_URL your ServiceNow instance URL, for example https://test.service-now.com
  • SN_ORCHESTRATION_TOOL_ID only the sys_id is required for the GitHub tool created in your ServiceNow instance
  • SN_DEVOPS_INTEGRATION_TOKEN required for token based authentication

For basic authentication , create secrets called

  • SN_INSTANCE_URL your ServiceNow instance URL, for example https://test.service-now.com
  • SN_ORCHESTRATION_TOOL_ID only the sys_id is required for the GitHub tool created in your ServiceNow instance
  • SN_DEVOPS_USER
  • SN_DEVOPS_PASSWORD

Step 3: Configure the GitHub Action if need to adapt for your needs or workflows

For Token based Authentication at ServiceNow instance which is available from v2.0.0

registerartifact:
    name: Register Artifact
    runs-on: ubuntu-latest
    steps:
      - name: ServiceNow Register Artifact
        uses: ServiceNow/servicenow-devops-register-artifact@v2.0.0
        with:
          devops-integration-token: ${{ secrets.SN_DEVOPS_INTEGRATION_TOKEN }}
          instance-url: ${{ secrets.SN_INSTANCE_URL }}
          tool-id: ${{ secrets.SN_ORCHESTRATION_TOOL_ID }}
          context-github: ${{ toJSON(github) }}
          job-name: 'Register Artifact'
          artifacts: '[{"name": "com:customactiondemo","version": "1.${{ github.run_number }}","semanticVersion": "1.${{ github.run_number }}.0","repositoryName": "${{ github.repository }}"}]'

For Basic Authentication at ServiceNow instance

registerartifact:
    name: Register Artifact
    runs-on: ubuntu-latest
    steps:
      - name: ServiceNow Register Artifact
        uses: ServiceNow/servicenow-devops-register-artifact@v2.0.0
        with:
          devops-integration-user-name: ${{ secrets.SN_DEVOPS_USER }}
          devops-integration-user-password: ${{ secrets.SN_DEVOPS_PASSWORD }}
          instance-url: ${{ secrets.SN_INSTANCE_URL }}
          tool-id: ${{ secrets.SN_ORCHESTRATION_TOOL_ID }}
          context-github: ${{ toJSON(github) }}
          job-name: 'Register Artifact'
          artifacts: '[{"name": "com:customactiondemo","version": "1.${{ github.run_number }}","semanticVersion": "1.${{ github.run_number }}.0","repositoryName": "${{ github.repository }}"}]'

The values for secrets should be setup in Step 1. Secrets should be created in Step 2.

Inputs

devops-integration-user-name

Optional DevOps Integration Username to ServiceNow instance.

devops-integration-user-password

Optional DevOps Integration User Password to ServiceNow instance.

devops-integration-token

Optional DevOps Integration Token of GitHub tool created in ServiceNow instance for token based authentication.

instance-url

Required URL of ServiceNow instance to register artifact details.

tool-id

Required Orchestration Tool Id for GitHub created in ServiceNow DevOps

context-github

Required Github context contains information about the workflow run details.

job-name

Required Display name of the job given for attribute name in which steps have been added for this custom action. For example, if display name of job is Register Artifact then job-name value must be 'Register Artifact'

artifacts

Required The list of artifacts to be registered in ServiceNow instance. Each artifact is a JSON object surrounded by curly braces {} containing key-value pair separated by a comma ,. A key-value pair consists of a key and a value separated by a colon :. The keys supported in key-value pair are name, version, semanticVersion, repositoryName key-value pair separated by comma surrounded by curly braces {}. For example, '[{"name": "com:firstrepo","version": "1.${{ github.run_number }}","semanticVersion": "1.${{ github.run_number }}.0","repositoryName": "${{ github.repository }}"}]'

Outputs

No outputs produced.

Notices

Support Model

ServiceNow customers may request support through the Now Support (HI) portal.

Governance Model

Initially, ServiceNow product management and engineering representatives will own governance of these integrations to ensure consistency with roadmap direction. In the longer term, we hope that contributors from customers and our community developers will help to guide prioritization and maintenance of these integrations. At that point, this governance model can be updated to reflect a broader pool of contributors and maintainers.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published