From b03e2783d6c71ab230c8d82de5746bac84211081 Mon Sep 17 00:00:00 2001 From: Karsten Jeschkies Date: Tue, 18 Jan 2022 15:04:51 +0100 Subject: [PATCH] Package logcli as rpm and deb. (#4667) * Package logcli as rpm, deb and apk. * Package logcli on release builds. --- Makefile | 6 +++++- loki-build-image/Dockerfile | 5 +++++ tools/nfpm.yaml | 17 +++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tools/nfpm.yaml diff --git a/Makefile b/Makefile index ac018c522b6ac..688bc6ff31929 100644 --- a/Makefile +++ b/Makefile @@ -252,7 +252,11 @@ dist: clean for i in dist/*; do zip -j -m $$i.zip $$i; done pushd dist && sha256sum * > SHA256SUMS && popd -publish: dist +packages: dist + nfpm package -f tools/nfpm.yaml -p rpm -t dist/ + nfpm package -f tools/nfpm.yaml -p deb -t dist/ + +publish: packages ./tools/release ######## diff --git a/loki-build-image/Dockerfile b/loki-build-image/Dockerfile index bb1df34d3e264..afc776555ce6d 100644 --- a/loki-build-image/Dockerfile +++ b/loki-build-image/Dockerfile @@ -43,6 +43,10 @@ RUN GO111MODULE=on go get github.com/fatih/faillint@v1.5.0 FROM golang:1.17.2 as ghr RUN GO111MODULE=on go get github.com/tcnksm/ghr +# Install nfpm (https://nfpm.goreleaser.com) for creating .deb and .rpm packages. +FROM golang:1.17.2 as nfpm +RUN GO111MODULE=on go get github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.11.3 + FROM golang:1.17.2-buster RUN apt-get update && \ apt-get install -qy \ @@ -59,6 +63,7 @@ COPY --from=golangci /bin/golangci-lint /usr/local/bin COPY --from=drone /usr/local/bin/drone /usr/bin/drone COPY --from=faillint /go/bin/faillint /usr/bin/faillint COPY --from=ghr /go/bin/ghr /usr/bin/ghr +COPY --from=nfpm /go/bin/nfpm /usr/bin/nfpm # Install some necessary dependencies. # Forcing GO111MODULE=on is required to specify dependencies at specific versions using the go mod notation. diff --git a/tools/nfpm.yaml b/tools/nfpm.yaml new file mode 100644 index 0000000000000..26f73ebd31e51 --- /dev/null +++ b/tools/nfpm.yaml @@ -0,0 +1,17 @@ +name: "logcli" +arch: "amd64" +platform: "linux" +version: ${CIRCLE_TAG} +section: "default" +provides: +- logcli +maintainer: "Grafana Labs " +description: | + LogCLI is the command-line interface to Loki. + It facilitates running LogQL queries against a Loki instance. +vendor: "Grafana Labs Inc" +homepage: "https://grafana.com/loki" +license: "AGPL-3.0" +contents: +- src: ./dist/logcli-linux-amd64 + dst: /usr/local/bin/logcli