Transforming CI/CD Pipelines for AI-Assisted Coding: Strategies and Best Practices

Here's how developers can enhance their CI/CD processes to leverage AI-powered coding tools more effectively.

Christopher Tozzi, Technology analyst

April 4, 2024

5 Min Read
robot typing on a keyboard
Alamy

Asking ChatGPT to generate one-off code snippets or churning out boilerplate code with help from Copilot is one way to get started with AI in software development. But if you want to adopt AI-assisted coding systematically and at scale, you need to build AI-based coding practices into your continuous integration/continuous delivery (CI/CD) pipeline.

How do you do that, exactly? That's a complicated question. Let's explore it by talking through the ways in which developers should update their CI/CD pipelines and strategies to take advantage of AI-assisted coding tools.

To be clear, I'm not referring here to using AI to govern CI/CD processes. Much has already been written about using AI for software testing during CI/CD, for instance, or managing code branches with help from AI. Those are examples of how AI can bring efficiency and reliability to CI/CD itself.

That's interesting, but what I'd like to discuss here is something different. I'm focused on how CI/CD pipelines should adapt to enable AI-assisted coding — in other words, how developers can update their CI/CD processes in ways that help them take greater advantage of AI-powered coding tools and workflows.

How AI-Assisted Programming Impacts CI/CD

Let's begin by discussing why CI/CD strategies must evolve if teams want to take advantage of AI for software development.

Related:What Is a Software Developer and What's the Best Way to Become One?

The reason is simple enough: As the set of processes that developers follow when building software, CI/CD pipelines play a foundational role in keeping development operations consistent and repeatable. If you want to make AI a part of your development process in a systematic and repeatable way, you need to bake AI-assisted coding into your CI/CD strategy.

Put another way, developers who write, test, or otherwise manage code with help from AI-powered tools need to ensure that their CI/CD pipelines are optimized for the use of AI as a software development solution. This is important because most existing CI/CD pipelines and tools were designed before AI-assisted coding became widespread, and they therefore require some modifications to accommodate the unique challenges of AI-based software development.

Best Practices for Preparing CI/CD Pipelines for AI

Every software project and CI/CD pipeline is unique, of course, and there's no one-size-fits-all approach to optimizing CI/CD processes for AI-assisted coding. But the following practices are likely to help many teams.

Tag AI-generated code

Most source code management tools, including Git, support tagging features that let developers apply labels to specific snippets of code. Teams that adopt AI-assisted coding should use these labels to identify code that was generated wholly or partially by AI.

Related:Software Development for the Education Sector: What Coders Need to Know

This is an important part of a CI/CD strategy because AI-generated code is, on the whole, less reliable than code written by a skilled human developer. For that reason, it may sometimes be necessary to run extra tests on AI-generated code — or even remove it from a codebase in the event that it triggers unexpected bugs. If you systematically label AI-produced code during the CI/CD process, you can easily treat that code differently.

Write special tests for AI-generated code

Along similar lines, some teams may find it valuable to deploy extra tests for AI-generated code during the testing phase of their CI/CD pipelines, both to ensure software quality and to catch any vulnerable code or dependencies that AI introduces into a codebase.

Running those tests is likely to result in a more complex testing process because there will be two sets of tests to manage: those that apply only to AI-generated code, and those that apply to all code. Thus, the testing stage of CI/CD is likely to become more complicated for teams that use AI tools.

Implement stricter access controls

In some cases, development teams may need to allow AI coding tools to access some of their codebase. But if those tools are provided by third-party vendors, you may not want to expose all of your code to the tools. You might wish to avoid letting a tool like Copilot view all of your proprietary code, for example.

For that reason, AI-assisted coding may necessitate stricter access controls within the CI/CD pipeline. Developers will need to build policies that determine which code or other data AI services can read and how long they can access it for.

Modify software release strategies and expectations

The use of AI-assisted coding tools may accelerate CI/CD pipelines, enabling faster releases. But it could also have the opposite effect: If AI-generated code requires more review or testing, it could actually slow down CI/CD.

Either way, it's important for teams to assess the impact AI coding tools have on their ability to get new application releases into production, then modify their release strategy — not to mention stakeholder expectations — accordingly. You don't want your boss to expect you to begin releasing multiple times a day just because you're now able to write some code using AI if your overall development velocity hasn't changed. Likewise, if you can dramatically speed up CI/CD with help from AI, then change your release schedule accordingly.

Conclusion

Given that full-scale use of AI tools to generate code remains relatively novel for many teams, it remains to be seen exactly how CI/CD pipelines will change to accommodate AI-assisted coding. But it's likely that practices like source code management and tagging, access controls, and release scheduling will all need to evolve if teams want to take full advantage of AI in software development.

About the Author

Christopher Tozzi

Technology analyst, Fixate.IO

Christopher Tozzi is a technology analyst with subject matter expertise in cloud computing, application development, open source software, virtualization, containers and more. He also lectures at a major university in the Albany, New York, area. His book, “For Fun and Profit: A History of the Free and Open Source Software Revolution,” was published by MIT Press.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like