Quantcast
Channel: Chaminda's DevOps Journey with MSFT
Viewing all articles
Browse latest Browse all 342

Prevent Checking Out the Repo in CD YAML Pipeline

$
0
0

In the previous post “Trigger Deployment YAML Pipeline Once YAML Build Completed” (https://chamindac.blogspot.com/2020/10/trigger-deployment-yaml-pipeline-from.html) we have discussed how to separate the deployment pipeline from the build pipeline, in Azure DevOps YAML pipeline implementations and to trigger a CD pipeline from the CI build once completed. However, if you check carefully that post implementation of CD it is still checking out the code repository, even though it is not necessary to checkout code being the deployment pipeline. Let’s see how we can avoid checking out repo in the CD YAML.

Problem

CD YAML below checks out the repo.

resources:

  pipelines:
  - pipelineApp_CI  
    project:  YAML_CICD 
    sourceApp.CI  
    triggertrue

stages:
stageDev
  displayNameDeploy to Dev
  jobs:
  - jobDeployDev
    pool:
      vmImage'windows-latest'
    steps:
    - pwsh: |
        Write-Host "Deploy to Dev"
        Write-Host "We do nothing here"


Solution

You can add the below step to prevent check out of the repo in the CD YAML.

    steps:
    - checkoutnone

The full pipeline would be as below.

resources:
  pipelines:
  - pipelineApp_CI  
    project:  YAML_CICD 
    sourceApp.CI  
    triggertrue

stages:
stageDev
  displayNameDeploy to Dev
  jobs:
  - jobDeployDev
    pool:
      vmImage'windows-latest'
    steps:
    - checkoutnone

    - pwsh: |
        Write-Host "Deploy to Dev"
        Write-Host "We do nothing here"

Execution of this CD pipeline does not check out repo as you can see blow.




Viewing all articles
Browse latest Browse all 342

Trending Articles