Kodeloka
  1. Kodeloka
  2. Kelas Git & CI/CD
  3. Materi

Azure DevOps · Modul 17 dari 20

Azure DevOps Tutorial for Beginners | CI/CD with Azure Pipelines

Pengenalan Azure DevOps, Azure Repos, Azure Pipelines (YAML), Build Agents, Deployment Gates, dan Release Pipelines.

1. Komponen Ekosistem Azure DevOps

  • Azure Boards: Pengelolaan proyek Agile, Kanban, dan backlog tiket.
  • Azure Repos: Repositori Git ter-hosting.
  • Azure Pipelines: Engine CI/CD berbasis YAML untuk membangun dan menyebarkan kode ke cloud mana pun (Azure, AWS, GCP, On-Premise).
  • Azure Artifacts: Package feed management (NuGet, npm, Maven).

2. Contoh Berkas azure-pipelines.yml

azure-pipelines.yml
trigger:
  - main

pool:
  vmImage: 'ubuntu-latest'

variables:
  buildConfiguration: 'Release'

stages:
- stage: Build
  displayName: 'Build Stage'
  jobs:
  - job: BuildJob
    steps:
    - task: UseDotNet@2
      inputs:
        packageType: 'sdk'
        version: '8.x'

    - script: dotnet build --configuration $(buildConfiguration)
      displayName: 'dotnet build'

    - script: dotnet test
      displayName: 'dotnet test'

- stage: Deploy
  displayName: 'Deploy Stage'
  dependsOn: Build
  condition: succeeded()
  jobs:
  - deployment: DeployWeb
    environment: 'production'
    strategy:
      runOnce:
        deploy:
          steps:
          - script: echo "Deploying to Azure App Service..."