Skip to content

Commit e39c44d

Browse files
committed
integration: enforce features compat through env vars
Signed-off-by: CrazyMax <[email protected]>
1 parent 5e0b785 commit e39c44d

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

hack/test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ if ! docker container inspect "$cacheVolume" >/dev/null 2>/dev/null; then
7878
fi
7979

8080
if [ "$TEST_INTEGRATION" == 1 ]; then
81-
cid=$(docker create --rm -v /tmp $coverageVol --volumes-from=$cacheVolume -e GITHUB_REF -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e TEST_DOCKERD -e SKIP_INTEGRATION_TESTS ${BUILDKIT_INTEGRATION_SNAPSHOTTER:+"-eBUILDKIT_INTEGRATION_SNAPSHOTTER"} -e BUILDKIT_REGISTRY_MIRROR_DIR=/root/.cache/registry -e BUILDKIT_INTEGRATION_DOCKERD_FLAGS --privileged $iid go test $coverageFlags ${TESTFLAGS:--v} ${TESTPKGS:-./...})
81+
cid=$(docker create --rm -v /tmp $coverageVol --volumes-from=$cacheVolume -e GITHUB_REF -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e TEST_DOCKERD -e SKIP_INTEGRATION_TESTS -e BUILDKIT_TEST_ENABLE_FEATURES -e BUILDKIT_TEST_DISABLE_FEATURES ${BUILDKIT_INTEGRATION_SNAPSHOTTER:+"-eBUILDKIT_INTEGRATION_SNAPSHOTTER"} -e BUILDKIT_REGISTRY_MIRROR_DIR=/root/.cache/registry -e BUILDKIT_INTEGRATION_DOCKERD_FLAGS --privileged $iid go test $coverageFlags ${TESTFLAGS:--v} ${TESTPKGS:-./...})
8282
if [ "$TEST_DOCKERD" = "1" ]; then
8383
docker cp "$TEST_DOCKERD_BINARY" $cid:/usr/bin/dockerd
8484
fi
@@ -118,7 +118,7 @@ if [ "$TEST_DOCKERFILE" == 1 ]; then
118118

119119
if [ -s $tarout ]; then
120120
if [ "$release" = "mainline" ] || [ "$release" = "labs" ] || [ -n "$DOCKERFILE_RELEASES_CUSTOM" ] || [ "$GITHUB_ACTIONS" = "true" ]; then
121-
cid=$(docker create -v /tmp $coverageVol --rm --privileged --volumes-from=$cacheVolume -e GITHUB_REF -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e TEST_DOCKERD -e BUILDKIT_REGISTRY_MIRROR_DIR=/root/.cache/registry -e BUILDKIT_WORKER_RANDOM -e BUILDKIT_INTEGRATION_DOCKERD_FLAGS -e FRONTEND_GATEWAY_ONLY=local:/$release.tar -e EXTERNAL_DF_FRONTEND=/dockerfile-frontend $iid go test $coverageFlags --count=1 -tags "$buildtags" ${TESTFLAGS:--v} ./frontend/dockerfile)
121+
cid=$(docker create -v /tmp $coverageVol --rm --privileged --volumes-from=$cacheVolume -e GITHUB_REF -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e TEST_DOCKERD -e BUILDKIT_TEST_ENABLE_FEATURES -e BUILDKIT_TEST_DISABLE_FEATURES -e BUILDKIT_REGISTRY_MIRROR_DIR=/root/.cache/registry -e BUILDKIT_WORKER_RANDOM -e BUILDKIT_INTEGRATION_DOCKERD_FLAGS -e FRONTEND_GATEWAY_ONLY=local:/$release.tar -e EXTERNAL_DF_FRONTEND=/dockerfile-frontend $iid go test $coverageFlags --count=1 -tags "$buildtags" ${TESTFLAGS:--v} ./frontend/dockerfile)
122122
docker cp $tarout $cid:/$release.tar
123123
if [ "$TEST_DOCKERD" = "1" ]; then
124124
docker cp "$TEST_DOCKERD_BINARY" $cid:/usr/bin/dockerd

util/testutil/integration/sandbox.go

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ func (b backend) Snapshotter() string {
4646
}
4747

4848
func (b backend) isUnsupportedFeature(feature string) bool {
49+
if enabledFeatures := os.Getenv("BUILDKIT_TEST_ENABLE_FEATURES"); enabledFeatures != "" {
50+
for _, enabledFeature := range strings.Split(enabledFeatures, ",") {
51+
if feature == enabledFeature {
52+
return false
53+
}
54+
}
55+
}
56+
if disabledFeatures := os.Getenv("BUILDKIT_TEST_DISABLE_FEATURES"); disabledFeatures != "" {
57+
for _, disabledFeature := range strings.Split(disabledFeatures, ",") {
58+
if feature == disabledFeature {
59+
return true
60+
}
61+
}
62+
}
4963
for _, unsupportedFeature := range b.unsupportedFeatures {
5064
if feature == unsupportedFeature {
5165
return true
@@ -270,22 +284,22 @@ func printLogs(logs map[string]*bytes.Buffer, f func(args ...interface{})) {
270284
}
271285

272286
const (
273-
FeatureCacheExport = "cache export"
274-
FeatureCacheImport = "cache import"
275-
FeatureDirectPush = "direct push"
276-
FeatureFrontendOutline = "frontend outline"
277-
FeatureFrontendTargets = "frontend targets"
278-
FeatureImageExporter = "image exporter"
287+
FeatureCacheExport = "cache_export"
288+
FeatureCacheImport = "cache_import"
289+
FeatureDirectPush = "direct_push"
290+
FeatureFrontendOutline = "frontend_outline"
291+
FeatureFrontendTargets = "frontend_targets"
292+
FeatureImageExporter = "image_exporter"
279293
FeatureInfo = "info"
280-
FeatureMultiCacheExport = "multi cache export"
281-
FeatureMultiPlatform = "multi-platform"
282-
FeatureOCIExporter = "oci exporter"
283-
FeatureOCILayout = "oci layout"
294+
FeatureMultiCacheExport = "multi_cache_export"
295+
FeatureMultiPlatform = "multi_platform"
296+
FeatureOCIExporter = "oci_exporter"
297+
FeatureOCILayout = "oci_layout"
284298
FeatureProvenance = "provenance"
285299
FeatureSBOM = "sbom"
286-
FeatureSecurityMode = "security mode"
287-
FeatureSourceDateEpoch = "source date epoch"
288-
FeatureCNINetwork = "cni network"
300+
FeatureSecurityMode = "security_mode"
301+
FeatureSourceDateEpoch = "source_date_epoch"
302+
FeatureCNINetwork = "cni_network"
289303
)
290304

291305
var features = map[string]struct{}{

0 commit comments

Comments
 (0)