Commit Graph

11 Commits

Author SHA1 Message Date
Ville Vesilehto f77322b3fb build: bump Go version requirement to 1.24 (#7839)
Go 1.23 is no longer supported as per Go release policy.

Changes:

- Use Go v1.24.6 as the project SDK requirement
- Apply lint fixes for Go 1.24
- Fix "non-constant format string in call" issues as seen in CI.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-08-24 09:02:09 +02:00
Johan Fylling 9a423eceab report: Fetching latest OPA release version from GH (#7756)
instead of telemetry server.

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2025-07-08 13:19:40 +02:00
Anders Eknert e43ef0a979 Use any in place of interface{} (#7566)
Earlier this evening I tried to run the Go
[modernize](https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/modernize)
analyzer on OPA. That didn't go as planned:

- https://github.com/golang/go/issues/73661
- https://github.com/golang/go/issues/73663

While we wait for that to be fixed, I figured an old-fashioned
search-and-replace across the repo may work for at least the
`interface{}` to `any` conversion. That should help make it easier
to see the other fixes as applied by the modernize tool once it has
had those issues resolved.

Signed-off-by: Anders Eknert <anders@styra.com>
2025-05-12 13:57:48 +02:00
Johan Fylling 5464b005e8 Bumping golangci-lint to v1.59.1 (#6817)
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2024-06-19 15:13:43 +02:00
Ashutosh Narkar 414df4e909 Include OPA min compat version in telemetry report
This commit extends the telemetry report to include the
minimum compatible version of policies loaded into OPA.
This information can be helpful to get visibility into
era of Rego being adopted in the wild.

Fixes: #6361

Co-authored-by: Stephan Renatus <stephan@styra.com>
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2023-12-18 11:06:03 -08:00
Anders Eknert 50d4e31d6b chore: Use t.Setenv in tests (#5321)
And enable the `tenv` linter for the future.

Also, bump version of golangci-lint and fix some new
warnings that came from that.

Signed-off-by: Anders Eknert <anders@eknert.com>
2022-10-27 17:44:56 +02:00
Ashutosh Narkar 6c6494e42e internal/report: Include heap usage in the telemetry report
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2022-09-23 11:36:53 -07:00
Torin Sandall e34a10624d runtime: Fix logging configuration (#3959)
This commit updates the runtime to pass the logger to the plugin
manager and the reporter. In addition, the reporter is updated to pass
the logger into the rest client that it creates. With this change, we
no longer rely on the global logger and the logging configuration is
applied correctly.

To verify that this change is going to fix the problem, I have
searched for references to logrus and the logging package.

Grepping for references to logrus reveals that outside of the logging
package, we only refer to formatters and fields (never the global
logrus logger directly).

Grepping for references to logging.{New, Get, NewStandardLogger}
shows that we only create new loggers if one has not been injected
into the manager or rest client. Since we are passing/injecting the
logger from the runtime, I am fairly confident this will fix the
underlying issue.

Fixes #3958

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2021-11-03 21:54:32 +01:00
Will Beason 3be1d08b87 Change check-lint to use golangci-lint (#3465)
golint is deprecated. The author of the code no longer supports the
codebase. golangci-lint is faster than golint, and is in use by other
opa repositories (e.g. Gatekeeper).

This commit changes tools.go to reference golangci (so it ends up in
vendor) and modifies check-lint to use golangci instead.

Breaking API Changes:

- plugins/rest/rest.go: Fix typo "AllowInsureTLS" -> "AllowInsecureTLS"
- storage/errors.go: Removed unused IndexingNotSupportedErr

Signed-off-by: Will Beason <willbeason@google.com>
2021-05-19 07:52:02 +02:00
Patrick East 8ce7c8a76a report: Support build-time telemetry URL
We previously supported overriding via an environment variable, but
this meant for anyone who wanted to run their own telemetry endpoint
they would _always_ have to specify it while running their OPA's.

This change allows for someone to build OPA and encode the custom
url as the default. Ex:

```
make build TELEMETRY_URL=http://localhost:9876/custom/
```

Signed-off-by: Patrick East <east.patrick@gmail.com>
2020-07-22 11:07:17 -07:00
Ashutosh Narkar 458a61aa28 Add anonymous version reporting feature to OPA
This commit updates the OPA `run` and `version` commands to report the
version of the running OPA instance to an external service.

In case of the `opa run` command, this feature is ON by-default and
can be disabled using the --skip-version-check flag. In the server mode,
reports are sent periodically while in repl mode only once at start-up.

In case of the opa version command, this feature can be enabled by
specifying the --check or -c flag.

Reports are sent to the configurable external service
on a best-effort basis.

Fixes #1253

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2020-05-20 16:41:52 -07:00