<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vikas Chauhan</title>
    <description>The latest articles on DEV Community by Vikas Chauhan (@vikkas_chauhan).</description>
    <link>https://dev.to/vikkas_chauhan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3355759%2F5e48c5fb-05bf-463f-b18e-54e8588a7cc6.png</url>
      <title>DEV Community: Vikas Chauhan</title>
      <link>https://dev.to/vikkas_chauhan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vikkas_chauhan"/>
    <language>en</language>
    <item>
      <title>Part-1 | How I Moved from Bitbucket Pipeline to AWS CodeBuild: A Business-Driven CI/CD Migration Story</title>
      <dc:creator>Vikas Chauhan</dc:creator>
      <pubDate>Tue, 15 Jul 2025 05:28:42 +0000</pubDate>
      <link>https://dev.to/vikkas_chauhan/part-1-how-i-moved-from-bitbucket-pipeline-to-aws-codebuild-a-business-driven-cicd-migration-1enf</link>
      <guid>https://dev.to/vikkas_chauhan/part-1-how-i-moved-from-bitbucket-pipeline-to-aws-codebuild-a-business-driven-cicd-migration-1enf</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
When our organization decided to migrate its infrastructure to AWS, one thing became clear:&lt;/p&gt;

&lt;p&gt;“We want everything inside AWS — no more managing a patchwork of tools.”&lt;/p&gt;

&lt;p&gt;At the time, our CI/CD pipeline was built using Bitbucket Pipelines, with scattered usage of:&lt;/p&gt;

&lt;p&gt;Bitbucket Secrets&lt;br&gt;
Custom shell scripts&lt;br&gt;
DockerHub for container images&lt;br&gt;
It worked — but it was fragile, fragmented, and difficult to scale securely.&lt;/p&gt;

&lt;p&gt;As part of the broader AWS-first strategy, I was tasked with moving our entire build, test, and deploy lifecycle into the AWS ecosystem.&lt;/p&gt;

&lt;p&gt;This article walks through:&lt;/p&gt;

&lt;p&gt;What we built using AWS CodeBuild&lt;br&gt;
SonarQube integration for static analysis&lt;br&gt;
JUnit test reporting for visibility&lt;br&gt;
buildspec.yml explained section-by-section&lt;br&gt;
IAM roles needed&lt;br&gt;
Challenges we overcame&lt;br&gt;
Key outcomes we achieved&lt;br&gt;
Why We Moved to AWS CodeBuild&lt;/p&gt;

&lt;p&gt;Prime reasons for the migration&lt;br&gt;
This wasn’t just about replacing Bitbucket — it was about building a resilient, secure, and scalable pipeline inside AWS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Our AWS-Native CI/CD Architecture&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CodeBuild Project Architecture&lt;br&gt;
SonarQube Integration — Continuous Code Quality&lt;br&gt;
One of our most important additions was integrating SonarQube scanning into every build.&lt;/p&gt;

&lt;p&gt;Why it matters:&lt;/p&gt;

&lt;p&gt;Detects bugs, vulnerabilities, and code smells early&lt;br&gt;
Enforces coding standards and quality gates&lt;br&gt;
Helps developers write better, cleaner code every day&lt;br&gt;
How I did it:&lt;/p&gt;

&lt;p&gt;Installed the scanner tool dynamically&lt;br&gt;
Pulled tokens securely from AWS Secrets Manager&lt;br&gt;
Triggered scans before and after builds&lt;br&gt;
Integrated dashboards for team visibility&lt;br&gt;
This made code quality a daily practice, not an afterthought.&lt;/p&gt;

&lt;p&gt;JUnit Test Reporting — Real-Time Feedback&lt;br&gt;
Another win from this migration was getting test feedback directly in the AWS CodeBuild console through JUnit reports.&lt;/p&gt;

&lt;p&gt;What Changed:&lt;br&gt;
Configured test runners (like dotnet test) to emit JUnit-compatible .trx reports&lt;br&gt;
Declared test reports in the buildspec.yml&lt;br&gt;
These reports now show pass/fail metrics directly in the AWS UI, and can be passed to CodePipeline stages or Slack alerts.&lt;br&gt;
Why It Matters:&lt;/p&gt;

&lt;p&gt;🧩 &lt;strong&gt;Breaking Down the buildspec.yml — Phase by Phase&lt;/strong&gt;&lt;br&gt;
The buildspec.yml is the backbone of AWS CodeBuild. Here’s a breakdown of each section we implemented — what it does, and why it matters.&lt;/p&gt;

&lt;p&gt;🔧 &lt;strong&gt;Version Declaration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Specifies the buildspec syntax version. 0.2 enables advanced features like reports, runtime versions, and more structured phase control.&lt;/p&gt;

&lt;p&gt;🔍 &lt;strong&gt;Install Phase&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🧠 Purpose:&lt;/p&gt;

&lt;p&gt;Install essential tools like jq for parsing secrets and dotnet-sonarscanner for code analysis&lt;br&gt;
Add the tools to the PATH so they’re available in all phases.&lt;/p&gt;

&lt;p&gt;⚙️ &lt;strong&gt;Pre-Build Phase&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🧠 Purpose:&lt;/p&gt;

&lt;p&gt;Clean any residual build files&lt;br&gt;
Ensure submodules are available for use&lt;br&gt;
Login to Amazon ECR&lt;br&gt;
Securely fetch credentials and secrets dynamically.&lt;/p&gt;

&lt;p&gt;🏗️ &lt;strong&gt;Build Phase&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🧠 Purpose:&lt;/p&gt;

&lt;p&gt;Run code quality checks (SonarQube).&lt;br&gt;
Build and test the application.&lt;br&gt;
Output test results in JUnit-compatible format.&lt;br&gt;
Build Docker image and tag it.&lt;/p&gt;

&lt;p&gt;📦 &lt;strong&gt;Post-Build Phase&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🧠 Purpose:&lt;/p&gt;

&lt;p&gt;Push Docker image to ECR.&lt;br&gt;
Clean up local image cache to reduce space usage.&lt;/p&gt;

&lt;p&gt;📊 &lt;strong&gt;Artifacts and Test Reports&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🧠 Purpose:&lt;/p&gt;

&lt;p&gt;Preserve test artifacts and reports.&lt;br&gt;
Allow AWS CodeBuild to display test results graphically in the AWS console.&lt;br&gt;
Enable integration with other tools like AWS CodePipeline or notifications.&lt;/p&gt;

&lt;p&gt;🔐 &lt;strong&gt;IAM Roles and Policies&lt;/strong&gt;&lt;br&gt;
To make this work securely, CodeBuild role was granted permission to:&lt;/p&gt;

&lt;p&gt;Retrieve secrets from AWS Secrets Manager.&lt;br&gt;
Authenticate and push to Amazon ECR.&lt;br&gt;
Stream logs to CloudWatch.&lt;br&gt;
Generate and publish test reports.&lt;br&gt;
IAM trust was granted to codebuild.amazonaws.com, and we scoped all policies with the least-privilege principle.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Objectives Achieved&lt;/strong&gt;&lt;br&gt;
This wasn’t just a migration — it was a transformation. Here’s what we unlocked:&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;br&gt;
This migration wasn’t just about tools — it was about standardizing quality, scaling securely, and moving fast without breaking things.&lt;/p&gt;

&lt;p&gt;With CodeBuild, SonarQube, Secrets Manager, and JUnit reporting, we now have:&lt;/p&gt;

&lt;p&gt;Cleaner builds.&lt;br&gt;
Higher quality code.&lt;br&gt;
Secure pipelines.&lt;br&gt;
Unified AWS-native DevOps.&lt;br&gt;
This is what modern CI/CD looks like — and we’re just getting started.&lt;/p&gt;

&lt;p&gt;👋 Let’s Connect&lt;br&gt;
📢 Follow me for part 2: Migrating from AWS CodeBuild to AWS CodePipeline&lt;br&gt;
🛠️ Reach out if you’re migrating to AWS and need a working model&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
