2

I currently have a pipeline in Azure which consists of a bunch of YAML which eventually calls some terraform script to handle the deployment side.

What is the best way to handle dev testing of changes to the pipeline?

For example, i want to add a new task in the YAML. There doesnt seem to be a way to test this without actually performing and completing a pull request. I the cases where i do something wrong and the pipeline (say an invalid parameter value) fails i need to do a whole new checkin, push, pull request, merge and then wait for the pipeline to complete or fail.

There has to be a better way?

1 Answer 1

1

Not sure if this helps you? but if you edit it from the portal you can select the branch you are working on and there is a validate option enter image description here

I also add a parameter to my pipelines,

 parameters:
  - name: DebugMode
    displayName: Skip Deployments and run in DebugMode
    type: string
    default: false
    values:
    - false
    - true

Which adds a radio button when you run the Pipeline enter image description here

and then I have a condition to skip the actual deployment task for the debug mode so I can test the logic of my pipelines running them from teh branch I am working on before PR the change in to main.

         steps:
      - ${{ if eq(parameters.DebugMode, false) }}:
        - task: Deploy
          inputs:
            ....
      - ${{ if eq(parameters.DebugMode, true) }}:
        - task: PowerShell@2
          name: DummyDeployment
          displayName: 'Dummy Do Nothing'
          continueOnError: false
          inputs:
            targetType: Inline
            script: |
              echo "In Debug mode running Dummy Deployment"
              echo $buildNumber

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.