Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect and Process Policy Files into SemConv Registry + Generic Diagnostic Reporting #153

Merged
merged 20 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1ba992c
feat(checker): Detect policy files into semconv registry
lquerel May 9, 2024
f7ebacb
chore(diagnostic): Render diagnostics from Jinja templates.
lquerel May 14, 2024
acae8bd
chore(diagnostic): Render diagnostics from Jinja templates into gh_wo…
lquerel May 14, 2024
4cae210
chore(diagnostic): Fix build issues.
lquerel May 15, 2024
c02adc1
chore(forge): Improve test coverage
lquerel May 15, 2024
ba7dc9c
chore(common): Improve test coverage
lquerel May 15, 2024
a8a6333
chore(common): Improve test coverage
lquerel May 15, 2024
d0bfca7
chore(common): Implement --diagnostic-format
lquerel May 15, 2024
50f0933
chore(diag): Unify diagnostic message processing and rendering.
lquerel May 16, 2024
54e3f6a
Merge branch 'main' into policy-engine-ext
lquerel May 16, 2024
eb399fd
chore: Merge with main
lquerel May 16, 2024
790c879
chore(cli): Unify parameters across sub-commands
lquerel May 16, 2024
0f66337
chore(cli): Add test infrastructure for the command line
lquerel May 17, 2024
5b5b525
feat(CLI): Support --diagnostic-format and --diagnostic-templates on …
lquerel May 17, 2024
e3b609e
chore: Clean-up before to submit the PR
lquerel May 17, 2024
fdc4c0d
Merge branch 'main' into policy-engine-ext
lquerel May 17, 2024
ae7eb93
chore: Clean-up before to merge the PR
lquerel May 20, 2024
5b064f2
chore: Replace many map_err by a From<fmt::Error> for Error.
lquerel May 20, 2024
d2343a3
chore: Update weaver_checker README.md to introduce PolicyStage
lquerel May 20, 2024
1bb4931
Merge branch 'main' into policy-engine-ext
lquerel May 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 99 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ ordered-float = { version = "4.2.0", features = ["serde"] }
walkdir = "2.5.0"
anyhow = "1.0.83"
itertools = "0.12.1"
globset = { version = "0.4.14", features = ["serde1"] }
miette = { version = "7.2.0", features = ["fancy", "serde"] }

# Features definition =========================================================
[features]
Expand Down Expand Up @@ -67,8 +69,12 @@ serde.workspace = true
serde_yaml.workspace = true
serde_json.workspace = true
walkdir.workspace = true

rayon = "1.10.0"

[dev-dependencies]
assert_cmd = "2.0.14"

[profile.release]
lto = true
strip = true
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ COPY crates /build/crates
COPY data /build/data
COPY src /build/src
COPY tests build/tests
COPY diagnostic_templates /build/diagnostic_templates
# Don't build release, so we get template debugging output.
RUN cargo build

Expand Down
1 change: 1 addition & 0 deletions crates/weaver_cache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ gix = { version = "0.62.0", default-features = false, features = [
] }

thiserror.workspace = true
serde.workspace = true

1 change: 1 addition & 0 deletions crates/weaver_cache/allowed-external-types.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
# This is used with cargo-check-external-types to reduce the surface area of downstream crates from
# the public API. Ideally this can have a few exceptions as possible.
allowed_external_types = [
"serde::ser::Serialize",
]
3 changes: 2 additions & 1 deletion crates/weaver_cache/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ use gix::clone::PrepareFetch;
use gix::create::Kind;
use gix::remote::fetch::Shallow;
use gix::{create, open, progress};
use serde::Serialize;
use tempdir::TempDir;

/// An error that can occur while creating or using a cache.
#[derive(thiserror::Error, Debug)]
#[derive(thiserror::Error, Debug, Serialize)]
#[non_exhaustive]
pub enum Error {
/// Home directory not found.
Expand Down
3 changes: 3 additions & 0 deletions crates/weaver_checker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ thiserror.workspace = true
serde.workspace = true
serde_json.workspace = true
serde_yaml.workspace = true
walkdir.workspace = true
globset.workspace = true
miette.workspace = true

regorus = { version = "0.1.5", default-features = false, features = [
"arc",
Expand Down
3 changes: 2 additions & 1 deletion crates/weaver_checker/allowed-external-types.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
allowed_external_types = [
"serde::ser::Serialize",
"serde::de::Deserialize",
"weaver_common::error::WeaverError"
"weaver_common::error::WeaverError",
"miette::protocol::Diagnostic",
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package otel
package before_resolution

# Conventions for OTel:
# - `data` holds the current released semconv, which is known to be valid.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is not a rego file (use for test purposes only).
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is another invalid rego file! (use for test purposes only)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package otel
package before_resolution

# Conventions for OTel:
# - `data` holds the current released semconv, which is known to be valid.
Expand Down
2 changes: 1 addition & 1 deletion crates/weaver_checker/data/policies/otel_policies.rego
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package otel
package before_resolution

# Conventions for OTel:
# - `data` holds the current released semconv, which is known to be valid.
Expand Down
Loading
Loading