Add PR validation on VSTS

This commit is contained in:
Nate McMaster 2018-08-10 09:10:09 -07:00
parent a85d99ab8e
commit a7a95c6da1
No known key found for this signature in database
GPG Key ID: A778D9601BD78810
3 changed files with 33 additions and 7 deletions

View File

@ -0,0 +1,17 @@
trigger:
- master
- release/*
# See https://github.com/aspnet/BuildTools
resources:
repositories:
- repository: buildtools
type: github
endpoint: DotNet-Bot GitHub Connection
name: aspnet/BuildTools
ref: refs/heads/release/2.1
phases:
- template: .vsts-pipelines/templates/project-ci.yml@buildtools
parameters:
buildArgs: "/t:CheckUniverse"

14
run.ps1
View File

@ -32,6 +32,9 @@ Re-installs KoreBuild
.PARAMETER ConfigFile .PARAMETER ConfigFile
The path to the configuration file that stores values. Defaults to korebuild.json. The path to the configuration file that stores values. Defaults to korebuild.json.
.PARAMETER CI
Sets up CI specific settings and variables.
.PARAMETER PackageVersionPropsUrl .PARAMETER PackageVersionPropsUrl
(optional) the url of the package versions props path containing dependency versions. (optional) the url of the package versions props path containing dependency versions.
@ -61,8 +64,8 @@ in the file are overridden by command line parameters.
Example config file: Example config file:
```json ```json
{ {
"$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/dev/tools/korebuild.schema.json", "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/master/tools/korebuild.schema.json",
"channel": "dev", "channel": "master",
"toolsSource": "https://aspnetcore.blob.core.windows.net/buildtools" "toolsSource": "https://aspnetcore.blob.core.windows.net/buildtools"
} }
``` ```
@ -81,7 +84,8 @@ param(
[Alias('u')] [Alias('u')]
[switch]$Update, [switch]$Update,
[switch]$Reinstall, [switch]$Reinstall,
[string]$ConfigFile, [string]$ConfigFile = $null,
[switch]$CI,
[string]$PackageVersionPropsUrl = $null, [string]$PackageVersionPropsUrl = $null,
[string]$AccessTokenSuffix = $null, [string]$AccessTokenSuffix = $null,
[string]$RestoreSources = $null, [string]$RestoreSources = $null,
@ -202,7 +206,7 @@ if (!$DotNetHome) {
else { Join-Path $PSScriptRoot '.dotnet'} else { Join-Path $PSScriptRoot '.dotnet'}
} }
if (!$Channel) { $Channel = 'dev' } if (!$Channel) { $Channel = 'master' }
if (!$ToolsSource) { $ToolsSource = 'https://aspnetcore.blob.core.windows.net/buildtools' } if (!$ToolsSource) { $ToolsSource = 'https://aspnetcore.blob.core.windows.net/buildtools' }
if ($PackageVersionPropsUrl) { if ($PackageVersionPropsUrl) {
@ -235,7 +239,7 @@ $korebuildPath = Get-KoreBuild
Import-Module -Force -Scope Local (Join-Path $korebuildPath 'KoreBuild.psd1') Import-Module -Force -Scope Local (Join-Path $korebuildPath 'KoreBuild.psd1')
try { try {
Set-KoreBuildSettings -ToolsSource $ToolsSource -DotNetHome $DotNetHome -RepoPath $Path -ConfigFile $ConfigFile Set-KoreBuildSettings -ToolsSource $ToolsSource -DotNetHome $DotNetHome -RepoPath $Path -ConfigFile $ConfigFile -CI:$CI
Invoke-KoreBuildCommand $Command @MSBuildArguments Invoke-KoreBuildCommand $Command @MSBuildArguments
} }
finally { finally {

9
run.sh
View File

@ -18,6 +18,7 @@ reinstall=false
repo_path="$DIR" repo_path="$DIR"
channel='' channel=''
tools_source='' tools_source=''
ci=false
package_version_props_url='' package_version_props_url=''
asset_root_url='' asset_root_url=''
access_token_suffix='' access_token_suffix=''
@ -48,6 +49,7 @@ __usage() {
echo " --product-build-id <ID> The product build ID for correlation with orchestrated builds." echo " --product-build-id <ID> The product build ID for correlation with orchestrated builds."
echo " -u|--update Update to the latest KoreBuild even if the lock file is present." echo " -u|--update Update to the latest KoreBuild even if the lock file is present."
echo " --reinstall Reinstall KoreBuild." echo " --reinstall Reinstall KoreBuild."
echo " --ci Apply CI specific settings and environment variables."
echo "" echo ""
echo "Description:" echo "Description:"
echo " This function will create a file \$DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be." echo " This function will create a file \$DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be."
@ -216,6 +218,9 @@ while [[ $# -gt 0 ]]; do
--reinstall|-Reinstall) --reinstall|-Reinstall)
reinstall=true reinstall=true
;; ;;
--ci|-[Cc][Ii])
ci=true
;;
--verbose|-Verbose) --verbose|-Verbose)
verbose=true verbose=true
;; ;;
@ -284,11 +289,11 @@ if [ ! -z "$product_build_id" ]; then
msbuild_args[${#msbuild_args[*]}]="-p:DotNetProductBuildId=$product_build_id" msbuild_args[${#msbuild_args[*]}]="-p:DotNetProductBuildId=$product_build_id"
fi fi
[ -z "$channel" ] && channel='dev' [ -z "$channel" ] && channel='master'
[ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools' [ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools'
get_korebuild get_korebuild
set_korebuildsettings "$tools_source" "$DOTNET_HOME" "$repo_path" "$config_file" set_korebuildsettings "$tools_source" "$DOTNET_HOME" "$repo_path" "$config_file" "$ci"
# This incantation avoids unbound variable issues if msbuild_args is empty # This incantation avoids unbound variable issues if msbuild_args is empty
# https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u # https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u