Use --ci when running CI scripts

This commit is contained in:
Pranav K 2018-03-07 15:01:04 -08:00
Родитель e78144fea7
Коммит 7addc9d681
8 изменённых файлов: 36 добавлений и 33 удалений

Просмотреть файл

@ -6,12 +6,8 @@ branches:
- /^release\/.*$/
- /^(.*\/)?ci-.*$/
build_script:
- ps: .\run.ps1 default-build
- ps: .\run.ps1 -CI default-build
clone_depth: 1
environment:
global:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: 1
test: 'off'
deploy: 'off'
os: Visual Studio 2017

Просмотреть файл

@ -1,10 +1,6 @@
language: csharp
sudo: false
dist: trusty
env:
global:
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
- DOTNET_CLI_TELEMETRY_OPTOUT: 1
mono: none
os:
- linux
@ -24,4 +20,4 @@ before_install:
/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
/usr/local/lib/; fi
script:
- ./build.sh
- ./build.sh --ci

Просмотреть файл

@ -5,11 +5,6 @@ simpleNode('Ubuntu16.04', 'latest-or-auto-docker') {
checkout scm
}
stage ('Build') {
environment {
DOTNET_CLI_TELEMETRY_OPTOUT = 'true'
DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 'true'
}
sh './build.sh'
sh './build.sh --ci'
}
}

Просмотреть файл

@ -5,11 +5,6 @@ simpleNode('OSX10.12','latest') {
checkout scm
}
stage ('Build') {
environment {
DOTNET_CLI_TELEMETRY_OPTOUT = 'true'
DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 'true'
}
sh './build.sh'
sh './build.sh --ci'
}
}

Просмотреть файл

@ -7,11 +7,6 @@ simpleNode('Windows_NT','latest') {
checkout scm
}
stage ('Build') {
environment {
DOTNET_CLI_TELEMETRY_OPTOUT = 'true'
DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 'true'
}
bat '.\\run.cmd default-build'
bat '.\\run.cmd -CI default-build'
}
}

Просмотреть файл

@ -1,2 +1,2 @@
version:2.1.0-preview2-15728
commithash:393377068ddcf51dfee0536536d455f57a828b06
version:2.1.0-preview2-15740
commithash:bd6837684b57e50ffabfb564645013199585bd6d

16
run.ps1
Просмотреть файл

@ -26,12 +26,18 @@ The base url where build tools can be downloaded. Overrides the value from the c
.PARAMETER Update
Updates KoreBuild to the latest version even if a lock file is present.
.PARAMETER Reinstall
Re-installs KoreBuild
.PARAMETER ConfigFile
The path to the configuration file that stores values. Defaults to korebuild.json.
.PARAMETER ToolsSourceSuffix
The Suffix to append to the end of the ToolsSource. Useful for query strings in blob stores.
.PARAMETER CI
Sets up CI specific settings and variables.
.PARAMETER Arguments
Arguments to be passed to the command
@ -65,8 +71,10 @@ param(
[string]$ToolsSource,
[Alias('u')]
[switch]$Update,
[string]$ConfigFile,
[switch]$Reinstall,
[string]$ToolsSourceSuffix,
[string]$ConfigFile = $null,
[switch]$CI,
[Parameter(ValueFromRemainingArguments = $true)]
[string[]]$Arguments
)
@ -93,6 +101,10 @@ function Get-KoreBuild {
$version = $version.TrimStart('version:').Trim()
$korebuildPath = Join-Paths $DotNetHome ('buildtools', 'korebuild', $version)
if ($Reinstall -and (Test-Path $korebuildPath)) {
Remove-Item -Force -Recurse $korebuildPath
}
if (!(Test-Path $korebuildPath)) {
Write-Host -ForegroundColor Magenta "Downloading KoreBuild $version"
New-Item -ItemType Directory -Path $korebuildPath | Out-Null
@ -188,7 +200,7 @@ $korebuildPath = Get-KoreBuild
Import-Module -Force -Scope Local (Join-Path $korebuildPath 'KoreBuild.psd1')
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 @Arguments
}
finally {

16
run.sh
Просмотреть файл

@ -14,10 +14,12 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
[ -z "${DOTNET_HOME:-}" ] && DOTNET_HOME="$HOME/.dotnet"
verbose=false
update=false
reinstall=false
repo_path="$DIR"
channel=''
tools_source=''
tools_source_suffix=''
ci=false
#
# Functions
@ -38,6 +40,8 @@ __usage() {
echo " -s|--tools-source|-ToolsSource <URL> The base url where build tools can be downloaded. Overrides the value from the config file."
echo " --tools-source-suffix|-ToolsSourceSuffix <SUFFIX> The suffix to append to tools-source. Useful for query strings."
echo " -u|--update Update to the latest KoreBuild even if the lock file is present."
echo " --reinstall Reinstall KoreBuild."
echo " --ci Apply CI specific settings and environment variables."
echo ""
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."
@ -62,6 +66,10 @@ get_korebuild() {
version="$(echo "${version#version:}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version"
if [ "$reinstall" = true ] && [ -d "$korebuild_path" ]; then
rm -rf "$korebuild_path"
fi
{
if [ ! -d "$korebuild_path" ]; then
mkdir -p "$korebuild_path"
@ -175,6 +183,12 @@ while [[ $# -gt 0 ]]; do
-u|--update|-Update)
update=true
;;
--reinstall|-[Rr]einstall)
reinstall=true
;;
--ci)
ci=true
;;
--verbose|-Verbose)
verbose=true
;;
@ -227,5 +241,5 @@ fi
[ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools'
get_korebuild
set_korebuildsettings "$tools_source" "$DOTNET_HOME" "$repo_path" "$config_file"
set_korebuildsettings "$tools_source" "$DOTNET_HOME" "$repo_path" "$config_file" "$ci"
invoke_korebuild_command "$command" "$@"