AWS CodePipeline is a continuous delivery service you can use to model, visualise, and automate the steps required to release your software. The service currently supports GitHub, AWS CodeCommit, Amazon ECR and Amazon S3 as source providers. This blog post will cover how to integrate AWS CodePipeline with Azure Repos Git.

Architecture Overview

Users check-in code in Azure Repos Git. The azure build pipeline triggers and publishes the code to S3 bucket using Amazon S3 upload task. It places a zipped copy of the repository into a versioned S3 bucket. AWS CodePipeline can then use the zip file in S3 as a source; the pipeline will be triggered whenever the Azure Repos Git repository is updated.

 

There are 2 steps required in this process-

Setup of Azure Build Pipeline:

Create Azure Build Pipeline to Push the code to S3 bucket in AWS. Add “Archive files” task and “Amazon S3 Upload” task and configure them.

Note: In Archive Files task, make sure you uncheck the option “Prepend root folder name to archive paths

Create AWS credentials (service connection) by clicking New and then providing Name, Access Key ID and Secret Access Key

Provide region, bucket name, folder name in the bucket where the zip file will be placed. If the bucket does not exist it can be created if the Create S3 bucket if it does not exist option is selected. Make sure the bucket is version enabled.

 

 

Make sure the that the Triggers is set “Enable continuous integration“. whenever the code changes happen to the project, it will trigger this build pipeline.

When you run this build, the code will be zipped and moved to S3 bucket.

 

Setup of AWS CodePipeline:

Create the bucket before create Azure build pipeline or leave the creation of bucket on Azure build pipeline. Later enable versioning on the bucket.

Open CodePipeline and create Pipeline by setting a Source as Amazon S3.

 

Whenever there is new zip file posted to S3 bucket, it will trigger this CodePipeline to start the build.

 

This way you can keep your source code in Azure Repos Git and still use AWS CodePipeline to build and deploy in AWS using AWS services.