1

I have a variable group called versions, with one variable named dev, with a value of 0.0.0. I am trying to update the value of this variable when the pipeline runs.

azure-pipeline.yml

- task: AzureCLI@2
  displayName: Update environment variable
  inputs:
    azureSubscription: '<Azure Connection Name>'
    scriptType: 'bash'
    scriptLocation: 'inlineScript'
    inlineScript: |
      'az pipelines variable-group variable update
      --group-id 83
      --name dev
      --org <Organization Name>
      --project <Project Name>
      --value d0.0.3'

When I run this, it fails and gives me an error saying:

--group-id 83
--name dev
--org <Organization Name>
--project <Project Name>
--value d0.0.3: No such file or directory
##[error]Script failed with exit code: 127
/usr/bin/az account clear
Finishing: Update environment variable

I made sure that I have full access to the variable group. What would cause this error? I made sure my values were accurate so I assume I'm missing something within this script.

agw2021
  • 107
  • 7

1 Answers1

0

You are trying to update variable in a variable group with the az pipelines variable-group variable update command.

Make sure to include prompt-value parameter if you have secret variables and mentioned it under value.

  • prompt-value: Set to true to update the value of a secret variable using environment variable or prompt via standard input. Accepted values are false and true.

  • secret: Optional. Indicates whether the variable's value is kept secret. Accepted values are false and true.

  • value: Updates the value of the variable. For secret variables, use the prompt-value parameter to be prompted to enter it via standard input. For non-interactive consoles, it can be picked from environment variable prefixed with AZURE_DEVOPS_EXT_PIPELINE_VAR_. For example, a variable named MySecret can be input using the environment variable AZURE_DEVOPS_EXT_PIPELINE_VAR_MySecret.

After following above steps, if you still get the ##[error]Script failed with exit code: 127 error, then do check your directory/file path. How to fix bash 127 error return code

You can refer to How to Increase/Update Variable Group value using Azure Devops Build Definition?, Updating Variable Groups from an Azure DevOps pipeline and Understanding Azure DevOps Variables

DeepDave-MT
  • 1,861
  • 1
  • 5
  • 18