mirror of
https://github.com/monitoring-mixins/website.git
synced 2024-12-14 11:37:31 +00:00
Better tooling
* Use jsonnet-bundler 0.4.0 * Add a Makefile for simplicity * Use go.mod to lock tools to specific versions * Use temporary directory to store tooling binaries * Speed up cloning mixin by remove --filter
This commit is contained in:
parent
daf31cbe63
commit
df43594957
7 changed files with 106 additions and 12 deletions
|
@ -7,8 +7,4 @@ steps:
|
||||||
image: golang:1.14
|
image: golang:1.14
|
||||||
commands:
|
commands:
|
||||||
- apt update && apt install jq -y
|
- apt update && apt install jq -y
|
||||||
- GO111MODULE=off go get -u github.com/myitcv/gobin
|
- make && git diff --exit-code
|
||||||
- gobin github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@efe0c9e864431e93d5c3376bd5931d0fb9b2a296
|
|
||||||
- gobin github.com/brancz/gojsontoyaml
|
|
||||||
- gobin github.com/google/go-jsonnet/cmd/jsonnet
|
|
||||||
- ./generate.sh && git diff --exit-code
|
|
||||||
|
|
22
Makefile
Normal file
22
Makefile
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
SHELL=/bin/bash -o pipefail
|
||||||
|
|
||||||
|
BIN_DIR?=$(shell pwd)/tmp/bin
|
||||||
|
|
||||||
|
JB_BIN=$(BIN_DIR)/jb
|
||||||
|
GOJSONTOYAML_BIN=$(BIN_DIR)/gojsontoyaml
|
||||||
|
JSONNET_BIN=$(BIN_DIR)/jsonnet
|
||||||
|
TOOLING=$(JB_BIN) $(GOJSONTOYAML_BIN) $(JSONNET_BIN)
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: generate
|
||||||
|
|
||||||
|
.PHONY: generate
|
||||||
|
generate: $(JB_BIN) $(GOJSONTOYAML_BIN) $(JSONNET_BIN)
|
||||||
|
./hack/generate.sh
|
||||||
|
|
||||||
|
$(BIN_DIR):
|
||||||
|
mkdir -p $(BIN_DIR)
|
||||||
|
|
||||||
|
$(TOOLING): $(BIN_DIR)
|
||||||
|
@echo Installing tools from hack/tools.go
|
||||||
|
@cd hack && go list -mod=mod -tags tools -f '{{ range .Imports }}{{ printf "%s\n" .}}{{end}}' ./ | xargs -tI % go build -mod=mod -o $(BIN_DIR) %
|
|
@ -4,12 +4,11 @@
|
||||||
|
|
||||||
0. Install [required software](#requirements)
|
0. Install [required software](#requirements)
|
||||||
1. Add new mixin to [mixins.yaml](mixins.yaml) file
|
1. Add new mixin to [mixins.yaml](mixins.yaml) file
|
||||||
2. Run `generate.sh`
|
2. Run `make`
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- jq
|
- jq
|
||||||
- [jsonnet](https://github.com/google/go-jsonnet)
|
- make
|
||||||
- [jsonnet-bundler](https://github.com/jsonnet-bundler/jsonnet-bundler)@efe0c9e864431e93d5c3376bd5931d0fb9b2a296
|
- git
|
||||||
- [gojsontoyaml](https://github.com/brancz/gojsontoyaml)
|
- golang
|
||||||
|
|
||||||
|
|
|
@ -4,14 +4,17 @@
|
||||||
|
|
||||||
MANIFESTS="assets"
|
MANIFESTS="assets"
|
||||||
TOP=$(git rev-parse --show-toplevel)
|
TOP=$(git rev-parse --show-toplevel)
|
||||||
TMPDIR="${TOP}/tmp"
|
TMPDIR="${TOP}/tmp/repos"
|
||||||
|
|
||||||
|
# Make sure to use project tooling
|
||||||
|
PATH="${TOP}/tmp/bin:${PATH}"
|
||||||
|
|
||||||
download_mixin() {
|
download_mixin() {
|
||||||
local mixin="$1"
|
local mixin="$1"
|
||||||
local repo="$2"
|
local repo="$2"
|
||||||
local subdir="$3"
|
local subdir="$3"
|
||||||
|
|
||||||
git clone --depth 1 --filter=blob:none "$repo" "${TMPDIR}/$mixin"
|
git clone --depth 1 "$repo" "${TMPDIR}/$mixin"
|
||||||
mkdir -p "${TOP}/${MANIFESTS}/${mixin}/dashboards"
|
mkdir -p "${TOP}/${MANIFESTS}/${mixin}/dashboards"
|
||||||
(
|
(
|
||||||
cd "${TMPDIR}/${mixin}/${subdir}"
|
cd "${TMPDIR}/${mixin}/${subdir}"
|
9
hack/go.mod
Normal file
9
hack/go.mod
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
module github.com/monitoring-mixins/website/hack
|
||||||
|
|
||||||
|
go 1.14
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/brancz/gojsontoyaml v0.0.0-20191212081931-bf2969bbd742
|
||||||
|
github.com/google/go-jsonnet v0.16.1-0.20200703153429-aaf50f5b655f
|
||||||
|
github.com/jsonnet-bundler/jsonnet-bundler v0.4.0
|
||||||
|
)
|
54
hack/go.sum
Normal file
54
hack/go.sum
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=
|
||||||
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=
|
||||||
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
|
github.com/brancz/gojsontoyaml v0.0.0-20191212081931-bf2969bbd742 h1:PdvQdwUXiFnSmWsOJcBXLpyH3mJfP2FMPTT3J0i7+8o=
|
||||||
|
github.com/brancz/gojsontoyaml v0.0.0-20191212081931-bf2969bbd742/go.mod h1:IyUJYN1gvWjtLF5ZuygmxbnsAyP3aJS6cHzIuZY50B0=
|
||||||
|
github.com/campoy/embedmd v1.0.0/go.mod h1:oxyr9RCiSXg0M3VJ3ks0UGfp98BpSSGr0kpiX3MzVl8=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
|
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
|
||||||
|
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
|
||||||
|
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
|
||||||
|
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
|
github.com/google/go-jsonnet v0.16.1-0.20200703153429-aaf50f5b655f h1:mw4KoMG5/DXLPhpKXQRYTEIZFkFo0a1HU2R1HbeYpek=
|
||||||
|
github.com/google/go-jsonnet v0.16.1-0.20200703153429-aaf50f5b655f/go.mod h1:sOcuej3UW1vpPTZOr8L7RQimqai1a57bt5j22LzGZCw=
|
||||||
|
github.com/jsonnet-bundler/jsonnet-bundler v0.4.0 h1:4BKZ6LDqPc2wJDmaKnmYD/vDjUptJtnUpai802MibFc=
|
||||||
|
github.com/jsonnet-bundler/jsonnet-bundler v0.4.0/go.mod h1:/by7P/OoohkI3q4CgSFqcoFsVY+IaNbzOVDknEsKDeU=
|
||||||
|
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||||
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||||
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||||
|
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
|
||||||
|
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||||
|
github.com/mattn/go-isatty v0.0.6/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||||
|
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||||
|
github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM=
|
||||||
|
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
|
||||||
|
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
||||||
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
||||||
|
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||||
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
|
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190310054646-10058d7d4faa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
|
||||||
|
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
|
||||||
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/yaml.v2 v2.1.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
|
||||||
|
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
11
hack/tools.go
Normal file
11
hack/tools.go
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
//+build tools
|
||||||
|
|
||||||
|
// Package tools tracks dependencies for tools that used in the build process.
|
||||||
|
// See https://github.com/golang/go/wiki/Modules
|
||||||
|
package hack
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "github.com/brancz/gojsontoyaml"
|
||||||
|
_ "github.com/google/go-jsonnet/cmd/jsonnet"
|
||||||
|
_ "github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb"
|
||||||
|
)
|
Loading…
Reference in a new issue