hassaanch avatar

azure-devops-pipeline

This skill should be used when users need to generate Azure DevOps CI/CD pipelines with Dockerfiles

作者 hassaanch|オープンソース

Azure DevOps Pipeline Generator

Generate production-ready Azure DevOps YAML pipelines with multi-stage builds, Docker containerization, and Helm deployments to AKS.

What This Skill Does

  • Scans repositories to identify frontend and backend project structure
  • Generates optimized multi-stage Dockerfiles for common frameworks
  • Creates Azure DevOps YAML pipelines with Build and Deploy stages
  • Configures ACR (Azure Container Registry) image push
  • Sets up Helm-based deployments to AKS (Azure Kubernetes Service)

What This Skill Does NOT Do

  • Create the actual Azure resources (ACR, AKS clusters)
  • Configure Azure service connections (user must set these up)
  • Write application code or fix code issues
  • Handle secrets management (user responsibility)
  • Manage Kubernetes cluster configuration

Before Implementation

Gather context to ensure successful implementation:

SourceGather
CodebaseProject structure, frameworks used, existing Dockerfiles, existing pipelines
ConversationTarget environments, naming conventions, specific requirements
Skill ReferencesDockerfile patterns from references/, pipeline best practices
User GuidelinesTeam naming conventions, security requirements

Required Clarifications

Ask about USER'S context before generating:

  1. Project Structure: "Does your repo have separate frontend/backend directories, or a monorepo structure?"
  2. Frameworks: "What frameworks are you using? (e.g., React/Vue for frontend, Node.js/Python/.NET for backend)"
  3. Azure Resources: "What are your ACR name and AKS cluster name?"
  4. Environments: "What environments do you need? (e.g., dev, staging, production)"

Optional Clarifications

Ask only if relevant to the user's context:

  1. Helm Charts: "Do you have existing Helm charts, or should I generate them?"
  2. Testing: "Do you want to include a test stage before building?"
  3. Notifications: "Should the pipeline send notifications (Teams, Slack) on completion?"
  4. Security Scanning: "Do you want to include container vulnerability scanning?"

Official Documentation

ResourceURLUse For
Azure Pipelines YAMLhttps://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schemaPipeline syntax reference
Docker Taskhttps://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/docker-v2Docker build/push tasks
HelmDeploy Taskhttps://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/helm-deploy-v0Helm deployment configuration
AKS Deploymenthttps://learn.microsoft.com/en-us/azure/aks/devops-pipelineAKS CI/CD best practices

Workflow

Phase 1: Repository Scan

1. Scan root directory structure
2. Identify frontend project (look for package.json with React/Vue/Angular, or next.config.js)
3. Identify backend project (look for requirements.txt, package.json with server deps, *.csproj, pom.xml)
4. Check for existing Dockerfiles
5. Check for existing azure-pipelines.yml
6. Identify build commands from package.json scripts or other config

Phase 2: Dockerfile Generation

For each identified project component:

1. Determine runtime (Node.js, Python, .NET, Java)
2. Select appropriate base images (prefer Alpine/slim variants)
3. Generate multi-stage Dockerfile:
   - Stage 1: Build environment with dev dependencies
   - Stage 2: Production runtime with minimal footprint
4. Apply security best practices (non-root user, minimal layers)

See references/dockerfile-patterns.md for framework-specific patterns.

Phase 3: Pipeline Generation

1. Create azure-pipelines.yml at repo root
2. Configure trigger (main/master branch)
3. Add Build stage:
   - Docker build for frontend
   - Docker build for backend
   - Push images to ACR with build ID tag
4. Add Deploy stage(s):
   - Helm upgrade/install for each environment
   - Proper dependencies between stages
   - Manual approvals for production

See references/pipeline-patterns.md for stage configurations.

Phase 4: Helm Configuration

1. Generate Helm chart structure if not present
2. Configure values.yaml for each environment
3. Set up image pull from ACR
4. Configure service and ingress

See references/helm-deployment.md for Helm patterns.


Detection Patterns

Frontend Detection

PatternFramework
package.json with reactReact
package.json with vueVue.js
package.json with @angular/coreAngular
next.config.js or next.config.mjsNext.js
nuxt.config.tsNuxt.js

Backend Detection

PatternFramework
package.json with express/fastify/nestNode.js
requirements.txt or pyproject.tomlPython
*.csproj with Microsoft.NET.NET
pom.xml or build.gradleJava
go.modGo

Output Files

FilePurpose
frontend/DockerfileMulti-stage build for frontend
backend/DockerfileMulti-stage build for backend
azure-pipelines.ymlCI/CD pipeline definition
helm/Chart.yamlHelm chart metadata (if generating)
helm/values.yamlDefault Helm values
helm/values-{env}.yamlEnvironment-specific values

Pipeline Structure

trigger:
  branches:
    include:
      - main

variables:
  - group: azure-config  # Contains ACR/AKS settings

stages:
  - stage: Build
    jobs:
      - job: BuildFrontend
      - job: BuildBackend

  - stage: DeployDev
    dependsOn: Build
    condition: succeeded()

  - stage: DeployProd
    dependsOn: DeployDev
    condition: succeeded()

Required Azure Setup (User Responsibility)

Before the pipeline works, users must:

  1. Create ACR: Azure Container Registry for storing images
  2. Create AKS: Azure Kubernetes Service cluster
  3. Attach ACR to AKS: az aks update -n <cluster> -g <rg> --attach-acr <acr>
  4. Create Service Connection: Azure Resource Manager connection in Azure DevOps
  5. Create Variable Group: Store ACR, AKS, and resource group names

Error Handling

IssueSolution
No frontend/backend detectedAsk user to specify directory structure
Unknown frameworkGenerate generic Dockerfile, warn user to customize
Existing files conflictAsk user whether to overwrite or merge
Missing package.json/requirementsGenerate minimal Dockerfile, note dependencies needed

Output Checklist

Before delivering, verify:

  • Repository structure correctly identified
  • Dockerfiles use multi-stage builds
  • Dockerfiles use non-root user for security
  • Pipeline has separate Build and Deploy stages
  • ACR push configured with proper tags
  • Helm deployment uses correct task version
  • Environment-specific values files created
  • Production stage has manual approval gate

Reference Files

FileWhen to Read
references/dockerfile-patterns.mdWhen generating Dockerfiles for specific frameworks
references/pipeline-patterns.mdWhen structuring pipeline stages and tasks
references/helm-deployment.mdWhen configuring Helm charts and AKS deployment
azure-devops-pipeline - Claude Code・Cursor 対応の AIエージェント Skill | Agent Skills