Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using variables/variablegroups from devops library in body #44

Open
rasmusskov opened this issue Nov 17, 2021 · 2 comments
Open

Using variables/variablegroups from devops library in body #44

rasmusskov opened this issue Nov 17, 2021 · 2 comments

Comments

@rasmusskov
Copy link

I have defined some Variable Groups in my devops project, and is updating the values in there when pre-deploying my repository.
When doing the actual release, i would like to compose an email, where the body contains some of the values of the variables.

Something like

Release completed for the sandbox. Releaseno is $LibraryName$VariableName

Is this possible, and can someone help with the syntax?

@Gudui
Copy link

Gudui commented Jan 20, 2023

@rasmusskov did you ever try? Did it work?

@rasmusskov
Copy link
Author

@Gudui Didnt really get an aswer in here, so kept investigating.

I am using the devops api for this... Sample code something like below

 if ($null -eq $ENV:SYSTEM_ACCESSTOKEN)
    {
        Write-Error "No access token provided. Enable 'Allow scripts to access the OAuth token' in Deployment Group Job"
    }

    $URL = "$($ENV:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$($ENV:SYSTEM_TEAMPROJECTID)/_apis/distributedtask/variablegroups"

    $variablegroups = Invoke-RestMethod -Uri $url -Headers @{
        Authorization = "Bearer $ENV:SYSTEM_ACCESSTOKEN" # Provided by ADO thanks to OAuth checkbox
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants