re-registration fix
This commit is contained in:
@@ -35,5 +35,8 @@ RUN [Environment]::SetEnvironmentVariable(\"Path\", $env:Path + \";C:\Program Fi
|
|||||||
ARG RUNNER_VERSION="0.2.11"
|
ARG RUNNER_VERSION="0.2.11"
|
||||||
ADD https://gitea.com/gitea/act_runner/releases/download/v$RUNNER_VERSION/act_runner-$RUNNER_VERSION-windows-amd64.exe act_runner.exe
|
ADD https://gitea.com/gitea/act_runner/releases/download/v$RUNNER_VERSION/act_runner-$RUNNER_VERSION-windows-amd64.exe act_runner.exe
|
||||||
|
|
||||||
|
RUN New-Item -ItemType Directory -Force -Path "C:\actions-runner\data" | Out-Null
|
||||||
|
VOLUME C:/actions-runner/data
|
||||||
|
|
||||||
COPY entrypoint.ps1 .
|
COPY entrypoint.ps1 .
|
||||||
ENTRYPOINT ["pwsh.exe", ".\\entrypoint.ps1"]
|
ENTRYPOINT ["pwsh.exe", ".\\entrypoint.ps1"]
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
# Set the labels if given
|
# Set the labels if given
|
||||||
if ($null -ne $env:GITEA_RUNNER_LABELS) {
|
if ($null -ne $env:GITEA_RUNNER_LABELS) {
|
||||||
$LABELS = $env:GITEA_RUNNER_LABELS
|
$LABELS = $env:GITEA_RUNNER_LABELS
|
||||||
} else {
|
} else {
|
||||||
$LABELS = 'windows:host'
|
$LABELS = 'windows:host,windows-msbuild:host'
|
||||||
}
|
}
|
||||||
|
|
||||||
$GITEA_RUNNER_NAME = $env:GITEA_RUNNER_NAME
|
$GITEA_RUNNER_NAME = $env:GITEA_RUNNER_NAME
|
||||||
@@ -10,13 +10,19 @@ $GITEA_INSTANCE_URL = $env:GITEA_INSTANCE_URL
|
|||||||
$GITEA_RUNNER_REGISTRATION_TOKEN = $env:GITEA_RUNNER_REGISTRATION_TOKEN
|
$GITEA_RUNNER_REGISTRATION_TOKEN = $env:GITEA_RUNNER_REGISTRATION_TOKEN
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Write-Host "Configuring runner: $GITEA_RUNNER_NAME"
|
Push-Location "data"
|
||||||
./act_runner.exe register --no-interactive --instance $GITEA_INSTANCE_URL --token $GITEA_RUNNER_REGISTRATION_TOKEN --name $GITEA_RUNNER_NAME --labels $LABELS
|
|
||||||
|
# Check if runner is already registered
|
||||||
|
if (-not (Test-Path -Path "data/.runner")) {
|
||||||
|
Write-Host "Configuring new runner: $GITEA_RUNNER_NAME"
|
||||||
|
../act_runner.exe register --no-interactive --instance $GITEA_INSTANCE_URL --token $GITEA_RUNNER_REGISTRATION_TOKEN --name $GITEA_RUNNER_NAME --labels $LABELS
|
||||||
|
}
|
||||||
|
|
||||||
# Remove access token for security reasons
|
|
||||||
$env:ACCESS_TOKEN=$null
|
|
||||||
|
|
||||||
./act_runner.exe daemon
|
# Remove registration token for security reasons
|
||||||
|
$env:GITEA_RUNNER_REGISTRATION_TOKEN=$null
|
||||||
|
|
||||||
|
../act_runner.exe daemon
|
||||||
} catch {
|
} catch {
|
||||||
Write-Error $_.Exception.Message
|
Write-Error $_.Exception.Message
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user