4 Commits

Author SHA1 Message Date
Anders Eknert 30d3346fb4 New custom SemVer implementation (#8010)
This was something I originally intended to use in another project,
but since this turned out to be a better implementation (subject of
course to review!) in terms of both performance and simplicity, I
figured we might as well use it here too. Some changes include:

- `MustParse` to parse known valid versions
- Allocates nothing in any operations other than 1 alloc in `String()`
- Ignores empty `PreRelease` and `Metadata` fields in serialization
- `encoding.TextAppender` implementation to serialize without allocating
- A whole bunch of benchmarks

Signed-off-by: Anders Eknert <anders@eknert.com>
2025-11-04 09:09:50 +01:00
Johan Fylling e6865c4c9f Prepare v1.10.0 release (#8002)
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2025-10-31 14:15:30 +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
Charlie Egan 8d321f0856 Add semver.compare & is_valid built-ins
These built-ins will allow policies to more easily make comparisons on
semantic version strings.

I am doing this because I recently needed to write policy concerning
versions of installed software in Kubernetes environments.

I feel this is a better solution than implementing such a feature in
Rego: https://gist.github.com/charlieegan3/76dbec05c65164ac98dfec74b1381c5a

is_valid is to allow users to gate access to the compare function which
fails if the input is not a valid version string.

The semver functionality is vendored from the coreos package based on
the discussion here:
https://github.com/open-policy-agent/opa/pull/2538#pullrequestreview-448422711

Signed-off-by: Charlie Egan <charlieegan3@users.noreply.github.com>
2020-07-15 16:06:14 -07:00