Code Monkey home page Code Monkey logo

sncicd-publish-app's Introduction

ServiceNow CI/CD GitHub Action for Publish Application

Publishes the specified application and all of its artifacts to the application repository.

Usage

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

  • credentials (username and password for a service account)
  • instance URLs for your dev, test, prod, etc. environments
  • sys_id or scope for your app
  • sys_id for your ATF Test Suite

Step 2: Configure Secrets in your GitHub repository

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

Create secrets called

  • NOW_USERNAME
  • NOW_PASSWORD
  • NOW_SOURCE_INSTANCE only the domain string is required from the instance URL, for example https://domain.service-now.com
  • APP_SYS_ID or APP_SCOPE

Step 3: Example Workflow Template

https://github.com/ServiceNow/sncicd_githubworkflow

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

- name: Publish Application 
  id: sncicd-publish-app # id of the step
  uses: ServiceNow/[email protected] # like username/repo-name
  with:
      version: "x.x.x"
      versionTemplate: "x.x"
      devNotes: "string"
      versionFormat: exact
      isAppCustomization: false
      incrementBy: "integer"
  env:
    nowUsername: ${{ secrets.NOW_USERNAME }}
    nowPassword: ${{ secrets.NOW_PASSWORD }}
    nowSourceInstance: ${{ secrets.NOW_SOURCE_INSTANCE }}
    appSysID: ${{ secrets.APP_SYS_ID }}
    appScope: ${{ secrets.APP_SCOPE }}

Inputs:

  • version - Application version to publish. Only for "exact" version format is required
  • isAppCustomization - if true, require appSysID instead of appScope.
  • devNotes - Developer notes to store with the application.
  • versionTemplate - Version template ( like 2.4 ).
  • versionFormat - exact, detect, autodetect, template
    • exact - Use exact version from the input version variable
    • template - Use x.y.z version where x.y is entered in field below and z is autogenerated
    • detect - Try to detect the version from the Git repo. Will fail if no sources found. Must use https://github.com/actions/checkout! See example.
    • autodetect - Detect the currently installed version from the instance's sys_app table.
  • incrementBy - Increment version level, should be positive or zero, Default: 0.

Outputs:

  • rollbackVersion - The previously installed version.
  • newVersion - Incremented version. Used to install application step.

Environment variable should be set up in the Step 1

  • nowUsername - Username to ServiceNow instance
  • nowPassword - Password to ServiceNow instance
  • nowSourceInstance ServiceNow instance where application is developing
  • appSysID - Required if app_scope is not specified. The sys_id of the application
  • appScope - Required if app_sys_id is not specified. The scope name of the application, such as x_aah_custom_app

Contributing

Tests

Tests should be ran via npm commands:

Unit tests

npm run test

Integration test

npm run integration

Build

npm run buid

Formatting and Linting

npm run format
npm run lint

Notices

Support Model

ServiceNow built this integration with the intent to help customers get started faster in adopting CI/CD APIs for DevOps workflows, but will not be providing formal support. This integration is therefore considered "use at your own risk", and will rely on the open-source community to help drive fixes and feature enhancements via Issues. Occasionally, ServiceNow may choose to contribute to the open-source project to help address the highest priority Issues, and will do our best to keep the integrations updated with the latest API changes shipped with family releases. This is a good opportunity for our customers and community developers to step up and help drive iteration and improvement on these open-source integrations for everyone's benefit.

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.

sncicd-publish-app's People

Contributors

chiarng avatar vvoloshchuk avatar synci2k avatar dependabot[bot] avatar

Stargazers

Dan Covic avatar yc9559.trumpet avatar Devin Valencia avatar  avatar  avatar  avatar  avatar  avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

sncicd-publish-app's Issues

sncicd-publish-app 2.0.0 not detecting the correct application version

Hi,

I have encountered an issue after upgrading sncicd-publish-app action in the pipeline from 1.2.0 to 2.0.0. Please find the changes made to the yaml highlighted below:

Before:

  • name: ServiceNow CI/CD Publish App
    id: publish_app
    uses: ServiceNow/sncicd-publish-app@1.2.0
    with:
    versionFormat: detect
    env:
    snowUsername: ${{ secrets.SN_USERNAME }}
    snowPassword: ${{ secrets.SN_PASSWORD }}
    snowSourceInstance: ${{ secrets.SN_TEST_INSTANCE }}
    appSysID: ${{ secrets.SN_APP_SYSID }}

After:

  • name: ServiceNow CI/CD Publish App
    id: publish_app
    uses: ServiceNow/sncicd-publish-app@2.0.0
    with:
    versionFormat: detect
    env:
    nowUsername: ${{ secrets.SN_USERNAME }}
    nowPassword: ${{ secrets.SN_PASSWORD }}
    nowSourceInstance: ${{ secrets.SN_TEST_INSTANCE }}
    appSysID: ${{ secrets.SN_APP_SYSID }}

Pasting a screenshot of the error here. The current version is 11.4.0 and I's trying to publish 11.5.0. However the action detects 11.5.0 as current version.
image

Thanks
Ramya

Publishing Store App from Pipeline

With Store App configurations being a little different from that of a Custom App with baseline and custom version numbers, I am trying to understand if the existing publish-app Action would cater to Store App deployments. I assume they won't as the existing action deals with sys_app table and one version number. If it won't, will there be a new action released for Store Apps?

Thanks
Ramya

Error: Not found. The requested item was not found.

All these while, we have been testing the pipeline in ServiceNow provided DPP instances. For first time today, we did a trial run of the pipeline on our organization's live instances. The pipeline threw error at the Publish step. Other Actions like servicenow-ci-cd-apply-changes and servicenow-ci-cd-run-atf-test-suite ran successfully prior to the publish step.

The application that is being published has been in the system for a few weeks now. It was deployed manually to TEST instance from sourcecontrol and Published manually from Studio in TEST until we automated it using the pipeline. Manual publish worked without any issue. Not sure if it makes any difference, we were publishing from main branch until now, but the pipeline will be publishing from the dev branch instead.

Publish Error

ENOENT: no such file or directory, open '/home/runner/work/repo-name/repo-name/sys_app_***.xml'

Hi @chiarnglin

When I tried to use 'detect' as versionFormat, I am getting the following error:
ENOENT: no such file or directory, open '/home/runner/work/repo-name/repo-name/sys_app_***.xml'

Below is the code snippet of how I have the Publish App step in my workflow file.

  • name: ServiceNow CI/CD Publish App
    id: publish_app
    uses: ServiceNow/[email protected]
    with:
    versionFormat: detect
    env:
    snowUsername: ${{ secrets.SN_USERNAME }}
    snowPassword: ${{ secrets.SN_PASSWORD }}
    snowSourceInstance: ${{ secrets.SN_DEV_INSTANCE }}
    appSysID: ${{ secrets.SN_APP_SYSID }}

Add the versionFormat - detect_without_autoincrement

Hi @chiarnglin ,

It would be great to have the detect_without_autoincrement option that we have been using inside Azure Pipelines available on GitHub actions as well. In our model, we would want the team to set the application version manually during a sprint, rather than auto-setting it using a template.

Generate a source control Tag after application publish

@chiarnglin

During a manual publish from Studio, a source control tag is auto-generated. This feature is missing in the equivalent GitHub Action. We need this functionality for uniform outputs irrespective of how we do a publish, manually or from pipeline.

Thanks
Ramya

Unable to publish application from a dev instance to a test instance

Hello, I'm using a sample pipeline with a basic publish job in my github pipeline. I have the following configuration:

  1. One ServiceNow dev instance with Source Control enabled, in which I created my hello world application;
  2. another ServiceNow test instance WITHOUT Source Control enabled, in which my pipeline should be able to deploy the application I created in the dev instance;
  3. a public github repository that can be reached and can reach both ServiceNow instances with all the secrets and all the accounts correctly configured for each instance;
  4. a dedicated user for the pipeline with admin permission on the test instance.

I'm using the ServiceNow/[email protected] to deploy my application to test instance. This is the stage:

    - name: Publish to Store
      id: sncicd-publish-app
      uses: ServiceNow/[email protected]
      with:
        versionFormat: detect
        version: "1.0.0"
        versionTemplate: "1.0"
        devNotes: "deploy-to-production-test"
        isAppCustomization: false
        incrementBy: "1"
      env:
        nowUsername: ${{ secrets.NOW_USERNAME }}
        nowPassword: ${{ secrets.NOW_PASSWORD }}
        nowSourceInstance: ${{ secrets.NOW_TEST_INSTANCE}}
        appSysID: ${{ secrets.APP_SYS_ID }}
        appScope: ${{ secrets.APP_SCOPE }}

and this is the returning error:

Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
##[debug]steps.sncicd-publish-app.outputs.rollbackVersion='1.0.0'
::set-output name=newVersion::1.0.1
Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
##[debug]steps.sncicd-publish-app.outputs.newVersion='1.0.1'
Pending
Running: 3%
Error: Unable to upload application

I've already enabled all the debugging messages but the returning error is not clear. I've already checked the secrets and they are used correctly.

Parameter names, replace SNOW

We’re to not abbreviate ServiceNow with SNOW ever, according to marketing/branding guidelines. It’s either ServiceNow / SERVICENOW or Now / NOW. If you have to, it may be sn or snc in internal names but never snow. There’s another company called Snow Software doing similar things and we don’t want to get mixed up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.