From 0028407379eb0acdf0bc8be4af317af4f9b85631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Fri, 8 Nov 2024 14:34:23 +0100 Subject: [PATCH 1/3] feat: update k6lint to v0.2.0 --- go.mod | 5 +++-- go.sum | 14 ++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index a5d5452..e722762 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/google/go-github/v62 v62.0.0 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 github.com/grafana/clireadme v0.1.0 - github.com/grafana/k6lint v0.1.0 + github.com/grafana/k6lint v0.2.0 github.com/narqo/go-badge v0.0.0-20230821190521-c9a75c019a59 github.com/samber/slog-logrus/v2 v2.5.0 github.com/sirupsen/logrus v1.9.3 @@ -40,6 +40,7 @@ require ( github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-querystring v1.1.0 // indirect + github.com/grafana/k6foundry v0.3.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/henvic/httpretty v0.0.6 // indirect @@ -70,7 +71,7 @@ require ( golang.org/x/crypto v0.23.0 // indirect golang.org/x/exp v0.0.0-20221006183845-316c7553db56 // indirect golang.org/x/image v0.18.0 // indirect - golang.org/x/mod v0.20.0 // indirect + golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/oauth2 v0.6.0 // indirect golang.org/x/sync v0.7.0 // indirect diff --git a/go.sum b/go.sum index 12d310e..93ecef9 100644 --- a/go.sum +++ b/go.sum @@ -44,8 +44,8 @@ github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcej github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= -github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= -github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/gliderlabs/ssh v0.3.7 h1:iV3Bqi942d9huXnzEF2Mt+CY9gLu8DNM4Obd+8bODRE= github.com/gliderlabs/ssh v0.3.7/go.mod h1:zpHEXBstFnQYtGnB8k8kQLol82umzn/2/snG7alWVD8= @@ -79,8 +79,10 @@ github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaU github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/grafana/clireadme v0.1.0 h1:KYEYSnYdSzmHf3bufaK6fQZ5j4dzvM/T+G6Ba+qNnAM= github.com/grafana/clireadme v0.1.0/go.mod h1:Wy4KIG2ZBGMYAYyF9l7qAy+yoJVasqk/txsRgoRI3gc= -github.com/grafana/k6lint v0.1.0 h1:egUuy8Dmc1Wi5eXBnbGC2QkZIt71KTrOnMr/B5bgkzk= -github.com/grafana/k6lint v0.1.0/go.mod h1:/KU+Ws4QIlNN50cxkRHM7h6dIw7c9nXrFvqzQqq29hY= +github.com/grafana/k6foundry v0.3.0 h1:C+6dPbsOv7Uq4hEhBFNuYqmTdE9jQ0VqhXqBDtMkVTE= +github.com/grafana/k6foundry v0.3.0/go.mod h1:/NtBSQQgXup5SVbfInl0Q8zKVx08xgvXIZ0xncqexEs= +github.com/grafana/k6lint v0.2.0 h1:dEClo580VYmni/QHzF8m8svzdkY7XSYsbZovtDKD7Oo= +github.com/grafana/k6lint v0.2.0/go.mod h1:BQKSiLzZSniqZid6dW6/TX83Cm3Jt+n+1fa6VbSTg0A= github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw= github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= @@ -199,8 +201,8 @@ golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ= golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= -golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= From 777a74675b5078cbc42e2cd5bdf2c4780e96c99b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Fri, 8 Nov 2024 14:34:44 +0100 Subject: [PATCH 2/3] feat: 1 week TTL for compliance check cache --- cmd/lint.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/lint.go b/cmd/lint.go index f06b082..9fff539 100644 --- a/cmd/lint.go +++ b/cmd/lint.go @@ -8,11 +8,15 @@ import ( "log/slog" "os" "path/filepath" + "time" "github.com/go-git/go-git/v5" "github.com/grafana/k6lint" ) +// complianceCacheTTL is a TTL for compliance cahhe, 1 week +const complianceCacheTTL = 60 * 60 * 24 * 7 + //nolint:forbidigo func loadCompliance(ctx context.Context, module string, timestamp float64) (*k6lint.Compliance, bool, error) { base, err := checksDir(ctx) @@ -36,7 +40,9 @@ func loadCompliance(ctx context.Context, module string, timestamp float64) (*k6l return nil, false, err } - if comp.Timestamp >= timestamp { + age := float64(time.Now().Unix()) - comp.Timestamp + + if comp.Timestamp >= timestamp && age <= complianceCacheTTL { return &comp, true, nil } From ceab8192ffa55551cb2d509c012d10e2ccd43a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Fri, 8 Nov 2024 14:34:54 +0100 Subject: [PATCH 3/3] docs: prepare release notes --- releases/v0.1.33.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 releases/v0.1.33.md diff --git a/releases/v0.1.33.md b/releases/v0.1.33.md new file mode 100644 index 0000000..2170a06 --- /dev/null +++ b/releases/v0.1.33.md @@ -0,0 +1,35 @@ +k6registry `v0.1.33` is here 🎉! + +This is an internal maintenance release. +- Update k6lint to v0.2.0 +- Compliance check TTL + +## k6lint v0.2.0 + +k6lint v0.2.0 includes two new checkers: + +- build checker +- smoke checker + +### build checker + +The check is successful if the extension can be built with the latest k6 release. + +### smoke checker + +The check is successful if there is a smoke test script and it runs successfully with the k6 built with the extension. + +Obviously, a prerequisite for a successful run is that the build checker runs successfully, otherwise k6 cannot be built with the extension. + +The smoke test script file is searched for in the root of the repository and in the `test`,`tests`,`examples` directories. The name of the smoke test script is one of the following: + - `smoke.js` + - `smoke.ts` + - `smoke.test.js` + - `smoke.test.ts` + +## Compliance check TTL + +The result of the compliance check was previously cached until the source code of the given extension was changed. + +The result of the build check depends not only on the source code of the given extension, but also on the latest k6 release. This made it necessary to introduce a TTL (time to live) value in the compliance check cache. +