updated ci scripts and templates
- add script to update downstream dependencies - drop push_packages (rely on appveyor instead) [#153640396]
This commit is contained in:
Родитель
ffd497dee8
Коммит
bb4e1dcd23
|
@ -6,7 +6,7 @@ branches:
|
|||
only:
|
||||
- master
|
||||
- dev
|
||||
- /^update[0-9]{3}/
|
||||
- /^update[0-9]{2}x/
|
||||
environment:
|
||||
global:
|
||||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
|
||||
|
@ -20,6 +20,11 @@ build_script:
|
|||
- ps: steeltoe-ci\scripts\appveyor_build.ps1
|
||||
artifacts:
|
||||
- path: '**\*.nupkg'
|
||||
environment:
|
||||
ProjectList:
|
||||
PackageReferencesToUpdate:
|
||||
github_access_token:
|
||||
secure: zWNiuOqWi+Px1YT4DINZpubbAG29UGZMwjSwBjOGmS2ntOlaA2fNWJi2FW9vIVZB
|
||||
deploy:
|
||||
- provider: NuGet
|
||||
skip_symbols: false
|
||||
|
@ -44,10 +49,16 @@ deploy:
|
|||
- provider: NuGet
|
||||
skip_symbols: true
|
||||
artifact: /.*\.nupkg/
|
||||
server: https://www.myget.org/F/steeltoeupdates/api/v2/package
|
||||
symbol_server: https://www.myget.org/F/steeltoeupdates/symbols/api/v2/package
|
||||
server: https://www.myget.org/F/steeltoestaging/api/v2/package
|
||||
symbol_server: https://www.myget.org/F/steeltoestaging/symbols/api/v2/package
|
||||
api_key:
|
||||
secure: 246ApObnMYYvzDo9Ki72CxxuKfuoqYbrbUK2HLevGIGHXYY6f0OkAdE3EWCwNJ7g
|
||||
on:
|
||||
branch: /^update[0-9]{3}/
|
||||
appveyor_repo_tag: false
|
||||
branch: /^update[0-9]{2}x/
|
||||
appveyor_repo_tag: false
|
||||
after_deploy:
|
||||
- git config --global credential.helper store
|
||||
- ps: Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:github_access_token):x-oauth-basic@github.com`n"
|
||||
- git config --global user.email "steeltoe@pivotal.io"
|
||||
- git config --global user.name "SteeltoeCI"
|
||||
- ps: ci-tools\scripts\update_downstream_props.ps1
|
|
@ -15,7 +15,7 @@ branches:
|
|||
only:
|
||||
- master
|
||||
- dev
|
||||
- /^update[0-9]{3}/
|
||||
- /^update[0-9]{2}x/
|
||||
script:
|
||||
- ./steeltoe-ci/scripts/travis_install.sh
|
||||
- ./steeltoe-ci/scripts/travis_build.sh
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
dotnet build --configuration $env:BUILD_TYPE
|
||||
|
||||
# package each project in the src folder
|
||||
Set-Location src
|
||||
ForEach ($_ in Get-ChildItem -Directory) {
|
||||
If ($env:ProjectList -eq $null){
|
||||
Write-Host "env:ProjectList was not defined - discover and build projects alphabetically"
|
||||
$env:ProjectList = Get-ChildItem -Directory
|
||||
}
|
||||
# build each project in the src folder
|
||||
ForEach ($_ in $env:ProjectList.Split(' ')) {
|
||||
Write-Host "Now building $_..."
|
||||
Set-Location $_
|
||||
|
||||
dotnet restore
|
||||
|
||||
# if there is a tag with the latest commit don't include symbols or source
|
||||
If ($env:APPVEYOR_REPO_TAG_NAME)
|
||||
{
|
||||
Write-Host "Creating package $_.$env:STEELTOE_VERSION$env:STEELTOE_DASH_VERSION_SUFFIX without symbols"
|
||||
dotnet pack --no-build --configuration $env:BUILD_TYPE /p:Version=$env:STEELTOE_VERSION$env:STEELTOE_DASH_VERSION_SUFFIX
|
||||
dotnet pack --configuration $env:BUILD_TYPE /p:Version=$env:STEELTOE_VERSION$env:STEELTOE_DASH_VERSION_SUFFIX -o $env:APPVEYOR_BUILD_FOLDER\localfeed
|
||||
}
|
||||
Else
|
||||
{
|
||||
Write-Host "Creating package $_.$env:STEELTOE_VERSION$env:STEELTOE_DASH_VERSION_SUFFIX with symbols"
|
||||
# include symbols and source
|
||||
dotnet pack --no-build --configuration $env:BUILD_TYPE /p:Version=$env:STEELTOE_VERSION$env:STEELTOE_DASH_VERSION_SUFFIX --include-symbols --include-source
|
||||
dotnet pack --configuration $env:BUILD_TYPE /p:Version=$env:STEELTOE_VERSION$env:STEELTOE_DASH_VERSION_SUFFIX --include-symbols --include-source -o $env:APPVEYOR_BUILD_FOLDER\localfeed
|
||||
}
|
||||
# send package to local feed for use within this build
|
||||
Write-Host "Adding package to local feed for use within this build..."
|
||||
nuget add bin\$env:BUILD_TYPE\$_.$env:STEELTOE_VERSION$env:STEELTOE_DASH_VERSION_SUFFIX.nupkg -Source "$env:USERPROFILE\localfeed"
|
||||
|
||||
Set-Location ..
|
||||
}
|
||||
Set-Location ..
|
|
@ -7,45 +7,46 @@ Write-Host "NuGet package version to build: $env:STEELTOE_VERSION"
|
|||
|
||||
$env:BUILD_TYPE = "Release"
|
||||
|
||||
# if the last commit was tagged, only use version suffixes from the tag itself
|
||||
If ($env:APPVEYOR_REPO_TAG_NAME) {
|
||||
$env:STEELTOE_VERSION_SUFFIX = $env:APPVEYOR_REPO_TAG_NAME.split("-", 2)[1]
|
||||
$env:STEELTOE_DASH_VERSION_SUFFIX = If ($env:STEELTOE_VERSION_SUFFIX) { "-$env:STEELTOE_VERSION_SUFFIX" }
|
||||
# use STEELTOE_VERSION_SUFFIX to set the pre-release version on packages
|
||||
If ($env:APPVEYOR_REPO_BRANCH.SubString(0,6) -eq "update") {
|
||||
# if this build is from an update branch, only use pre-release suffixes from the branch name (if found)
|
||||
$env:STEELTOE_VERSION_SUFFIX = $env:APPVEYOR_REPO_BRANCH.Split("-")[1]
|
||||
}
|
||||
Else {
|
||||
# use this variable to set the version on packages
|
||||
$env:STEELTOE_VERSION_SUFFIX = "$env:APPVEYOR_REPO_BRANCH-" + $env:APPVEYOR_BUILD_NUMBER.ToString().PadLeft(5, "0")
|
||||
# use this variable to refer to dependencies within the current solution that are built during CI builds
|
||||
}
|
||||
# use this variable to refer to dependencies within the current solution that are built during CI builds
|
||||
If ($env:STEELTOE_VERSION_SUFFIX){
|
||||
$env:STEELTOE_DASH_VERSION_SUFFIX = "-$env:STEELTOE_VERSION_SUFFIX"
|
||||
}
|
||||
Else {
|
||||
$env:STEELTOE_DASH_VERSION_SUFFIX = ""
|
||||
}
|
||||
|
||||
Write-Host "Package version suffix to use: $env:STEELTOE_VERSION_SUFFIX"
|
||||
|
||||
# add MyGet server as required, copy versions.props to solution root for use later
|
||||
If ($env:APPVEYOR_REPO_TAG_NAME) {
|
||||
Write-Host "Use dependencies from nuget.org only"
|
||||
# Steeltoe does not currently have a staging feed
|
||||
# -- this would be a holding tank for production packages, only for use when building other packages just before shipping to nuget.org
|
||||
#nuget sources add -Name SteeltoeMyGetStaging -Source https://www.myget.org/F/oss-ci/api/v3/index.json
|
||||
Copy-Item .\config\versions.props -Destination .\versions.props
|
||||
}
|
||||
ElseIf ($env:APPVEYOR_REPO_BRANCH -eq "master") {
|
||||
Write-Host "Use dependencies from nuget.org and myget/master"
|
||||
nuget sources add -Name SteeltoeMyGetMaster -Source https://www.myget.org/F/steeltoemaster/api/v3/index.json
|
||||
Copy-Item .\config\versions-master.props -Destination .\versions.props
|
||||
If ($env:APPVEYOR_REPO_BRANCH -eq "master") {
|
||||
Write-Host "Use dependencies from nuget.org and https://www.myget.org/F/steeltoemaster/api/v3/index.json"
|
||||
nuget sources add -Name Steeltoe -Source https://www.myget.org/F/steeltoemaster/api/v3/index.json
|
||||
$env:PropsVersion = "-master"
|
||||
}
|
||||
ElseIf ($env:APPVEYOR_REPO_BRANCH -eq "dev") {
|
||||
Write-Host "Use dependencies from nuget.org and myget/dev"
|
||||
nuget sources add -Name SteeltoeMyGetDev -Source https://www.myget.org/F/steeltoedev/api/v3/index.json
|
||||
Copy-Item .\config\versions-dev.props -Destination .\versions.props
|
||||
Write-Host "Use dependencies from nuget.org and https://www.myget.org/F/steeltoedev/api/v3/index.json"
|
||||
nuget sources add -Name Steeltoe -Source https://www.myget.org/F/steeltoedev/api/v3/index.json
|
||||
$env:PropsVersion = "-dev"
|
||||
$env:BUILD_TYPE = "Debug"
|
||||
}
|
||||
ElseIf ($env:APPVEYOR_REPO_BRANCH.SubString(0,6) -eq "update") {
|
||||
Write-Host "Use dependencies from nuget.org and myget/update"
|
||||
nuget sources add -Name SteeltoeMyGetUpdates -Source https://www.myget.org/F/steeltoeupdates/api/v3/index.json
|
||||
Copy-Item .\config\versions-update.props -Destination .\versions.props
|
||||
Write-Host "Use dependencies from nuget.org and https://www.myget.org/F/steeltoestaging/api/v3/index.json"
|
||||
nuget sources add -Name Steeltoe -Source https://www.myget.org/F/steeltoestaging/api/v3/index.json
|
||||
}
|
||||
If (Test-Path config/versions.props)
|
||||
{
|
||||
Write-Host "Using .\config\versions$env:PropsVersion.props"
|
||||
Copy-Item .\config\versions$env:PropsVersion.props -Destination .\versions.props
|
||||
}
|
||||
|
||||
# setup a local folder NuGet feed for use during the build
|
||||
mkdir $env:USERPROFILE\localfeed -Force
|
||||
nuget sources add -Name localfeed -Source $env:USERPROFILE\localfeed
|
||||
mkdir $env:APPVEYOR_BUILD_FOLDER\localfeed -Force
|
||||
nuget sources add -Name localfeed -Source $env:APPVEYOR_BUILD_FOLDER\localfeed
|
|
@ -1,29 +0,0 @@
|
|||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$PackageSource,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$VersionFilter,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$PackageDestination
|
||||
)
|
||||
$UploadTime = New-Object -TypeName System.Diagnostics.Stopwatch
|
||||
$UploadTime.Start()
|
||||
|
||||
If (-Not $env:NuGetApiKey) {
|
||||
Write-Error "Sorry, you can't push nuget packages without setting env:NuGetApiKey"
|
||||
return -1
|
||||
}
|
||||
|
||||
Write-Host "Locating $PackageSource"
|
||||
Set-Location $PackageSource
|
||||
$counter = 1
|
||||
$PackageList = Get-ChildItem -Filter $VersionFilter
|
||||
ForEach ($_ in $PackageList) {
|
||||
Write-Host "Now pushing package $counter of" $PackageList.Count
|
||||
nuget push $_ $env:NuGetApiKey -Source $PackageDestination
|
||||
$counter++
|
||||
}
|
||||
Set-Location ..
|
||||
|
||||
$UploadTime.Stop()
|
||||
Write-Host "Upload process time:" $UploadTime.Elapsed.ToString()
|
|
@ -0,0 +1,17 @@
|
|||
# use this script if you'd like to run build/test/install scripts on your workstation
|
||||
# be sure to run it from within the repo folder
|
||||
$env:APPVEYOR=$true
|
||||
If ($env:APPVEYOR_BUILD_NUMBER){
|
||||
$env:APPVEYOR_BUILD_NUMBER = [int]$env:APPVEYOR_BUILD_NUMBER + 1
|
||||
}
|
||||
Else {
|
||||
$env:APPVEYOR_BUILD_NUMBER = 1
|
||||
}
|
||||
$env:APPVEYOR_REPO_BRANCH = git rev-parse --abbrev-ref HEAD
|
||||
|
||||
Write-Host "This script does not actually read your appveyor.yml file. Your input will be used to set APPVEYOR_BUILD_VERSION..."
|
||||
$env:STEELTOE_VERSION = Read-Host -Prompt 'What base version would you like to use for packages? Do not include a pre-release suffix'
|
||||
$env:APPVEYOR_BUILD_VERSION = "$env:STEELTOE_VERSION-$env:APPVEYOR_REPO_BRANCH-$env:APPVEYOR_BUILD_NUMBER"
|
||||
$env:APPVEYOR_BUILD_FOLDER = $pwd
|
||||
|
||||
Write-Host "AppVeyor Simulation setup complete to run build $env:APPVEYOR_BUILD_VERSION in $env:APPVEYOR_BUILD_FOLDER for branch $env:APPVEYOR_REPO_BRANCH"
|
|
@ -1,10 +1,7 @@
|
|||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$Steeltoe_Version_To_Build,
|
||||
[string]$BuildType,
|
||||
[string]$RepositoryList,
|
||||
[string]$PackageDestination,
|
||||
[bool]$RunUnitTests = $False
|
||||
[switch]$BuildDebug
|
||||
)
|
||||
|
||||
# Validate/set initial parameters
|
||||
|
@ -14,10 +11,6 @@ If ($env:STEELTOE_VERSION.length -lt 5 -or ($env:STEELTOE_VERSION.ToCharArray()
|
|||
Write-Error "Please use a version format of 1.2.3"
|
||||
return -1
|
||||
}
|
||||
If ($PackageDestination -and -Not $env:NuGetApiKey) {
|
||||
Write-Error "Package upload destination has been set, but uploading will fail because you haven't set env:NuGetApiKey!"
|
||||
return -1
|
||||
}
|
||||
If ($Steeltoe_Version_To_Build.Split("-")[1]) {
|
||||
$env:STEELTOE_VERSION_SUFFIX = $Steeltoe_Version_To_Build.Split("-")[1]
|
||||
$env:STEELTOE_DASH_VERSION_SUFFIX = "-$env:STEELTOE_VERSION_SUFFIX"
|
||||
|
@ -32,16 +25,18 @@ $scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
|
|||
Write-Host "Steeltoe version:" $env:STEELTOE_VERSION
|
||||
Write-Host "Steeltoe version suffix:" $(If($env:STEELTOE_VERSION_SUFFIX) { $env:STEELTOE_VERSION_SUFFIX } Else { "N/A" })
|
||||
|
||||
If (-Not $BuildType) {
|
||||
If (-Not $BuildDebug) {
|
||||
Write-Warning "Build type not set. Defaulting to config:Release branch:master"
|
||||
$env:BUILD_TYPE = "Release"
|
||||
$env:BranchFilter = "--single-branch -b master"
|
||||
}
|
||||
Else {
|
||||
Write-Host "Debug build specified, we'll use default branches as a side effect"
|
||||
$env:BUILD_TYPE = $BuildType
|
||||
$env:BUILD_TYPE = "Debug"
|
||||
$env:BranchFilter = ""
|
||||
}
|
||||
If (-Not $RepositoryList) {
|
||||
If (-Not $env:SteeltoeRepositoryList) {
|
||||
Write-Information "Steeltoe repository list not set in Environment, using complete list"
|
||||
$s = "SteeltoeOSS"
|
||||
$p = "pivotal-cf"
|
||||
|
@ -49,8 +44,7 @@ If (-Not $RepositoryList) {
|
|||
"$s/discovery $p/spring-cloud-dotnet-discovery $s/security $s/management $s/circuitbreaker"
|
||||
}
|
||||
Else {
|
||||
Write-Information "Using repository list passed in: $RepositoryList"
|
||||
$env:SteeltoeRepositoryList = $RepositoryList
|
||||
Write-Information "Using repository list from environment: $env:SteeltoeRepositoryList"
|
||||
}
|
||||
|
||||
# start the clock
|
||||
|
@ -66,7 +60,7 @@ Remove-Item workspace -Force -Recurse -ErrorAction SilentlyContinue
|
|||
[int]$env:TestErrors = 0
|
||||
$env:ProcessTimes = ""
|
||||
|
||||
mkdir workspace
|
||||
mkdir workspace -Force
|
||||
Set-Location workspace
|
||||
|
||||
ForEach ($_ in $env:SteeltoeRepositoryList.Split(' ')) {
|
||||
|
@ -96,7 +90,7 @@ ForEach ($_ in $env:SteeltoeRepositoryList.Split(' ')) {
|
|||
return -1
|
||||
}
|
||||
|
||||
If ($RunUnitTests) {
|
||||
If ($env:RunUnitTests) {
|
||||
Set-Location test
|
||||
# run tests in each project in the test folder where the folder is named .test
|
||||
# this filter will skip integration tests that generally assume another thing (like config server) is running
|
||||
|
@ -122,6 +116,7 @@ ForEach ($_ in $env:SteeltoeRepositoryList.Split(' ')) {
|
|||
Set-Location ..
|
||||
Set-Location ..
|
||||
$ProjectTime.Stop()
|
||||
Write-Host "Process time for $_ :" $ProjectTime.Elapsed.ToString()
|
||||
$env:ProcessTimes += $_ + ":" + $ProjectTime.Elapsed.ToString() + ";"
|
||||
}
|
||||
Set-Location ..
|
||||
|
@ -135,11 +130,5 @@ ForEach ($_ in $env:ProcessTimes.Split(';')) {
|
|||
Write-Host $_
|
||||
}
|
||||
|
||||
If ($PackageDestination) {
|
||||
$PublishCommand = "$scriptPath\push_packages.ps1 ""$(Get-Location)\artifacts"" ""*$Steeltoe_Version_To_Build*"" ""$PackageDestination"""
|
||||
Write-Host "Calling publish command: $PublishCommand"
|
||||
Invoke-Expression $PublishCommand
|
||||
}
|
||||
|
||||
$TotalTime.Stop()
|
||||
Write-Host "Total process time:" $TotalTime.Elapsed.ToString()
|
|
@ -4,6 +4,6 @@
|
|||
for d in ./src/*; do
|
||||
cd $d
|
||||
dotnet restore
|
||||
dotnet build
|
||||
dotnet build --f netcoreapp2.0
|
||||
cd ../../
|
||||
done
|
||||
|
|
|
@ -3,28 +3,32 @@
|
|||
dotnet --info
|
||||
|
||||
export CI_BUILD=True
|
||||
if [[ "$TRAVIS_TAG" != "" ]];
|
||||
then
|
||||
echo "Use dependencies from nuget.org only"
|
||||
nuget sources add -Name SteeltoeMyGetStaging -Source https://www.myget.org/F/oss-ci/api/v3/index.json
|
||||
cp config/versions.props ./versions.props
|
||||
elif [[ "$TRAVIS_BRANCH" == "master" ]];
|
||||
if [[ "$TRAVIS_BRANCH" == "master" ]];
|
||||
then
|
||||
echo "Use dependencies from nuget.org and myget/master"
|
||||
nuget sources add -Name SteeltoeMyGetMaster -Source https://www.myget.org/F/oss-ci-master/api/v3/index.json
|
||||
#nuget sources add -Name SteeltoeMyGetMaster -Source https://www.myget.org/F/steeltoemaster/api/v3/index.json
|
||||
cp config/versions-master.props ./versions.props
|
||||
export MyGet_Feed="steeltoemaster"
|
||||
elif [[ "$TRAVIS_BRANCH" == "dev" ]];
|
||||
then
|
||||
echo "Use dependencies from nuget.org and myget/dev"
|
||||
nuget sources add -Name SteeltoeMyGetDev -Source https://www.myget.org/F/oss-ci-dev/api/v3/index.json
|
||||
#nuget sources add -Name SteeltoeMyGetDev -Source https://www.myget.org/F/steeltoedev/api/v3/index.json
|
||||
cp config/versions-dev.props ./versions.props
|
||||
export MyGet_Feed="steeltoedev"
|
||||
elif [[ "${TRAVIS_BRANCH:0:6}" == "update" ]];
|
||||
then
|
||||
echo "Use dependencies from nuget.org and myget/update"
|
||||
nuget sources add -Name SteeltoeMyGetUpdates -Source https://www.myget.org/F/steeltoeupdates/api/v3/index.json
|
||||
cp config/versions-update.props ./versions.props
|
||||
export MyGet_Feed="steeltoestaging"
|
||||
else
|
||||
echo "No special case detected, just use nuget.org"
|
||||
fi
|
||||
|
||||
if [[ $MyGet_Feed ]];
|
||||
then
|
||||
# write out a nuget config file
|
||||
cat > nuget.config <<EOF
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="Steeltoe" value="https://www.myget.org/F/$MyGet_Feed/api/v3/index.json" />
|
||||
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
EOF
|
||||
fi
|
|
@ -3,6 +3,7 @@
|
|||
# Run unit tests
|
||||
for d in ./test/*.Test; do
|
||||
cd $d
|
||||
echo "Running tests in $d"
|
||||
dotnet restore
|
||||
dotnet xunit -verbose -framework netcoreapp2.0
|
||||
cd ../../
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
If ($env:APPVEYOR_REPO_BRANCH -ne "dev" -and $env:APPVEYOR_REPO_BRANCH -ne "master")
|
||||
{
|
||||
Write-Host "Dependency updates are only available for the dev and master branches"
|
||||
return
|
||||
}
|
||||
|
||||
If (-Not $env:PackageReferencesToUpdate) {
|
||||
Write-Host "No depency updates requested"
|
||||
Write-Host "To use, set env:PackageReferencesToUpdate to a space-separated list of properties to update in dependent libraries"
|
||||
return
|
||||
}
|
||||
|
||||
If (-Not $env:STEELTOE_VERSION)
|
||||
{
|
||||
Write-Error "Downstream references identifed but the new version wasn't set!"
|
||||
return -1
|
||||
}
|
||||
$Version_To_Set = $env:STEELTOE_VERSION + $env:STEELTOE_DASH_VERSION_SUFFIX
|
||||
|
||||
|
||||
If (-Not $env:SteeltoeRepositoryList) {
|
||||
Write-Information "Steeltoe repository list not set in Environment, using complete list"
|
||||
$s = "SteeltoeOSS"
|
||||
$p = "pivotal-cf"
|
||||
$env:SteeltoeRepositoryList = "$s/Common $s/Configuration $p/spring-cloud-dotnet-configuration $s/logging $s/connectors " +
|
||||
"$s/discovery $p/spring-cloud-dotnet-discovery $s/security $s/management $s/circuitbreaker"
|
||||
}
|
||||
|
||||
# specifically checkout dev branches in case one get master set as default at some point
|
||||
$env:BranchFilter = "--single-branch -b $env:APPVEYOR_REPO_BRANCH"
|
||||
|
||||
# start the clock
|
||||
$TotalTime = New-Object -TypeName System.Diagnostics.Stopwatch
|
||||
$TotalTime.Start()
|
||||
|
||||
# ensure the workspace is clean
|
||||
Remove-Item workspace -Force -Recurse -ErrorAction SilentlyContinue
|
||||
[int]$env:TestErrors = 0
|
||||
$env:ProcessTimes = ""
|
||||
|
||||
mkdir workspace -Force
|
||||
Set-Location workspace
|
||||
|
||||
ForEach ($_ in $env:SteeltoeRepositoryList.Split(' ')) {
|
||||
$ProjectTime = New-Object -TypeName System.Diagnostics.Stopwatch
|
||||
$ProjectTime.Start()
|
||||
# build the clone command as a string to then execute so the branch filter works
|
||||
$cloneString = "git clone -q $env:BranchFilter https://github.com/$_.git"
|
||||
Write-Host "clone command: " $cloneString
|
||||
Invoke-Expression $cloneString
|
||||
|
||||
Set-Location $_.Split("/")[1]
|
||||
If (Test-Path config/versions-$env:APPVEYOR_REPO_BRANCH.props)
|
||||
{
|
||||
$updatedSomething = $false
|
||||
# modify versions.props (xml) to update all steeltoe references (except SteeltoeVersion and SteeltoeVersionSuffix)
|
||||
$xmlContent = New-Object System.Xml.XmlDocument
|
||||
$xmlContent.PreserveWhitespace = $true
|
||||
$xmlContent.Load("$pwd/config/versions-$env:APPVEYOR_REPO_BRANCH.props")
|
||||
$xmlContent.SelectNodes("//Project/PropertyGroup/*") |
|
||||
ForEach-Object {
|
||||
If ($env:PackageReferencesToUpdate.Contains($_.name))
|
||||
{
|
||||
Write-Host "Original value of"$_.Name"is"$_.InnerXml
|
||||
$_.InnerXml = $Version_To_Set
|
||||
Write-Host "Updated value of"$_.Name"is"$_.InnerXml
|
||||
$updatedSomething = $true
|
||||
}
|
||||
}
|
||||
if ($updatedSomething)
|
||||
{
|
||||
Write-Host "Dependencies were updated, commit and push the changes!"
|
||||
$xmlContent.OuterXml | Out-File "config/versions-$env:APPVEYOR_REPO_BRANCH.props"
|
||||
git add config/versions-$env:APPVEYOR_REPO_BRANCH.props
|
||||
git commit -m "Update versions-$env:APPVEYOR_REPO_BRANCH.props"
|
||||
git push --porcelain
|
||||
}
|
||||
}
|
||||
Else
|
||||
{
|
||||
Write-Host "config/versions-$env:APPVEYOR_REPO_BRANCH.props not found"
|
||||
}
|
||||
Set-Location ..
|
||||
$ProjectTime.Stop()
|
||||
Write-Host "Process time for $_ :" $ProjectTime.Elapsed.ToString()
|
||||
$env:ProcessTimes += $_ + ":" + $ProjectTime.Elapsed.ToString() + ";"
|
||||
}
|
||||
Set-Location ..
|
||||
|
||||
# display processing times
|
||||
Write-Host "Individual process times:"
|
||||
ForEach ($_ in $env:ProcessTimes.Split(';')) {
|
||||
Write-Host $_
|
||||
}
|
||||
$TotalTime.Stop()
|
||||
Write-Host "Total process time:" $TotalTime.Elapsed.ToString()
|
Загрузка…
Ссылка в новой задаче