skip to Main Content

I’m trying to provide user input during pipeline runtime but not able to give it. is there any way I can achieve this in azure pipeline apart from using parameters or using key vault to provide the input during manual validation.

Tried creating an ansible task to prompt the user to enter the input but not able to achieve it.

2

Answers


  1. Azure DevOps build pipelines are non-interactive, and there is no way to ask for user input during a pipeline run, unless you are using manual intervention and changing data in third party storage areas/vault like you suggest.

    You can suggest the feature here, and it may get developed.

    Login or Signup to reply.
  2. Since Azure Pipelines are non-interactive, there is no way out-of-the-box to input variable values during a pipeline run.

    While inspired by @ScottRichards insightful answer, you may consider using the workaround below to update the values of the variables from pipelines library (variable group) during the process of a running pipeline.

    Here is a simple YAML pipeline to use a variable group (in the job scope).

    stages:
    - stage: StageA
      jobs:
      - job: Job1
        variables:
        - group: VG-Job
        steps:
        - script: echo $(Var1)
    
      - job: Job2
        dependsOn: Job1
        variables:
        - group: VG-Job
        steps:
        - script: echo $(Var1)
    
    1. Setup the variable group with the name VG-Job; in the variable group, add a variable $(Var1) with the original value ValueXXXXX;
      enter image description here
    2. Enable Approvals check for this variable group;
      enter image description here
      enter image description here
    3. When running the pipeline, it will suspend the execution of StageA to wait for the approval by the approver to use the variable group resource VG-Job;
      enter image description here
    4. Before approval, the approver may update the value of the variable $(Var1) in this variable group and proceed to approve and resume the pipeline stage;
      enter image description here
    5. The output value of the variable $(Var1) during the pipeline run will be the updated value ValueYYYYY rather than its original value ValueXXXXX, since the value of a variable in a variable group is processed at runtime;
      enter image description here

    Kindly be also advised that,

    Checks are a mechanism available to the resource owner to control if and when a stage in a pipeline can consume a resource (like variable group in our case). As an owner of a resource, such as an environment (variable group), you can define checks that must be satisfied before a stage consuming that resource can start.

    This is to say for Job2 in the same stage as that of Job1, it will not suspend the pipeline again to ask for approval.

    Hope the workaround may help resolve your queries.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search