Home

jsonnetpecker @main - refs - log -
-
https://git.jolheiser.com/jsonnetpecker.git
Woodpecker config service for jsonnet
tree log patch
migrate to ffjsonnet If it's supposed to be for using jsonnet, may as well configure it with jsonnet in the first place. Signed-off-by: jolheiser <git@jolheiser.com>
Signature
-----BEGIN SSH SIGNATURE----- U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgBTEvCQk6VqUAdN2RuH6bj1dNkY oOpbPWj+jw4ua1B1cAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5 AAAAQPl+FHSRdDaZtivOrJUSMrfG+d8Y4k4IWjK0vUB4xQZ2s6acHKUCBDqVSU10eMnXsh I+pMbFPdeqeAVdBg7X2ww= -----END SSH SIGNATURE-----
jolheiser <git@jolheiser.com>
4 months ago
4 changed files, 13 additions(+), 6 deletions(-)
README.mdgo.modgo.summain.go
I README.md
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
diff --git a/README.md b/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..fba182a4529394951195b2055e42e4c9253ea22b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+# jsonnetpecker
+
+A [Woodpecker Config Extension](https://woodpecker-ci.org/docs/usage/extensions/configuration-extension) to parse [jsonnet](https://jsonnet.org/) configs.
+
+## License
+
+[MIT](LICENSE)
M go.mod -> go.mod
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
diff --git a/go.mod b/go.mod
index 11a7c36fc249b635ddf55c2171df4cc7f03ddbd8..c044e393319193e19c7f23b1b525828d4fef9bd1 100644
--- a/go.mod
+++ b/go.mod
@@ -8,6 +8,7 @@ 	github.com/go-chi/chi/v5 v5.2.3
 	github.com/google/go-jsonnet v0.21.0
 	github.com/peterbourgon/ff/v3 v3.4.0
 	github.com/yaronf/httpsign v0.4.1
+	go.jolheiser.com/ffjsonnet v0.0.0-20240816163546-0d0f7d30cc19
 	gopkg.in/yaml.v3 v3.0.1
 )
 
@@ -32,6 +33,5 @@ 	github.com/segmentio/asm v1.2.1 // indirect
 	github.com/valyala/fastjson v1.6.4 // indirect
 	golang.org/x/crypto v0.43.0 // indirect
 	golang.org/x/sys v0.37.0 // indirect
-	gopkg.in/yaml.v2 v2.4.0 // indirect
 	sigs.k8s.io/yaml v1.4.0 // indirect
 )
M go.sum -> go.sum
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/go.sum b/go.sum
index f80a6722765844e1ae2fae61c8dd18d1ff69e2b6..d3d80877ed13de722841fc52fcf85282141baf0f 100644
--- a/go.sum
+++ b/go.sum
@@ -60,14 +60,14 @@ github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ=
 github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=
 github.com/yaronf/httpsign v0.4.1 h1:q2yLLkL4+8G9VmOBR6SIsD4+00ncjt+GyadGA3weY0Y=
 github.com/yaronf/httpsign v0.4.1/go.mod h1:euOXi3++HLtx5YlsJEWcIzF3ztK4TL2M2F0Wg3KL+V0=
+go.jolheiser.com/ffjsonnet v0.0.0-20240816163546-0d0f7d30cc19 h1:QRSdc/EmohEl+TkCU/l2frlwSIVR72HOZ1vHHhDwSwA=
+go.jolheiser.com/ffjsonnet v0.0.0-20240816163546-0d0f7d30cc19/go.mod h1:uW2oeieTw8qhLnwhImqMyGFFMW60mKgIoCp2JxtUHOQ=
 golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04=
 golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0=
 golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
 golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
-gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
 gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
M main.go -> main.go
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
diff --git a/main.go b/main.go
index 897822f4e2e5ec3f75a4e0465c16a1e3fcf17fc0..8b22f43e0407c32e4b9fc2f0e2eceec185f748f2 100644
--- a/main.go
+++ b/main.go
@@ -18,8 +18,8 @@ 	"github.com/go-chi/chi/v5"
 	"github.com/go-chi/chi/v5/middleware"
 	"github.com/google/go-jsonnet"
 	"github.com/peterbourgon/ff/v3"
-	"github.com/peterbourgon/ff/v3/ffyaml"
 	"github.com/yaronf/httpsign"
+	"go.jolheiser.com/ffjsonnet"
 	"gopkg.in/yaml.v3"
 )
 
@@ -37,7 +37,7 @@
 func maine() error {
 	var args args
 	fs := flag.NewFlagSet("jsonnetpecker", flag.ExitOnError)
-	fs.String("config", ".config.yaml", "Path to config file")
+	fs.String("config", ".config.jsonnet", "Path to config file")
 	fs.IntVar(&args.port, "port", args.port, "Port to listen on")
 	fs.IntVar(&args.port, "p", args.port, "--port")
 	fs.StringVar(&args.pubKey, "public-key", args.pubKey, "Woodpecker public key for verification")
@@ -66,7 +66,7 @@ 	fs.BoolVar(&args.logJSON, "j", args.logJSON, "--json")
 	if err := ff.Parse(fs, os.Args[1:],
 		ff.WithConfigFileFlag("config"),
 		ff.WithAllowMissingConfigFile(true),
-		ff.WithConfigFileParser(ffyaml.Parser),
+		ff.WithConfigFileParser(ffjsonnet.Parser),
 		ff.WithEnvVarPrefix("JSONNETPECKER"),
 	); err != nil {
 		return err