mirror of
https://gitea.com/gitea/act_runner.git
synced 2024-12-27 03:18:22 +01:00
Use default labels with no interactive register (#5)
Co-authored-by: Jason Song <i@wolfogre.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/5
This commit is contained in:
parent
8996b9b0e4
commit
0f97dd873a
@ -87,6 +87,15 @@ const (
|
||||
StageExit
|
||||
)
|
||||
|
||||
var (
|
||||
defaultLabels = []string{
|
||||
"ubuntu-latest:docker://node:16-bullseye",
|
||||
"ubuntu-22.04:docker://node:16-bullseye", // There's no node:16-bookworm yet
|
||||
"ubuntu-20.04:docker://node:16-bullseye",
|
||||
"ubuntu-18.04:docker://node:16-buster",
|
||||
}
|
||||
)
|
||||
|
||||
type registerInputs struct {
|
||||
InstanceAddr string
|
||||
Token string
|
||||
@ -148,15 +157,9 @@ func (r *registerInputs) assignToNext(stage registerStage, value string) registe
|
||||
r.RunnerName = value
|
||||
return StageInputCustomLabels
|
||||
case StageInputCustomLabels:
|
||||
r.CustomLabels = defaultLabels
|
||||
if value != "" {
|
||||
r.CustomLabels = strings.Split(value, ",")
|
||||
} else {
|
||||
r.CustomLabels = []string{
|
||||
"ubuntu-latest:docker://node:16-bullseye",
|
||||
"ubuntu-22.04:docker://node:16-bullseye", // There's no node:16-bookworm yet
|
||||
"ubuntu-20.04:docker://node:16-bullseye",
|
||||
"ubuntu-18.04:docker://node:16-buster",
|
||||
}
|
||||
}
|
||||
|
||||
if validateLabels(r.CustomLabels) != nil {
|
||||
@ -237,6 +240,7 @@ func registerNoInteractive(envFile string, regArgs *registerArgs) error {
|
||||
InstanceAddr: regArgs.InstanceAddr,
|
||||
Token: regArgs.Token,
|
||||
RunnerName: regArgs.RunnerName,
|
||||
CustomLabels: defaultLabels,
|
||||
}
|
||||
regArgs.Labels = strings.TrimSpace(regArgs.Labels)
|
||||
if regArgs.Labels != "" {
|
||||
|
Loading…
Reference in New Issue
Block a user