mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2024-11-21 12:17:17 +03:00
Merge pull request '[FORGEJO] add support for the lxc:// scheme' (#110) from earl-warren/runner:wip-lxc into main
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/110
This commit is contained in:
commit
9b05b16463
1 changed files with 4 additions and 1 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
const (
|
||||
SchemeHost = "host"
|
||||
SchemeDocker = "docker"
|
||||
SchemeLXC = "lxc"
|
||||
)
|
||||
|
||||
type Label struct {
|
||||
|
@ -32,7 +33,7 @@ func Parse(str string) (*Label, error) {
|
|||
if len(splits) >= 3 {
|
||||
label.Arg = splits[2]
|
||||
}
|
||||
if label.Schema != SchemeHost && label.Schema != SchemeDocker {
|
||||
if label.Schema != SchemeHost && label.Schema != SchemeDocker && label.Schema != SchemeLXC {
|
||||
return nil, fmt.Errorf("unsupported schema: %s", label.Schema)
|
||||
}
|
||||
return label, nil
|
||||
|
@ -59,6 +60,8 @@ func (l Labels) PickPlatform(runsOn []string) string {
|
|||
platforms[label.Name] = strings.TrimPrefix(label.Arg, "//")
|
||||
case SchemeHost:
|
||||
platforms[label.Name] = "-self-hosted"
|
||||
case SchemeLXC:
|
||||
platforms[label.Name] = "lxc:" + strings.TrimPrefix(label.Arg, "//")
|
||||
default:
|
||||
// It should not happen, because Parse has checked it.
|
||||
continue
|
||||
|
|
Loading…
Reference in a new issue