mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2024-11-24 13:49:08 +03:00
[FORGEJO] add support for the lxc:// scheme
This commit is contained in:
parent
92cd7c8e19
commit
cf2608d1ea
1 changed files with 4 additions and 1 deletions
|
@ -11,6 +11,7 @@ import (
|
||||||
const (
|
const (
|
||||||
SchemeHost = "host"
|
SchemeHost = "host"
|
||||||
SchemeDocker = "docker"
|
SchemeDocker = "docker"
|
||||||
|
SchemeLXC = "lxc"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Label struct {
|
type Label struct {
|
||||||
|
@ -32,7 +33,7 @@ func Parse(str string) (*Label, error) {
|
||||||
if len(splits) >= 3 {
|
if len(splits) >= 3 {
|
||||||
label.Arg = splits[2]
|
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 nil, fmt.Errorf("unsupported schema: %s", label.Schema)
|
||||||
}
|
}
|
||||||
return label, nil
|
return label, nil
|
||||||
|
@ -59,6 +60,8 @@ func (l Labels) PickPlatform(runsOn []string) string {
|
||||||
platforms[label.Name] = strings.TrimPrefix(label.Arg, "//")
|
platforms[label.Name] = strings.TrimPrefix(label.Arg, "//")
|
||||||
case SchemeHost:
|
case SchemeHost:
|
||||||
platforms[label.Name] = "-self-hosted"
|
platforms[label.Name] = "-self-hosted"
|
||||||
|
case SchemeLXC:
|
||||||
|
platforms[label.Name] = "lxc:" + strings.TrimPrefix(label.Arg, "//")
|
||||||
default:
|
default:
|
||||||
// It should not happen, because Parse has checked it.
|
// It should not happen, because Parse has checked it.
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue