From f8b4ee82aeba990d8e34b7c95debf30c4a626298 Mon Sep 17 00:00:00 2001 From: Noel Georgi Date: Thu, 15 Feb 2024 22:53:27 +0530 Subject: [PATCH] chore: update extensions test Update extensions test to use strategic patches and use `ExtensionServiceConfig` document. Depends on: https://github.com/siderolabs/extensions/pull/320 Signed-off-by: Noel Georgi --- .drone.jsonnet | 6 +- .../test/extensions/extension-patch-filter.jq | 219 +++++++++--------- 2 files changed, 110 insertions(+), 115 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 6b74e2e7d9..7c153d8a38 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -375,14 +375,14 @@ local ExtensionsStep(with_e2e=true) = extra_commands=[ // create a patch file to pass to the downstream build // ignore nvidia extensions, testing nvidia extensions needs a machine with nvidia graphics card - 'jq -R < _out/extensions-metadata | jq -s -f hack/test/extensions/extension-patch-filter.jq > _out/extensions-patch.json', - 'cat _out/extensions-patch.json', + 'jq -R < _out/extensions-metadata | jq -s -f hack/test/extensions/extension-patch-filter.jq | yq eval ".[] | split_doc" -P > _out/extensions-patch.yaml', + 'cat _out/extensions-patch.yaml', ] ); local e2e_extensions = Step('e2e-extensions', target='e2e-qemu', privileged=true, depends_on=[extensions_patch_manifest], environment={ QEMU_MEMORY_WORKERS: '4096', - WITH_CONFIG_PATCH_WORKER: '@_out/extensions-patch.json', + WITH_CONFIG_PATCH_WORKER: '@_out/extensions-patch.yaml', IMAGE_REGISTRY: local_registry, QEMU_EXTRA_DISKS: '3', SHORT_INTEGRATION_TEST: 'yes', diff --git a/hack/test/extensions/extension-patch-filter.jq b/hack/test/extensions/extension-patch-filter.jq index 442631f036..45a1035a65 100644 --- a/hack/test/extensions/extension-patch-filter.jq +++ b/hack/test/extensions/extension-patch-filter.jq @@ -1,124 +1,119 @@ [ { - "op": "add", - "path": "/machine/install/extensions", - "value": [ - { - "image": map(select(. | contains("nvidia") or contains("tailscale") or contains("xe-guest-utilities") | not)) | .[] + "machine": { + "install": { + "extensions": [ + { + "image": map(select(. | contains("nvidia") or contains("tailscale") or contains("xe-guest-utilities") | not)) | .[] + } + ], + }, + "sysctls": { + "user.max_user_namespaces": "11255" + }, + "kernel": { + "modules": [ + { + "name": "asix" + }, + { + "name": "ax88179_178a" + }, + { + "name": "ax88796b" + }, + { + "name": "binfmt_misc" + }, + { + "name": "btrfs" + }, + { + "name": "cdc_ether" + }, + { + "name": "cdc_mbim" + }, + { + "name": "cdc_ncm" + }, + { + "name": "cdc_subset" + }, + { + "name": "cdc_wdm" + }, + { + "name": "cxgb" + }, + { + "name": "cxgb3" + }, + { + "name": "cxgb4" + }, + { + "name": "cxgb4vf" + }, + { + "name": "drbd" + }, + { + "name": "gasket" + }, + { + "name": "net1080" + }, + { + "name": "option" + }, + { + "name": "qmi_wwan" + }, + { + "name": "r8153_ecm" + }, + { + "name": "thunderbolt" + }, + { + "name": "thunderbolt_net" + }, + { + "name": "usb_wwan" + }, + { + "name": "usbnet" + }, + { + "name": "usbserial" + }, + { + "name": "zaurus" + }, + { + "name": "zfs" + } + ] } - ] - }, - { - "op": "add", - "path": "/machine/sysctls", - "value": { - "user.max_user_namespaces": "11255" } }, { - "op": "add", - "path": "/machine/kernel", - "value": { - "modules": [ - { - "name": "asix" - }, - { - "name": "ax88179_178a" - }, - { - "name": "ax88796b" - }, - { - "name": "binfmt_misc" - }, - { - "name": "btrfs" - }, - { - "name": "cdc_ether" - }, - { - "name": "cdc_mbim" - }, - { - "name": "cdc_ncm" - }, - { - "name": "cdc_subset" - }, - { - "name": "cdc_wdm" - }, - { - "name": "cxgb" - }, - { - "name": "cxgb3" - }, - { - "name": "cxgb4" - }, - { - "name": "cxgb4vf" - }, - { - "name": "drbd" - }, - { - "name": "gasket" - }, - { - "name": "net1080" - }, - { - "name": "option" - }, - { - "name": "qmi_wwan" - }, - { - "name": "r8153_ecm" - }, - { - "name": "thunderbolt" - }, - { - "name": "thunderbolt_net" - }, - { - "name": "usb_wwan" - }, - { - "name": "usbnet" - }, - { - "name": "usbserial" - }, - { - "name": "zaurus" - }, - { - "name": "zfs" - } - ] - } + "apiVersion": "v1alpha1", + "kind": "ExtensionServiceConfig", + "name": "tailscale", + "environment": [ + "TS_AUTHKEY=tskey-0000000000000000" + ] }, { - "op": "add", - "path": "/machine/files", - "value": [ - { - "path": "/var/etc/nut/upsmon.conf", - "permissions": 600, - "op": "create", - "content": "MONITOR ${upsmonHost} 1 remote ${upsmonPasswd} slave\nSHUTDOWNCMD \"/sbin/poweroff\"" - }, + "apiVersion": "v1alpha1", + "kind": "ExtensionServiceConfig", + "name": "nut-client", + "configFiles": [ { - "path": "/var/etc/tailscale/auth.env", - "permissions": 600, - "op": "create", - "content": "" + "content": "MONITOR ${upsmonHost} 1 remote ${upsmonPasswd} slave\nSHUTDOWNCMD \"/sbin/poweroff\"", + "mountPath": "/usr/local/etc/nut/upsmon.conf" } ] }