Skip to content

Commit ac8f28a

Browse files
committed
using pwsh in azure pipelines
1 parent 36f7f4c commit ac8f28a

File tree

8 files changed

+16
-19
lines changed

8 files changed

+16
-19
lines changed

.azurepipelines/artifacts-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ jobs:
1818
source: current
1919
path: $(Build.SourcesDirectory)
2020
artifact: storage
21-
- pwsh: dotnet cake build.cake --bootstrap; dotnet cake build.cake --target=Artifacts-Test --docker_distro=$(DISTRO) --docker_dotnetversion=$(DOTNET_VERSION)
21+
- pwsh: ./build.ps1 -target Artifacts-Test -DockerDistro $(DISTRO) -DockerDotnetVersion $(DOTNET_VERSION)
2222
displayName: '[Docker Test Artifacts]'

.azurepipelines/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ steps:
66
inputs:
77
versionSpec: '>= 2.5'
88
addToPath: true
9-
- pwsh: dotnet cake build.cake --bootstrap; dotnet cake build.cake --target=Pack
9+
- pwsh: ./build.ps1 -target Pack
1010
displayName: '[Cake build & pack]'
1111
- publish: $(System.DefaultWorkingDirectory)
1212
displayName: 'Upload pipeline artifacts'

.azurepipelines/common-steps.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ steps:
44
key: 'tools | "$(Agent.OS)" | build.cake'
55
path: tools
66
displayName: Cache Cake tools
7-
- task: UseDotNet@2
8-
displayName: 'Use .NET Core sdk 3.1'
7+
- task: Cache@2
98
inputs:
10-
packageType: sdk
11-
version: 3.1.101
12-
- pwsh: dotnet tool restore
13-
displayName: 'Install Cake tool'
9+
key: 'dotnet | "$(Agent.OS)" | build.config'
10+
path: .dotnet
11+
displayName: Cache dotnet locally

.azurepipelines/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
source: current
1919
path: $(Build.SourcesDirectory)
2020
artifact: storage
21-
- pwsh: dotnet cake build.cake --bootstrap; dotnet cake build.cake --target=Publish-DockerHub --docker_distro=$(DISTRO) --docker_dotnetversion=$(DOTNET_VERSION)
21+
- pwsh: ./build.ps1 -target Publish-DockerHub -DockerDistro $(DISTRO) -DockerDotnetVersion $(DOTNET_VERSION)
2222
displayName: '[Docker build]'
2323
env:
2424
DOCKER_USERNAME: $(DOCKER_USERNAME)

.azurepipelines/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ steps:
1515
source: current
1616
path: $(Build.SourcesDirectory)
1717
artifact: storage
18-
- pwsh: dotnet cake build.cake --bootstrap; dotnet cake build.cake --target=Publish-${{ parameters.taskName }}
18+
- pwsh: ./build.ps1 -target Publish-${{ parameters.taskName }}
1919
displayName: '[Publish]'
2020
env:
2121
GITHUB_TOKEN: $(GITHUB_TOKEN)

.azurepipelines/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ steps:
66
source: current
77
path: $(Build.SourcesDirectory)
88
artifact: storage
9-
- pwsh: dotnet cake build.cake --bootstrap; dotnet cake build.cake --target=Release
9+
- pwsh: ./build.ps1 -target Release
1010
displayName: '[Release]'
1111
env:
1212
GITHUB_TOKEN: $(GITHUB_TOKEN)

.azurepipelines/test.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
steps:
22
- template: common-steps.yml
3-
- task: UseDotNet@2
4-
displayName: 'Use .NET Core sdk 2.1'
5-
inputs:
6-
packageType: sdk
7-
version: 2.1.803
83
- task: CmdLine@2
94
condition: eq( variables['Agent.OS'], 'Darwin' )
105
displayName: 'Use mono'
@@ -17,7 +12,7 @@ steps:
1712
echo "##vso[task.setvariable variable=PATH;]$MONOPREFIX/bin:$PATH"
1813
sudo rm /Library/Frameworks/Mono.framework/Versions/Current
1914
sudo ln -s $MONOPREFIX /Library/Frameworks/Mono.framework/Versions/Current
20-
- pwsh: dotnet cake build.cake --bootstrap; dotnet cake build.cake --target=Test
15+
- pwsh: ./build.ps1 -target Test
2116
displayName: '[Run Test]'
2217
env:
2318
ENABLED_UNIT_TESTS: $(ENABLED_UNIT_TESTS)

build.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,17 @@ Function Install-Dotnet($DotNetVersion)
119119
{
120120
if ($IsMacOS -or $IsLinux) {
121121
$ScriptPath = Join-Path $InstallPath 'dotnet-install.sh'
122-
(New-Object System.Net.WebClient).DownloadFile($DotNetUnixInstallerUri, $ScriptPath);
122+
if (!(Test-Path $ScriptPath)) {
123+
(New-Object System.Net.WebClient).DownloadFile($DotNetUnixInstallerUri, $ScriptPath);
124+
}
123125

124126
& bash $ScriptPath --version "$DotNetVersion" --install-dir "$InstallPath" --channel "$DotNetChannel" --no-path
125127
}
126128
else {
127129
$ScriptPath = Join-Path $InstallPath 'dotnet-install.ps1'
128-
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, $ScriptPath);
130+
if (!(Test-Path $ScriptPath)) {
131+
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, $ScriptPath);
132+
}
129133

130134
& $ScriptPath -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath;
131135
}

0 commit comments

Comments
 (0)