Create environment variables for project, build, and repository URLs

splatteredbits's Avatar

splatteredbits

10 Aug, 2017 07:54 PM

Please add three new environment variables:

  • APPVEYOR_PROJECT_URI: the URI to the project
  • APPVEYOR_BUILD_URI: the URI to the build results for the current build
  • APPVEYOR_REPO_URI: the URI to the source control repository; the URI used to clone the repository.

Right now, I have some automation in place that needs this, and I have to construct these based on the other APPVEYOR environment variables:

$accountName = Get-EnvironmentVariable 'APPVEYOR_ACCOUNT_NAME'
$projectSlug = Get-EnvironmentVariable 'APPVEYOR_PROJECT_SLUG'
$projectUri = 'https://ci.appveyor.com/project/{0}/{1}' -f $accountName,$projectSlug
$buildVersion = Get-EnvironmentVariable 'APPVEYOR_BUILD_VERSION'
$buildUri = '{0}/build/{1}' -f $projectUri,$buildVersion
$buildInfo.BuildUri = $buildUri
$buildInfo.JobUri = $projectUri
$baseUri = ''
switch( (Get-EnvironmentVariable 'APPVEYOR_REPO_PROVIDER') )
{
    'gitHub'
    {
        $baseUri = 'https://github.com'
    }
    default
    {
        Write-Error -Message ('Unsupported AppVeyor source control provider ''{0}''. If you''d like us to add support for this provider, please submit a new issue at https://github.com/webmd-health-services/Whiskey/issues. Copy/paste your environment variables from this build''s output into your issue.' -f $_)
    }
}
$repoName = Get-EnvironmentVariable 'APPVEYOR_REPO_NAME'
$buildInfo.ScmUri = '{0}/{1}.git' -f $baseUri,$repoName
  1. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:19 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

21 Aug, 2019 11:06 PM
21 Aug, 2019 02:08 PM
21 Aug, 2019 01:37 PM
21 Aug, 2019 10:21 AM
21 Aug, 2019 09:10 AM

 

21 Aug, 2019 05:56 AM
21 Aug, 2019 03:08 AM
20 Aug, 2019 11:33 PM
20 Aug, 2019 08:07 PM
20 Aug, 2019 05:50 PM
20 Aug, 2019 12:35 PM