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

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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