Files
importer-labs/azure_devops/3-dry-run.md
T
2022-09-07 16:57:06 -07:00

2.9 KiB

Perform a dry-run of an Azure DevOps pipeline

In this lab you will use the dry-run command to convert an Azure DevOps pipeline to its equivalent GitHub Actions workflow.

Prerequisites

  1. Followed the steps here to set up your Codespace environment and bootstrap an Azure DevOps project.
  2. Completed the configure lab.
  3. Completed the audit lab.

Perform a dry run

We will be performing a dry-run for a pipeline in the bootstrapped Azure DevOps project. We will need to answer the following questions before running this command:

  1. What is the id of the pipeline to convert?

  2. Where do we want to store the result?

    • ./tmp/dry-run-lab. This can be any path within the working directory that Valet commands are executed from.

Steps

  1. Navigate to the codespace terminal

  2. Run the following command from the root directory:

    gh valet dry-run azure-devops pipeline --pipeline-id :pipeline_id -o tmp/dry-run-lab
    
  3. The command will list all the files written to disk when the command succeeds.

  4. View the converted workflow:

    • Find ./tmp/dry-run-lab in the file explorer pane in codespaces.
    • Click valet-pipeline1.yml to open.

Inspect the output files

The files generated from the dry-run command represent the equivalent Actions workflow for the given Azure DevOps pipeline. The Azure DevOps pipeline and converted workflow can be seen below:

Azure DevOps pipeline 👇
trigger:
- main

pool:
  vmImage: windows-latest

steps:
- script: echo Hello, I am pipeline 1!
  displayName: 'Run a one-line script'

- script: |
    echo Add other tasks to build, test, and deploy your project.
    echo See https://aka.ms/yaml
  displayName: 'Run a multi-line script'
Converted workflow 👇
name: valet-bootstrap/pipelines/valet-pipeline1
on:
  push:
    branches:
    - main
jobs:
  build:
    runs-on: windows-latest
    steps:
    - name: checkout
      uses: actions/checkout@v2
    - name: Run a one-line script
      run: echo Hello, I am pipeline 1!
    - name: Run a multi-line script
      run: |-
        echo Add other tasks to build, test, and deploy your project.
        echo See https://aka.ms/yaml

Despite these 2 pipelines using different syntax they will function equivalently.

Next lab

Use custom transformers to customize Valet's behavior