driftctl: 0.20.0 -> 0.23.0
- added ldflags for stripping, version, and telemetry - added shell completions - added some install checks - updated meta - added myself as a maintainer
This commit is contained in:
parent
fa32fb32d1
commit
546dc00a13
1 changed files with 36 additions and 36 deletions
|
@ -1,56 +1,56 @@
|
||||||
{ lib, buildGoModule, fetchFromGitHub }:
|
{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
|
||||||
|
|
||||||
buildGoModule rec {
|
buildGoModule rec {
|
||||||
pname = "driftctl";
|
pname = "driftctl";
|
||||||
version = "0.20.0";
|
version = "0.23.0";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "cloudskiff";
|
owner = "snyk";
|
||||||
repo = "driftctl";
|
repo = "driftctl";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "sha256-8egkz1wXvdNoTkbhOdvoP4hrBPmuiUvd2QaD6tPH2xU=";
|
sha256 = "sha256-TUwTvCsWB+n+shVU1hTzLYROG9Wp4ySzJwAnappK7TY=";
|
||||||
};
|
};
|
||||||
|
|
||||||
vendorSha256 = "sha256-lftOTcob8l9dUZkH2MMxzD6FZzLOR/PXEXFVdOaguK4=";
|
vendorSha256 = "sha256-I0OCRhUvuaF4k5qqPaV6R24mrd9AG5GgQCCF6yodK0E=";
|
||||||
|
|
||||||
postUnpack = ''
|
nativeBuildInputs = [ installShellFiles ];
|
||||||
# Without this, tests fail to locate aws/3.19.0.json
|
|
||||||
for prefix in / \
|
|
||||||
/pkg \
|
|
||||||
/pkg/analyser \
|
|
||||||
/pkg/alerter \
|
|
||||||
/pkg/remote \
|
|
||||||
/pkg/middlewares \
|
|
||||||
/pkg/cmd/scan/output \
|
|
||||||
/pkg/iac/terraform/state \
|
|
||||||
/pkg/iac/supplier ; do
|
|
||||||
mkdir -p ./source/$prefix/github.com/cloudskiff
|
|
||||||
ln -sf $PWD/source ./source/$prefix/github.com/cloudskiff/driftctl
|
|
||||||
done
|
|
||||||
|
|
||||||
# Disable check for latest version and telemetry, which are opt-out.
|
ldflags = [
|
||||||
# Making it out-in is quite a job, and why bother?
|
"-s"
|
||||||
find -name '*.go' \
|
"-w"
|
||||||
| xargs sed -i 's,https://2lvzgmrf2e.execute-api.eu-west-3.amazonaws.com/,https://0.0.0.0/,g'
|
"-X github.com/snyk/driftctl/pkg/version.version=v${version}"
|
||||||
|
"-X github.com/snyk/driftctl/build.env=release"
|
||||||
|
"-X github.com/snyk/driftctl/build.enableUsageReporting=false"
|
||||||
|
];
|
||||||
|
|
||||||
# and remove corresponding flags from --help, so things look tidy.
|
postInstall = ''
|
||||||
find -name driftctl.go | \
|
installShellCompletion --cmd driftctl \
|
||||||
xargs sed -i -e '/("no-version-check"/ d' -e '/("disable-telemetry"/ d'
|
--bash <($out/bin/driftctl completion bash) \
|
||||||
|
--fish <($out/bin/driftctl completion fish) \
|
||||||
|
--zsh <($out/bin/driftctl completion zsh)
|
||||||
|
'';
|
||||||
|
|
||||||
# Presumably it can be done with ldflags, but I failed to find incantation
|
doInstallCheck = true;
|
||||||
# that would work, we here we go old-school.
|
installCheckPhase = ''
|
||||||
find -name version.go | xargs sed -i -e 's/"dev"/"${version}"/'
|
runHook preInstallCheck
|
||||||
find -name build.go | xargs sed -i -e 's/"dev"/"release"/'
|
|
||||||
|
|
||||||
# Fix the tests that checks for dev-dev.
|
$out/bin/driftctl --help
|
||||||
find -name version_test.go | xargs sed -i -e 's/"dev-dev/"${version}/'
|
$out/bin/driftctl version | grep "v${version}"
|
||||||
find -name driftctl_test.go | xargs sed -i -e 's/"dev-dev/"${version}/'
|
# check there's no telemetry flag
|
||||||
|
$out/bin/driftctl --help | grep -vz "telemetry"
|
||||||
|
|
||||||
|
runHook postInstallCheck
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Tool to track infrastructure drift";
|
homepage = "https://driftctl.com/";
|
||||||
homepage = "https://github.com/cloudskiff/driftctl";
|
changelog = "https://github.com/snyk/driftctl/releases/tag/v${version}";
|
||||||
|
description = "Detect, track and alert on infrastructure drift";
|
||||||
|
longDescription = ''
|
||||||
|
driftctl is a free and open-source CLI that warns of infrastructure drift
|
||||||
|
and fills in the missing piece in your DevSecOps toolbox.
|
||||||
|
'';
|
||||||
license = licenses.asl20;
|
license = licenses.asl20;
|
||||||
maintainers = with maintainers; [ kaction ];
|
maintainers = with maintainers; [ kaction jk ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue