mirror of
https://gitea.com/gitea/act_runner.git
synced 2025-12-14 18:14:48 +00:00
feat: don't require docker (#16)
The only reason docker is really required by now, is that act_runner ping docker. This change only pings docker if a label with `docker://` is added to the runner. Plain labels without `:` like `self-hosted` are run directly on the system. Previously the pseudo non docker label `-self-hosted` have been required like this `self-hosted:docker://-self-hosted`, but due to docker ping this still required a dockerd to be pingable. Co-authored-by: Christopher Homberger <christopher.homberger@web.de> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/16 Reviewed-by: Jason Song <i@wolfogre.com> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: ChristopherHX <christopherhx@noreply.gitea.io> Co-committed-by: ChristopherHX <christopherhx@noreply.gitea.io>
This commit is contained in:
committed by
Lunny Xiao
parent
f7a52789d9
commit
990cf93c71
@@ -119,9 +119,10 @@ func (r *registerInputs) validate() error {
|
||||
func validateLabels(labels []string) error {
|
||||
for _, label := range labels {
|
||||
values := strings.SplitN(label, ":", 2)
|
||||
if len(values) != 2 {
|
||||
if len(values) > 2 {
|
||||
return fmt.Errorf("Invalid label: %s", label)
|
||||
}
|
||||
// len(values) == 1, label for non docker execution environment
|
||||
// TODO: validate value format, like docker://node:16-buster
|
||||
}
|
||||
return nil
|
||||
@@ -227,7 +228,7 @@ func printStageHelp(stage registerStage) {
|
||||
hostname, _ := os.Hostname()
|
||||
log.Infof("Enter the runner name (if set empty, use hostname:%s ):\n", hostname)
|
||||
case StageInputCustomLabels:
|
||||
log.Infoln("Enter the runner labels, leave blank to use the default labels (comma-separated, for example, ubuntu-20.04:docker://node:16-bullseye,ubuntu-18.04:docker://node:16-buster):")
|
||||
log.Infoln("Enter the runner labels, leave blank to use the default labels (comma-separated, for example, self-hosted,ubuntu-20.04:docker://node:16-bullseye,ubuntu-18.04:docker://node:16-buster):")
|
||||
case StageWaitingForRegistration:
|
||||
log.Infoln("Waiting for registration...")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user