Skip to content

Instantly share code, notes, and snippets.

@marcosborges
Created March 3, 2023 19:00
Show Gist options
  • Save marcosborges/3499ecfc37e9a2b213fa25ff0dc74cd2 to your computer and use it in GitHub Desktop.
Save marcosborges/3499ecfc37e9a2b213fa25ff0dc74cd2 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Definir variáveis de ambiente
ORGANIZATION="minhaorganizacao"
PROJECT="meuprojeto"
VAR_GROUP_NAME="nome_do_variable_group"
VAR_NAME="nome_da_variavel"
# Fazer a requisição para a API de Variable Groups do Azure DevOps e filtrar a resposta para encontrar o Variable Group e a variável com o nome especificado
response=$(curl -s -u ":$(pat)" \
"https://dev.azure.com/${ORGANIZATION}/${PROJECT}/_apis/distributedtask/variablegroups?groupName=${VAR_GROUP_NAME}&api-version=6.0-preview.2" \
| jq -r ".value[0].variables[] | select(.name == \"${VAR_NAME}\")")
# Exibir o resultado
echo "${response}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment