im_atrey
Tera Contributor

In this unprecedented COVID situation, sometimes business requirements or enhancements have also become unprecedented, and to accomplish that in the timeline, a developer needs some automation, tool, or process to deploy their work and make it available within time.


This #know20 ServiceNow has introduced CI/CD Automation.

CI/CD - Continuous Integration and Continuous Delivery or Continuous Deployment, but before we jump into CI/CD we must understand what is DevOps?

You will find the whole paragraph on the internet about it which might confuse you, so, What is DevOps?

DevOps- As the name explains itself, Development and Operations. When we use both development and operations together then it is called DevOps.

  • The agile relationship between development and IT operations. The goal of DevOps is to change and improve the relationship by advocating better communication and collaboration between two business units.

find_real_file.png

(a) DevOps Pipeline components

Now, we know what is DevOps but what its actual use and why most software development organizations are heading towards this approach?

  • Generally, organizations follow the cycle where Devs builds as per requirements, and QA tests what is being created and Ops will make it live, this cycle seems to smoothy but it's not, so, in actual what happens is Devs throw code “over the wall” to QAs. QAs find bugs and bring them to devs to be debugged. Devs blame QAs and the testing environment for the bugs. When bugs are finally resolved, QA throws the code “over the wall” to Ops. Since Ops teams have to limit changes to their system, there is a high possibility of their system crashing when the code is released. Ops blames QAs and devs and the cycle continues.

  • To get rid of this blame game DevOps comes into picture which primarily focuses on communication and collaboration between developers and testers. The point of DevOps is to ensure that developers and QAs are on the same page at all stages of a project. So, it speeds up product delivery and improves the response to the customer.

Now, you know, why DevOps is required, but the question arises if it is that much important then How do we achieve DevOps? Is there any tool/software or process to achieve the DevOps?

  • The term CI/CD comes into the picture which we can say DevOps tactic which makes use of the right automated testing tools to implement development, it enables developers to focus on meeting business requirements, code quality, and security because deployment steps are automated.

CI: Continuous Integration, you develop code and committing your code to version control repository(eg: Git-Hub). When practicing CI, developers commit their code into the version control repository frequently, which leads to better collaboration and software quality.

                                                                                                                                       find_real_file.png(b) Developer committing code to Git-Repository(Version control Repository)

  • The rationale behind this is that it’s easier to identify defects and other software quality issues on smaller code differentials rather than larger ones developed over an extensive period of time and being deployed in a single go.

  • The point of CI is to establish a software-defined lifecycle that decreases the effort required for build and integration. Continuous integration(commit to version control repository) also results in the detection of errors in code in the early stages.

 

CD means Continuous Delivery: It's delivering what you have in your version control repository. Most teams work with multiple environments other than the production, such as development, test, and pre-prod environments, and CD ensures there is an automated way to push code changes to them.

                                  find_real_file.png  

                                                                (c) Environments are connected to version control repository

A typical CD pipeline has build, test, and deploy stages.

  • Pulling code from version control and executing a build.
  • Executing any required infrastructure steps that are automated as code to stand up or tear down cloud infrastructure.
  • Moving code to the target computing environment.
  • Managing the environment variables and configuring them for the target environment.
  • Executing continuous tests and rollback environments if tests fail.
  • Providing logs and alerts.

CD also means Continuous Deployment: A practice in which all changes are automatically deployed into production.

Continuous testing via Automated testing framework:

  • Automated testing frameworks help quality assurance engineers define, execute, and automate various types of tests that can help development teams know whether an application/code build passes or fails.
  • A best practice is to enable and require developers to run all or a subset of regressions tests in their local environments.

                           

For ServiceNow, what does CI/CD means?

  • It means that development teams are able to work in a shared Git repository for better collaboration, managers have full transparency of work being done, and deployment pipelines can be automated from Dev all the way to Prod.

  • The Orlando release brought some major enhancements to ServiceNow’s source control integration and added some CI/CD capabilities in the form of automated testing and deployment APIs and IntegrationHub spokes.

Benefits of Now Platform CI/CD:

  • Collaborate efficiently: Enable developers to work together with Git integrations and use selective commit.
  • Reduce development costs: Get more done and minimize costs by reducing collisions and re-work.
  • Shorten development time: Identify issues early and often with a CI/CD pipeline.
  • Automate deployments: Using IntegrationHub Spokes and CI/CD Rest API.
  • Simplify the application deployment process across ServiceNow instances.

CI/CD Rest API: You can leverage the Rest API to automate the process, below are the following methods:- 

  • GET /sn_cicd/progress/{progress_id}        // check the progress whrether you have done it or not.
  • GET /sn_cicd/testsuite/results/{result_id} // retrieve the test results of ATF.
  • POST /sn_cicd/app_repo/install               // install in the application repository
  • POST /sn_cicd/app_repo/publish            //publish the application in app_repo so you can install in prod.
  • POST /sn_cicd/app_repo/rollback         //rollback the application eg: version mismatch
  • POST /sn_cicd/plugin/{plugin_id}       //activate  //activate the plugin in instance
  • POST /sn_cicd/plugin/{plugin_id}/rollback. 
  • POST /sn_cicd/sc/apply_changes.     // apply changes to Source control (Git repo).
  • POST /sn_cicd/testsuite/run            // automate the ATF.

Note: To automate the ATF, a scheduled client runner is required. Some browsers like chrome do throttling of tab if it's not active tab.


IntegrationHub Spoke: 
In Orlando, ServiceNow has released CI/CD Sub-flow and Actions. It's up to you how you want to leverage as per your requirement.

find_real_file.png(d) CI/CD sub-flow in IntegrationHub

 

find_real_file.png(e) CI/CD action in IntegrationHub

 

Top takeaways :

  • Streamlined scoped app development.
  • Improved developer collaboration by leveraging selective commits.
  • Leverage CI/CD Rest API and IntegrationHub spokes.

 

In the next article, we will learn How to leverage the Now platform CI/CD Rest API and IntegrationHub spokes.

Happy Learning !! Stay Safe!!

 

If you find it informative hit the helpful button and subscribe to it.                                                                                                            

Regards

Aashish Atrey

 

Version history
Last update:
‎05-30-2020 01:15 PM
Updated by: