Search code examples
azure-devopsazure-pipelines

Azure Pipelines ManualValidation@0 task - can I format the instructions?


I have a manual validation task in my pipeline. It shows some script which a user needs to use/run before the pipeline proceeds. (The user must log in to a remote machine in order to execute the provided code - as a security precaution/validation).

It would be really nice if I could format the instructions with markup (to make the code easier to copy) - is this possible? It doesn't appear to be, but thought I'd ask in case there's some secret sauce required.


Solution

  • According to the ManualValidation@0 task in Azure Pipelines, the instructions field is a string that accepts only plain text.

    However, you can make the instructions clearer by organizing the text well. For example, you can use line breaks and indentation to make the code easier to read and copy. Here is a simple example:

    jobs:
      - job: waitForValidation
        displayName: Wait for external validation
        pool: server
        timeoutInMinutes: 4320 # job times out in 3 days
        steps:
        - task: ManualValidation@0
          inputs:
            notifyUsers: 'user@example.com'
            instructions: |
              Please log in to the remote machine to execute the following script:
    
              ```````````````````````
              Write-Host "Hello "
              Write-Host "World "
              for ($i = 1; $i -le 3; $i++) {
                  $currentDateTime = Get-Date
                  Write-Output "Current time is: $currentDateTime"
                  Start-Sleep -Seconds 1
              }
              //your other code here
              ```````````````````````
    
              Once the above is done, please resume the pipeline.
            onTimeout: 'reject'
    

    In this way, although you cannot use additional formatting, you can still provide clear and structured instructions.

    copy

    If you still need to format the instructions with markup, you can also request the feature for Azure DevOps here to help the feature better.