3
0
Fork 0
forked from mirrors/nixpkgs

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.
This commit is contained in:
Ivan Kozik 2019-02-18 03:08:00 +00:00
parent fdc9cbb793
commit 8b4b12ed7a

View file

@ -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;
};
}