diff options
author | 06kellyjac <dev@j-k.io> | 2022-03-09 14:40:06 +0000 |
---|---|---|
committer | 06kellyjac <dev@j-k.io> | 2022-03-09 14:40:22 +0000 |
commit | 546dc00a13c612df8091449370a212fc00d8e81d (patch) | |
tree | bad50169da5afe52bff923ee7a47e47b1986397a /pkgs/applications/networking/cluster/driftctl | |
parent | fa32fb32d1da0794398e2803bdea3db43f8e46d2 (diff) |
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
Diffstat (limited to 'pkgs/applications/networking/cluster/driftctl')
-rw-r--r-- | pkgs/applications/networking/cluster/driftctl/default.nix | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/pkgs/applications/networking/cluster/driftctl/default.nix b/pkgs/applications/networking/cluster/driftctl/default.nix index 725cd419d083e..4c22b9adca5fa 100644 --- a/pkgs/applications/networking/cluster/driftctl/default.nix +++ b/pkgs/applications/networking/cluster/driftctl/default.nix @@ -1,56 +1,56 @@ -{ lib, buildGoModule, fetchFromGitHub }: +{ lib, buildGoModule, fetchFromGitHub, installShellFiles }: buildGoModule rec { pname = "driftctl"; - version = "0.20.0"; + version = "0.23.0"; src = fetchFromGitHub { - owner = "cloudskiff"; + owner = "snyk"; repo = "driftctl"; rev = "v${version}"; - sha256 = "sha256-8egkz1wXvdNoTkbhOdvoP4hrBPmuiUvd2QaD6tPH2xU="; + sha256 = "sha256-TUwTvCsWB+n+shVU1hTzLYROG9Wp4ySzJwAnappK7TY="; }; - vendorSha256 = "sha256-lftOTcob8l9dUZkH2MMxzD6FZzLOR/PXEXFVdOaguK4="; - - postUnpack = '' - # 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. - # Making it out-in is quite a job, and why bother? - find -name '*.go' \ - | xargs sed -i 's,https://2lvzgmrf2e.execute-api.eu-west-3.amazonaws.com/,https://0.0.0.0/,g' - - # and remove corresponding flags from --help, so things look tidy. - find -name driftctl.go | \ - xargs sed -i -e '/("no-version-check"/ d' -e '/("disable-telemetry"/ d' - - # Presumably it can be done with ldflags, but I failed to find incantation - # that would work, we here we go old-school. - find -name version.go | xargs sed -i -e 's/"dev"/"${version}"/' - find -name build.go | xargs sed -i -e 's/"dev"/"release"/' - - # Fix the tests that checks for dev-dev. - find -name version_test.go | xargs sed -i -e 's/"dev-dev/"${version}/' - find -name driftctl_test.go | xargs sed -i -e 's/"dev-dev/"${version}/' + vendorSha256 = "sha256-I0OCRhUvuaF4k5qqPaV6R24mrd9AG5GgQCCF6yodK0E="; + + nativeBuildInputs = [ installShellFiles ]; + + ldflags = [ + "-s" + "-w" + "-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" + ]; + + postInstall = '' + installShellCompletion --cmd driftctl \ + --bash <($out/bin/driftctl completion bash) \ + --fish <($out/bin/driftctl completion fish) \ + --zsh <($out/bin/driftctl completion zsh) + ''; + + doInstallCheck = true; + installCheckPhase = '' + runHook preInstallCheck + + $out/bin/driftctl --help + $out/bin/driftctl version | grep "v${version}" + # check there's no telemetry flag + $out/bin/driftctl --help | grep -vz "telemetry" + + runHook postInstallCheck ''; meta = with lib; { - description = "Tool to track infrastructure drift"; - homepage = "https://github.com/cloudskiff/driftctl"; + homepage = "https://driftctl.com/"; + 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; - maintainers = with maintainers; [ kaction ]; + maintainers = with maintainers; [ kaction jk ]; }; } |