Wintertainment 2020 - Day 3: Enabling APIs to Drive Automation and Efficiency Across CI/CD Pipeline

Wintertainment-2020-day3-top.png

 

Hi Community!

 

It's Day 3 of Wintertainment 2020, and we have prepared a great in-depth article for you about driving automation and efficiency across your CI/CD pipeline with APIs.

 

Share your thoughts and expertise in the comments below, network with peers, and get a chance to win prizes from SmartBear! See participation rules and event schedule

 

Enabling APIs to Drive Automation and Efficiency Across Your CI/CD Pipeline

 

The increased adoption of DevOps is helping organizations develop software with greater speed and efficiency. An integral part of the success of any DevOps initiative is the practice of CI/CD, which embodies both tools and processes used for building, testing, and deploying code. Think of CI/CD as a pipeline that enables development teams to deliver code changes more frequently and with improved quality. 

  

The first part of the pipeline, CI, stands for Continuous Integration. This philosophy involves teams implementing small, incremental code changes continuously over time. Developers will also frequently check that code into version-control repositories. The goal of CI, essentially, is to build, package, and test applications in a uniform and automated way.  

 

The next piece of the puzzle is Continuous Delivery. Continuous delivery happens when those applications executed in the CI step are pushed out automatically to their preferred infrastructure environment.  

 

What are the Benefits of CI/CD 

 

  • Speed and Efficiency: A CI/CD pipeline streamlines the development process by automating many manual processes that ordinarily take up valuable time. By making it easier to submit, track, and manage changes to code – while automating testing and delivery processes – CI/CD enables developers to work more efficiently, and at a larger scale. 
  • Quality: Eliminating manual steps removes the risk of human error. Through its ability to automate aspects of the collaborative development process, the CI/CD pipeline assures quality throughout integration and delivery. By committing code changes in small increments, it diminishes the risk of destabilizing applications if a problem occurs. It also improves quality by automating deployment steps, giving developers more time to focus on code quality earlier on.  

 

How APIs Can Impact CI/CD  

 

Applications don’t always include APIs. But considering the exponential growth of digital applications, platforms, and ecosystems, it’s safe to assume APIs are factored in more. How the API is designed – code-first or design-first – can have a big impact later when using it with CI/CD.  

 

What’s the difference between the two approaches? 

  • Code-first:The Dev team decides what to do first, then they write code to implement their changes. From that code, they generate the OpenAPI document. 
  • Design-first:Input is gathered from all relevant stakeholders and people write down their API design. It’s written in a way that both humans and computers can understand, as in a machine-readable contract, or in an OpenAPI Specification document, and the code is built. 

 

API design using an OpenAPI compliant tool such as SwaggerHub not only generates a machine-readable API definition, but also provides a repository of those definitions that can help CI/CD automation.  

 

To support the broader API development lifecycle, developers should consider adding ReadyAPI for testing. It has a centralized interface for both functional and performance tests, as well as service virtualization, in combination with their CI/CD pipeline. So regardless of where the API is in its dev lifecycle, quality remains a focal point.  

 

Building API Quality Into Your Process Can Help Streamline It 

 

The pace of API development and delivery has increased at a dramatic rate. Fast delivery cycles are not conducive to API quality. Fast delivery cycles often contribute to issues down the line with the API is deployed, which then requires a re-design to fix.  

 

It’s common to push APIs into production at an accelerated pace, which creates additional challenges for CI/CD pipelines. Teams run automated tests every time the code changes, to prevent bugs from making it to production. Ideally, this all happens at build time instead of runtime. 

 

Both SwaggerHub and ReadyAPI have a multitude of integrations that can help optimize your CI/CD pipeline. For instance, with Source Control Management tools like GitHub, GitLab, etc., it’s easy for distributed teams to use SwaggerHub to commit and track changes, or create and manage versions to ensure all input is coordinated efficiently.  

 

One Place for Your APIs 

 

SwaggerHub acts as a single source of truth for the most current API definitions, and its documentation, to ensure test-case alignment. Using ReadyAPI, testers can search SwaggerHub for the relevant OpenAPI definition to create their test cases. No need to wait on the API to be deployed.  

 

Developers can create a simple mock with SwaggerHub or use the comprehensive API virtualization server within ReadyAPI. If an issue arises, developers can use SwaggerHub to coordinate changes to the API definition, which enables testers to quickly refactor the test case without having to manually build new tests.   

 

Other aspects of the CI/CD pipeline can benefit from improved management of the API development lifecycle. In the same way that SwaggerHub streamlines integrations with repositories, developers can utilize the machine-readability of its OpenAPI definitions to create efficiencies with build tools like Jenkins, and API gateway vendors like Google Apigee, Axway, and others.  

 

Make Strides Towards Quality, More Efficiently 

 

Swagger helped usher in the API era. With SwaggerHub, organizations can use machine-readable formats like OpenAPI as the source of truth throughout their entire software development process, whether for automated API tests, API mocking, or API standardizations.  

The API definition has become one of the most important tools for building modern software.  

 

These teams can validate their product ideas sooner, reduce the risk of delivering the wrong thing, and work in parallel with other teams around the world, all to build quality software faster. Today, digital leaders are the companies that focus on improving the API development lifecycle and using APIs to automate and drive efficiencies within their CI/CD pipelines.  

 

Further Reading 

 

 

What do you think? Comment below! 

 

1. How do you currently manage your API development lifecycle across the tools and processes that make up your CI/CD pipeline? 

 2. Are you able to leverage your OpenAPI definition to automate aspects or your CI/CD pipeline? 

 3. What tools do you use to design, test or virtualize your APIs?  

 4. What issues have you run into when trying to sync your API design process with your CI/CD pipeline? 

4 Comments
Community Hero

We are starting from nothing at my current job.  When I began, test cases were all in Excel and they didn't have TestComplete.  Now all test cases have been moved to Azure Devops (not my first choice but there's a bias towards Microsoft products around here lol) and we have have TestComplete.  We're moving towards CI/CD but it will be a slow process. 

Community Leader

I would love to have automated tests running in our software but the software build it self takes ~10 hours. Lowest hanging fruit for us is to speed up the build 🤣

Community Expert

Our back-end CI pipeline is pretty good! We have 90%+unit test coverage, and a substantial amount of integration tests. Our back-end development is PHP, so the integration tests are written in Behat, a BDD framework. The entire build, tests and all, takes less than 30 minutes for each microservice. We are right at the cusp of CD!

The only thing stopping us from "flipping that switch" is the front-end development. There is very little test coverage, and not integrated into CI. New features on the back-end sometimes impact front-end, and since front-end always lags behind, we cannot go full CD.

 

The only part that OpenAPI definition has in our workflow, is to import APIs into ReadyAPI where we have final end-to-end tests. This part is, unfortunately, not part of the CI/CD, this is very much a manual process.

Will have to check out the links above, to see if we can improve this. Thanx.

Community Hero

As of now not using CI/CD, we have our own VMs which we are using to test out code or run our Automation script.

Users online (346)
New Here?
Join us and watch the welcome video: