File: backend.go

package info (click to toggle)
docker-buildx 0.13.1%2Bds1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,356 kB
  • sloc: sh: 299; makefile: 87
file content (63 lines) | stat: -rw-r--r-- 1,240 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package workers

import (
	"os"
	"strings"

	"github.com/moby/buildkit/util/testutil/integration"
)

type backend struct {
	builder             string
	context             string
	unsupportedFeatures []string
}

var _ integration.Backend = &backend{}

func (s *backend) Address() string {
	return s.builder
}

func (s *backend) DockerAddress() string {
	return s.context
}

func (s *backend) ContainerdAddress() string {
	return ""
}

func (s *backend) Snapshotter() string {
	return ""
}

func (s *backend) Rootless() bool {
	return false
}

func (s *backend) NetNSDetached() bool {
	return false
}

func (s backend) Supports(feature string) bool {
	if enabledFeatures := os.Getenv("BUILDKIT_TEST_ENABLE_FEATURES"); enabledFeatures != "" {
		for _, enabledFeature := range strings.Split(enabledFeatures, ",") {
			if feature == enabledFeature {
				return true
			}
		}
	}
	if disabledFeatures := os.Getenv("BUILDKIT_TEST_DISABLE_FEATURES"); disabledFeatures != "" {
		for _, disabledFeature := range strings.Split(disabledFeatures, ",") {
			if feature == disabledFeature {
				return false
			}
		}
	}
	for _, unsupportedFeature := range s.unsupportedFeatures {
		if feature == unsupportedFeature {
			return false
		}
	}
	return true
}