2022-12-04 13:05:47 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
|
|
|
}:
|
2019-06-23 02:03:47 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "conftest";
|
2023-12-13 23:26:38 +00:00
|
|
|
version = "0.47.0";
|
2019-09-18 21:59:36 +00:00
|
|
|
|
2019-06-23 02:03:47 +00:00
|
|
|
src = fetchFromGitHub {
|
2020-06-29 19:14:05 +00:00
|
|
|
owner = "open-policy-agent";
|
2019-06-23 02:03:47 +00:00
|
|
|
repo = "conftest";
|
2022-12-04 13:05:47 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-12-13 23:26:38 +00:00
|
|
|
hash = "sha256-nWcwy998ivz6ftr1zkN2JlLxHLMB47OZS/vnaYkoZHI=";
|
2019-06-23 02:03:47 +00:00
|
|
|
};
|
2023-12-13 23:26:38 +00:00
|
|
|
vendorHash = "sha256-puAchYXCLE8yenqcCrclNqCqHP3WyFDQhzWgFv4yFUs=";
|
2019-09-10 19:15:34 +00:00
|
|
|
|
2021-08-26 06:45:51 +00:00
|
|
|
ldflags = [
|
2020-10-04 13:54:37 +00:00
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X github.com/open-policy-agent/conftest/internal/commands.version=${version}"
|
|
|
|
];
|
2019-06-23 02:03:47 +00:00
|
|
|
|
2022-12-04 13:05:47 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
|
|
|
];
|
2021-10-26 11:27:10 +00:00
|
|
|
|
|
|
|
preCheck = ''
|
2022-07-06 14:44:34 +00:00
|
|
|
export HOME="$(mktemp -d)"
|
2021-10-26 11:27:10 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd conftest \
|
|
|
|
--bash <($out/bin/conftest completion bash) \
|
|
|
|
--fish <($out/bin/conftest completion fish) \
|
|
|
|
--zsh <($out/bin/conftest completion zsh)
|
|
|
|
'';
|
2021-08-27 14:02:18 +00:00
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
2022-07-06 14:44:34 +00:00
|
|
|
export HOME="$(mktemp -d)"
|
2021-08-27 14:02:18 +00:00
|
|
|
$out/bin/conftest --version | grep ${version} > /dev/null
|
|
|
|
'';
|
|
|
|
|
2020-03-27 07:33:21 +00:00
|
|
|
meta = with lib; {
|
2019-06-23 02:03:47 +00:00
|
|
|
description = "Write tests against structured configuration data";
|
2021-08-27 14:02:18 +00:00
|
|
|
downloadPage = "https://github.com/open-policy-agent/conftest";
|
|
|
|
homepage = "https://www.conftest.dev";
|
2022-12-04 13:05:47 +00:00
|
|
|
changelog = "https://github.com/open-policy-agent/conftest/releases/tag/v${version}";
|
2021-08-27 14:02:18 +00:00
|
|
|
license = licenses.asl20;
|
2020-10-04 13:58:32 +00:00
|
|
|
longDescription = ''
|
|
|
|
Conftest helps you write tests against structured configuration data.
|
|
|
|
Using Conftest you can write tests for your Kubernetes configuration,
|
|
|
|
Tekton pipeline definitions, Terraform code, Serverless configs or any
|
|
|
|
other config files.
|
|
|
|
|
|
|
|
Conftest uses the Rego language from Open Policy Agent for writing the
|
|
|
|
assertions. You can read more about Rego in 'How do I write policies' in
|
|
|
|
the Open Policy Agent documentation.
|
|
|
|
'';
|
2021-11-03 00:38:27 +00:00
|
|
|
maintainers = with maintainers; [ jk yurrriq ];
|
2019-06-23 02:03:47 +00:00
|
|
|
};
|
2020-06-29 19:14:05 +00:00
|
|
|
}
|