Skip to content

Instantly share code, notes, and snippets.

@Voronenko
Created September 8, 2021 14:23
Show Gist options
  • Save Voronenko/70933f5284a7aa9e5c78f0481c3b86b2 to your computer and use it in GitHub Desktop.
Save Voronenko/70933f5284a7aa9e5c78f0481c3b86b2 to your computer and use it in GitHub Desktop.
<powershell>
Set-Location c:\gitlab-runner
Import-Module ./register-runner.ps1
$env:CACHE_TYPE = 's3'
$env:CACHE_SHARED = 'true'
$env:CACHE_S3_SERVER_ADDRESS = 's3.SPECIFY_REGION.amazonaws.com'
$env:CACHE_S3_BUCKET_NAME= 'SPECIFY_UNIQUE_NAME'
$env:CACHE_S3_BUCKET_LOCATION = 'SPECIFY_REGION'
$env:CACHE_PATH = 'cache'
gitlab-runner-register -gitRegistrationToken SPECIFY_TOKEN -hostTags "SPECIFY_RUNNER_TAGS_COMMA" -gitlab_executor "shell" -gitlab_shell "powershell"
iex "cat .\config.toml | grep token"
if($lastexitcode -ne '0')
{
while($lastexitcode -ne '0')
{
Start-Sleep -s 7
Write-Host "Retrying registration...."
gitlab-runner-register -gitRegistrationToken SPECIFY_TOKEN -hostTags "SPECIFY_RUNNER_TAGS_COMMA" -gitlab_executor "shell" -gitlab_shell "powershell"
iex "cat .\config.toml | grep token"
}
}
Write-Host "Registration complete...."
# install runner service on behalf of specific user
gitlab-service-register -gitlab_runner_username "SPECIFY" -gitlab_runner_pass "SPECIFY"
</powershell>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment