From 8b4b12ed7ad663cdcd97370daf8a0fab33c08ac3 Mon Sep 17 00:00:00 2001 From: Ivan Kozik Date: Mon, 18 Feb 2019 03:08:00 +0000 Subject: [PATCH] prometheus-pushgateway: 0.4.0 -> 0.7.0 Add some tests to make sure the --version output includes the values passed in with -X. Add myself as a maintainer. --- .../monitoring/prometheus/pushgateway.nix | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/pkgs/servers/monitoring/prometheus/pushgateway.nix b/pkgs/servers/monitoring/prometheus/pushgateway.nix index 6509f55d46ed..4c6cc694243d 100644 --- a/pkgs/servers/monitoring/prometheus/pushgateway.nix +++ b/pkgs/servers/monitoring/prometheus/pushgateway.nix @@ -1,8 +1,8 @@ -{ stdenv, go, buildGoPackage, go-bindata, fetchFromGitHub }: +{ stdenv, go, buildGoPackage, fetchFromGitHub }: buildGoPackage rec { name = "pushgateway-${version}"; - version = "0.4.0"; + version = "0.7.0"; rev = "v${version}"; goPackagePath = "github.com/prometheus/pushgateway"; @@ -11,33 +11,39 @@ buildGoPackage rec { inherit rev; owner = "prometheus"; repo = "pushgateway"; - sha256 = "19hsv42addcx4dsjdbh64y7ggjvaaay9gag0342gz7gyl9sr719f"; + sha256 = "1sczg6vrpxv0jlqhkif8443v7mhbp3lp40g71ndqkf1s669m1pl4"; }; - buildInputs = [ go-bindata ]; - - preBuild = '' - ( - cd "go/src/$goPackagePath" - go-bindata ./resources/ - ) - ''; + buildUser = "nix@nixpkgs"; + buildDate = "19700101-00:00:00"; buildFlagsArray = '' -ldflags= - -X main.buildVersion=${version} - -X main.buildRev=${rev} - -X main.buildBranch=${rev} - -X main.buildUser=nix@nixpkgs - -X main.buildDate=19700101-00:00:00 + -X github.com/prometheus/pushgateway/vendor/github.com/prometheus/common/version.Version=${version} + -X github.com/prometheus/pushgateway/vendor/github.com/prometheus/common/version.Revision=${rev} + -X github.com/prometheus/pushgateway/vendor/github.com/prometheus/common/version.Branch=${rev} + -X github.com/prometheus/pushgateway/vendor/github.com/prometheus/common/version.BuildUser=${buildUser} + -X github.com/prometheus/pushgateway/vendor/github.com/prometheus/common/version.BuildDate=${buildDate} -X main.goVersion=${stdenv.lib.getVersion go} ''; + doInstallCheck = true; + installCheckPhase = '' + export PATH=$PATH:$bin/bin + + pushgateway --help + + # Make sure our -X options were included in the build + for s in ${version} ${rev} ${buildUser} ${buildDate}; do + pushgateway --version 2>&1 | fgrep -q -- "$s" || { echo "pushgateway --version output missing $s"; exit 1; } + done + ''; + meta = with stdenv.lib; { description = "Allows ephemeral and batch jobs to expose metrics to Prometheus"; homepage = https://github.com/prometheus/pushgateway; license = licenses.asl20; - maintainers = with maintainers; [ benley fpletz ]; + maintainers = with maintainers; [ benley fpletz ivan ]; platforms = platforms.unix; }; }