2023-07-07 22:01:34 -04:00
|
|
|
{ lib, config, pkgs, ... }:
|
2022-04-02 12:40:35 -07:00
|
|
|
with lib; let
|
2022-04-02 13:43:57 -07:00
|
|
|
inherit (config) testing;
|
2020-04-05 21:25:34 +07:00
|
|
|
|
|
|
|
|
script = pkgs.writeScript "run-local-k8s-tests-${testing.name}.sh" ''
|
|
|
|
|
#!${pkgs.runtimeShell}
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
KUBECONFIG=''${KUBECONFIG:-~/.kube/config}
|
|
|
|
|
SKOPEOARGS=""
|
|
|
|
|
|
|
|
|
|
while (( "$#" )); do
|
|
|
|
|
case "$1" in
|
|
|
|
|
--kubeconfig)
|
|
|
|
|
KUBECONFIG=$2
|
|
|
|
|
shift 2
|
|
|
|
|
;;
|
|
|
|
|
--skopeo-args)
|
|
|
|
|
SKOPEOARGS=$2
|
|
|
|
|
shift 2
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
echo "--> copying docker images to registry"
|
|
|
|
|
${testing.docker.copyScript} $SKOPEOARGS
|
|
|
|
|
|
|
|
|
|
echo "--> running tests"
|
|
|
|
|
${testing.testScript} --kube-config=$KUBECONFIG
|
|
|
|
|
'';
|
2023-07-07 22:01:34 -04:00
|
|
|
in
|
|
|
|
|
{
|
2020-04-05 21:25:34 +07:00
|
|
|
options.testing.runtime.local = {
|
|
|
|
|
script = mkOption {
|
|
|
|
|
type = types.package;
|
|
|
|
|
description = "Runtime script";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
config.testing.runtime.local.script = script;
|
|
|
|
|
}
|