mirror of
https://gitea.com/gitea/act_runner.git
synced 2025-06-13 18:17:13 +02: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
@ -24,11 +24,17 @@ func (s *Runner) Run(ctx context.Context, task *runnerv1.Task) error {
|
||||
|
||||
func (s *Runner) platformPicker(labels []string) string {
|
||||
// "ubuntu-18.04:docker://node:16-buster"
|
||||
// "self-hosted"
|
||||
|
||||
platforms := make(map[string]string, len(labels))
|
||||
for _, l := range s.Labels {
|
||||
// "ubuntu-18.04:docker://node:16-buster"
|
||||
splits := strings.SplitN(l, ":", 2)
|
||||
if len(splits) == 1 {
|
||||
// identifier for non docker execution environment
|
||||
platforms[splits[0]] = "-self-hosted"
|
||||
continue
|
||||
}
|
||||
// ["ubuntu-18.04", "docker://node:16-buster"]
|
||||
k, v := splits[0], splits[1]
|
||||
|
||||
|
Reference in New Issue
Block a user