Skip to content

Commit b0fd545

Browse files
authored
Fix Crank setup on Linux (#6647)
* Add pwsh shebang * Create a symlink pointing to the current log * Fix function app path on Linux * Rename $profile variable
1 parent 1ea19bf commit b0fd545

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

tools/Crank/run-benchmarks.ps1

+8-7
Original file line numberDiff line numberDiff line change
@@ -64,27 +64,28 @@ $crankConfigPath = Join-Path `
6464

6565
$isLinuxApp = $CrankAgentVm -match '\blinux\b'
6666

67-
$functionAppRootPath = if ($isLinuxApp) { "/home/$UserName/FunctionApps" } else { 'C:\FunctionApps' }
68-
$functionAppPath = Join-Path `
69-
-Path $functionAppRootPath `
70-
-ChildPath $FunctionApp
67+
$functionAppPath = if ($isLinuxApp) {
68+
"/home/$UserName/FunctionApps/$FunctionApp"
69+
} else {
70+
"C:\FunctionApps\$FunctionApp"
71+
}
7172

7273
$tmpPath = if ($isLinuxApp) { "/tmp" } else { 'C:\Temp' }
7374
$tmpLogPath = if ($isLinuxApp) { "/tmp/functions/log" } else { 'C:\Temp\Functions\Log' }
7475

7576
if ($UseHttps) {
7677
$aspNetUrls = "http://localhost:5000;https://localhost:5001"
77-
$profile = "localHttps"
78+
$profileName = "localHttps"
7879
}
7980
else {
8081
$aspNetUrls = "http://localhost:5000"
81-
$profile = "local"
82+
$profileName = "local"
8283
}
8384

8485
$crankArgs =
8586
'--config', $crankConfigPath,
8687
'--scenario', $Scenario,
87-
'--profile', $profile,
88+
'--profile', $profileName,
8889
'--variable', "CrankAgentVm=$CrankAgentVm",
8990
'--variable', "FunctionAppPath=`"$functionAppPath`"",
9091
'--variable', "TempPath=`"$tmpPath`"",

tools/Crank/run-crank-agent.ps1

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env pwsh
2+
13
param(
24
[string]
35
$UserName = 'Functions'
@@ -17,6 +19,13 @@ if (-not (Test-Path $logsDir -PathType Container)) {
1719
}
1820

1921
$logFileName = Join-Path -Path $logsDir -ChildPath "$(Get-Date -Format 'yyyy-MM-dd_HH-mm-ss').log"
22+
New-Item -Path $logFileName -ItemType File > $null
23+
24+
$stableLogFileName = Join-Path -Path $logsDir -ChildPath 'current.log'
25+
if (Test-Path $stableLogFileName) {
26+
Remove-Item $stableLogFileName
27+
}
28+
New-Item -ItemType SymbolicLink -Path $stableLogFileName -Target $logFileName > $null
2029

2130
$invokeCrankAgentCommand = $IsWindows ? 'C:\dotnet-tools\crank-agent.exe' : "/home/$UserName/.dotnet/tools/crank-agent";
2231

tools/Crank/setup-crank-agent.ps1

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env pwsh
2+
13
[CmdletBinding()]
24
param (
35
[bool]$InstallDotNet = $true,

0 commit comments

Comments
 (0)