2022-12-17 10:02:37 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "conftest";
|
2023-04-12 12:48:02 +00:00
|
|
|
version = "0.41.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2020-07-18 16:06:22 +00:00
|
|
|
owner = "open-policy-agent";
|
2020-04-24 23:36:52 +00:00
|
|
|
repo = "conftest";
|
2022-12-17 10:02:37 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-04-12 12:48:02 +00:00
|
|
|
hash = "sha256-uT0IpoBC4gxshjiKMwzZUApudHCGGh1AF+d6DKJ9GXo=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-04-12 12:48:02 +00:00
|
|
|
vendorHash = "sha256-ucHMCKwtei+2r8P5BdcRPyLqYNStBo8jYOdVI+0adas=";
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2021-08-27 14:25:00 +00:00
|
|
|
ldflags = [
|
2020-11-21 19:51:51 +00:00
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X github.com/open-policy-agent/conftest/internal/commands.version=${version}"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
|
|
|
];
|
2021-10-28 06:52:43 +00:00
|
|
|
|
|
|
|
preCheck = ''
|
2022-07-14 12:49:19 +00:00
|
|
|
export HOME="$(mktemp -d)"
|
2021-10-28 06:52:43 +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-09-18 10:52:07 +00:00
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
2022-07-14 12:49:19 +00:00
|
|
|
export HOME="$(mktemp -d)"
|
2021-09-18 10:52:07 +00:00
|
|
|
$out/bin/conftest --version | grep ${version} > /dev/null
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Write tests against structured configuration data";
|
2021-09-18 10:52:07 +00:00
|
|
|
downloadPage = "https://github.com/open-policy-agent/conftest";
|
|
|
|
homepage = "https://www.conftest.dev";
|
2022-12-17 10:02:37 +00:00
|
|
|
changelog = "https://github.com/open-policy-agent/conftest/releases/tag/v${version}";
|
2021-09-18 10:52:07 +00:00
|
|
|
license = licenses.asl20;
|
2020-11-21 19:51:51 +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-12-06 16:07:01 +00:00
|
|
|
maintainers = with maintainers; [ jk yurrriq ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2020-07-18 16:06:22 +00:00
|
|
|
}
|