Skip to content

Commit 0023078

Browse files
authored
feat: multiple runners
1 parent 09f329a commit 0023078

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PAT=<Replace with your personal access token>
22
ORGANIZATION_URL=<Organization url>
3-
RUNNER=2
3+
RUNNERS=2
44
# Vagrant image settings
55
MEMORY=8000 # 8GB
66
CPU=4

Vagrantfile

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Vagrant.configure("2") do |config|
1111
end
1212
config.winrm.max_tries = 300 # default is 20
1313
config.winrm.retry_delay = 5 #seconds. This is the defaul value and just here for documentation.
14-
config.vm.provision "shell", powershell_elevated_interactive: false, privileged: false, inline: <<-SHELL
14+
config.vm.provision "shell", powershell_elevated_interactive: true, privileged: true, inline: <<-SHELL
1515
# Install Chocolatey - Also Grabs 7Zip
1616
Invoke-Expression "& { $(Invoke-RestMethod 'https://aka.ms/install-powershell.ps1') } -AddToPath"
1717
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
@@ -34,17 +34,14 @@ Vagrant.configure("2") do |config|
3434
New-ItemProperty -Path "HKLM:\\SYSTEM\\CurrentControlSet\\Control\\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
3535
# github actions
3636
Invoke-WebRequest -Uri ${GITHUB_RUNNER_URL} -OutFile ${GITHUB_RUNNER_FILE}
37-
Expand-Archive -LiteralPath ${GITHUB_RUNNER_FILE} -DestinationPath runner -Force;
38-
C:\\runner\\config.cmd --name ${GITHUB_RUNNER_NAME} --replace --unattended --url ${ORGANIZATION_URL} --labels ${GITHUB_RUNNER_LABELS} --pat ${PAT}
39-
C:\\runner\\run.cmd
40-
# Remove-Item -Path C:\\runner-* -Recurse -Force
41-
# for ($runner = 1 ; $runner -le ${RUNNERS} ; $runner++){
42-
# Write-Host "Running $runner";
43-
# $random = -join ((48..57) + (97..122) | Get-Random -Count 8 | % {[char]$_});
44-
# Expand-Archive -LiteralPath ${GITHUB_RUNNER_FILE} -DestinationPath runner-$random -Force;
45-
# Invoke-Expression -Command "C:\\runner-$random\\config.cmd --name ${GITHUB_RUNNER_NAME}_$random --replace --unattended --url ${ORGANIZATION_URL} --labels ${GITHUB_RUNNER_LABELS} --pat ${PAT}";
46-
# Start-Process -NoNewWindow "C:\\runner-$random\\run.cmd";
47-
# }
37+
Remove-Item -Path C:\\runner-* -Recurse -Force
38+
for ($runner = 1 ; $runner -le ${RUNNERS} ; $runner++){
39+
Write-Host "Running $runner";
40+
$random = -join ((48..57) + (97..122) | Get-Random -Count 8 | % {[char]$_});
41+
Expand-Archive -LiteralPath ${GITHUB_RUNNER_FILE} -DestinationPath runner-$random -Force;
42+
Invoke-Expression -Command "C:\\runner-$random\\config.cmd --name ${GITHUB_RUNNER_NAME}_$random --replace --unattended --url ${ORGANIZATION_URL} --labels ${GITHUB_RUNNER_LABELS} --pat ${PAT}";
43+
Start-Process "C:\\runner-$random\\run.cmd";
44+
}
4845
SHELL
4946
end
5047

0 commit comments

Comments
 (0)