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
|
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 {
|
type registerInputs struct {
|
||||||
InstanceAddr string
|
InstanceAddr string
|
||||||
Token string
|
Token string
|
||||||
|
@ -148,15 +157,9 @@ func (r *registerInputs) assignToNext(stage registerStage, value string) registe
|
||||||
r.RunnerName = value
|
r.RunnerName = value
|
||||||
return StageInputCustomLabels
|
return StageInputCustomLabels
|
||||||
case StageInputCustomLabels:
|
case StageInputCustomLabels:
|
||||||
|
r.CustomLabels = defaultLabels
|
||||||
if value != "" {
|
if value != "" {
|
||||||
r.CustomLabels = strings.Split(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 {
|
if validateLabels(r.CustomLabels) != nil {
|
||||||
|
@ -237,6 +240,7 @@ func registerNoInteractive(envFile string, regArgs *registerArgs) error {
|
||||||
InstanceAddr: regArgs.InstanceAddr,
|
InstanceAddr: regArgs.InstanceAddr,
|
||||||
Token: regArgs.Token,
|
Token: regArgs.Token,
|
||||||
RunnerName: regArgs.RunnerName,
|
RunnerName: regArgs.RunnerName,
|
||||||
|
CustomLabels: defaultLabels,
|
||||||
}
|
}
|
||||||
regArgs.Labels = strings.TrimSpace(regArgs.Labels)
|
regArgs.Labels = strings.TrimSpace(regArgs.Labels)
|
||||||
if regArgs.Labels != "" {
|
if regArgs.Labels != "" {
|
||||||
|
|
Loading…
Reference in New Issue