From 0f75a7df94246b873a04bee2805c27305b4da524 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Fri, 27 Jul 2018 10:13:38 -0700 Subject: [PATCH] Adding VSTS configuration (#126) --- .appveyor.yml | 3 + .travis.yml | 2 +- .vsts-pipelines/builds/ci-internal.yml | 13 ++++ .vsts-pipelines/builds/ci-public.yml | 15 ++++ .../templates/server-tests-steps.yml | 20 ++++++ build/dependencies.props | 34 ++++----- install-nginx.sh | 6 -- test/aspnetcore_schema.xml | 39 ++++++++++ test/aspnetcore_schema_v2.xml | 47 ++++++++++++ test/update_schema.ps1 | 72 +++++++++++++++++++ 10 files changed, 227 insertions(+), 24 deletions(-) create mode 100644 .vsts-pipelines/builds/ci-internal.yml create mode 100644 .vsts-pipelines/builds/ci-public.yml create mode 100644 .vsts-pipelines/templates/server-tests-steps.yml delete mode 100755 install-nginx.sh create mode 100644 test/aspnetcore_schema.xml create mode 100644 test/aspnetcore_schema_v2.xml create mode 100644 test/update_schema.ps1 diff --git a/.appveyor.yml b/.appveyor.yml index 1de903ee67..18dc44b97b 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -9,6 +9,9 @@ environment: global: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_CLI_TELEMETRY_OPTOUT: 1 +install: + - ps: .\test\update_schema.ps1 + - net start w3svc build_script: - ps: .\run.ps1 default-build clone_depth: 1 diff --git a/.travis.yml b/.travis.yml index d7b744fc46..7ec025af34 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ branches: before_install: - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl nginx; ln -s /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/; else ./install-nginx.sh; fi + /usr/local/lib/; else apt-get install nginx; fi install: - export PATH="$PATH:$HOME/nginxinstall/sbin/" script: diff --git a/.vsts-pipelines/builds/ci-internal.yml b/.vsts-pipelines/builds/ci-internal.yml new file mode 100644 index 0000000000..fc863b836b --- /dev/null +++ b/.vsts-pipelines/builds/ci-internal.yml @@ -0,0 +1,13 @@ +trigger: +- master +- release/* + +resources: + repositories: + - repository: buildtools + type: git + name: aspnet-BuildTools + ref: refs/heads/release/2.2 + +phases: +- template: ../templates/server-tests-steps.yml diff --git a/.vsts-pipelines/builds/ci-public.yml b/.vsts-pipelines/builds/ci-public.yml new file mode 100644 index 0000000000..aeaa4e5a1a --- /dev/null +++ b/.vsts-pipelines/builds/ci-public.yml @@ -0,0 +1,15 @@ +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.2 + +phases: +- template: ../templates/server-tests-steps.yml diff --git a/.vsts-pipelines/templates/server-tests-steps.yml b/.vsts-pipelines/templates/server-tests-steps.yml new file mode 100644 index 0000000000..6b83801909 --- /dev/null +++ b/.vsts-pipelines/templates/server-tests-steps.yml @@ -0,0 +1,20 @@ +phases: +- template: .vsts-pipelines/templates/phases/default-build.yml@buildtools + parameters: + agentOs: Windows + beforeBuild: + - powershell: "& ./test/update_schema.ps1" + - powershell: Restart-Service w3svc + +- template: .vsts-pipelines/templates/phases/default-build.yml@buildtools + parameters: + agentOs: macOS + beforeBuild: + - script: brew install nginx + +- template: .vsts-pipelines/templates/phases/default-build.yml@buildtools + parameters: + agentOs: Linux + beforeBuild: + - script: apt-get update + - script: apt-get install libpcre3 libpcre3-dev nginx diff --git a/build/dependencies.props b/build/dependencies.props index 1d5687e670..a48a35722f 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,33 +1,33 @@ - + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 2.2.0-preview1-17099 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 - 2.2.0-preview1-34755 + 2.2.0-preview1-34806 + 2.2.0-preview1-34806 + 2.2.0-preview1-34806 + 2.2.0-preview1-34806 + 2.2.0-preview1-34806 + 2.2.0-preview1-34806 + 2.2.0-preview1-34806 + 2.2.0-preview1-34806 + 2.2.0-preview1-34806 + 2.2.0-preview1-34806 + 2.2.0-preview1-34806 + 2.2.0-preview1-34806 + 2.2.0-preview1-34806 + 2.2.0-preview1-34806 2.0.9 2.1.2 2.2.0-preview1-26618-02 - 2.2.0-preview1-34755 + 2.2.0-preview1-34806 15.6.1 2.0.3 1.4.0 3.2.0 2.3.1 - 2.4.0-rc.1.build4038 + 2.4.0 diff --git a/install-nginx.sh b/install-nginx.sh deleted file mode 100755 index 9564813c2d..0000000000 --- a/install-nginx.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -curl -sSL http://nginx.org/download/nginx-1.8.0.tar.gz | tar zxfv - -C /tmp && cd /tmp/nginx-1.8.0/ -./configure --prefix=$HOME/nginxinstall --with-http_ssl_module -make -make install diff --git a/test/aspnetcore_schema.xml b/test/aspnetcore_schema.xml new file mode 100644 index 0000000000..c1590816b7 --- /dev/null +++ b/test/aspnetcore_schema.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/aspnetcore_schema_v2.xml b/test/aspnetcore_schema_v2.xml new file mode 100644 index 0000000000..d65be07195 --- /dev/null +++ b/test/aspnetcore_schema_v2.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/update_schema.ps1 b/test/update_schema.ps1 new file mode 100644 index 0000000000..f3cba7de92 --- /dev/null +++ b/test/update_schema.ps1 @@ -0,0 +1,72 @@ +<# +.DESCRIPTION +Updates aspnetcore_schema.xml to the latest version. +Updates aspnetcore_schema_v2.xml to the latest version. +Requires admin privileges. +#> +[cmdletbinding(SupportsShouldProcess = $true)] +param() + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 1 + +$ancmSchemaFiles = @( + "aspnetcore_schema.xml", + "aspnetcore_schema_v2.xml" +) + +$ancmSchemaFileLocations = @( + @(Resolve-Path "$PSScriptRoot\aspnetcore_schema.xml"), + @(Resolve-Path "$PSScriptRoot\aspnetcore_schema_v2.xml") +) + +[bool]$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") + +if (-not $isAdmin -and -not $WhatIfPreference) { + if ($PSCmdlet.ShouldContinue("Continue as an admin?", "This script needs admin privileges to update IIS Express and IIS.")) { + $thisFile = Join-Path $PSScriptRoot $MyInvocation.MyCommand.Name + + Start-Process ` + -Verb runas ` + -FilePath "powershell.exe" ` + -ArgumentList $thisFile ` + -Wait ` + | Out-Null + + if (-not $?) { + throw 'Update failed' + } + exit + } + else { + throw 'Requires admin privileges' + } +} + +for ($i=0; $i -lt $ancmSchemaFiles.Length; $i++) +{ + $schemaFile = $ancmSchemaFiles[$i] + $schemaSource = $ancmSchemaFileLocations[$i] + + $destinations = @( + "${env:ProgramFiles(x86)}\IIS Express\config\schema\", + "${env:ProgramFiles}\IIS Express\config\schema\", + "${env:windir}\system32\inetsrv\config\schema\" + ) + + foreach ($destPath in $destinations) { + $dest = "$destPath\${schemaFile}"; + + if (!(Test-Path $destPath)) + { + Write-Host "$destPath doesn't exist" + continue; + } + + if ($PSCmdlet.ShouldProcess($dest, "Replace file")) { + Write-Host "Updated $dest" + Move-Item $dest "${dest}.bak" -ErrorAction Ignore + Copy-Item $schemaSource $dest + } + } +}