diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 43e83dbd1a..b25d584152 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -5,6 +5,8 @@ asns Auths autoaccept autoscaler +awsconf +awsp backupconfiguration bigquery BLOCKLIST diff --git a/docs/development.md b/docs/development.md index c33f23d0f6..4d91ec0c7a 100644 --- a/docs/development.md +++ b/docs/development.md @@ -6,18 +6,18 @@ Before building from source, be sure to install: -- [Go 1.20.0+](https://golang.org/dl/) +- [Go 1.21.0+](https://golang.org/dl/) - [Protocol Buffers v21+](https://github.com/protocolbuffers/protobuf/releases) -On macOS systems with Homebrew, run: `brew install go@1.19 protobuf` +On macOS systems with Homebrew, run: `brew install go@1.21 protobuf` ## Install from source -1. Verify that you have Go 1.19+ installed: +1. Verify that you have Go 1.21+ installed: - ``` - $ go version - ``` + ``` + $ go version + ``` If `go` is not installed or an older version exists, follow instructions on [the Go website](https://golang.org/doc/install). @@ -28,13 +28,15 @@ If `go` is not installed or an older version exists, follow instructions on [the $ cd cnquery ``` -3. Build and install: +3. Build and install on Unix-like systems + + ```sh + # Build all providers + make providers - #### Unix-like systems - ```sh - # To install cnquery using Go into the $GOBIN directory: - make cnquery/install - ``` + # To install cnquery using Go into the $GOBIN directory: + make cnquery/install + ``` ## Develop cnquery, providers, or resources @@ -52,6 +54,41 @@ make cnquery/generate This generates and updates all required files for the build. At this point you can `make cnquery/install` again as outlined above. +## Debug providers + +In v9 we introduced providers, which split up the providers into individual go modules. This make it more development more lightweight and speedy. + +To debug a provider locally with cnquery: + +1. Copy the resources json file `providers/TYPE/resources/TYPE.resources.json` to the `providers` top-level dir +2. Add the provider to `providers/builtin.go` + + ``` + awsconf "go.mondoo.com/cnquery/providers/aws/config" + awsp "go.mondoo.com/cnquery/providers/aws/provider" + + //go:embed aws.resources.json + var awsInfo []byte + + awsconf.Config.ID: { + Runtime: &RunningProvider{ + Name: awsconf.Config.Name, + ID: awsconf.Config.ID, + Plugin: awsp.Init(), + Schema: MustLoadSchema("aws", awsInfo), + isClosed: false, + }, + Config: &awsconf.Config, + }, + ``` + +3. Change the local provider location in `go.mod` + + `replace go.mondoo.com/cnquery/providers/aws => ./providers/aws` + +4. Build the provider after making changes: `make providers/build/aws` +5. Run cnquery like you normally do (`go run apps/cnquery/cnquery.go shell aws`). You should see it note that it is "using builtin provider for X" + ## Contribute changes ### Mark PRs with emojis @@ -60,5 +97,4 @@ We love emojis in our commits. These are their meanings: ๐Ÿ›‘ breaking ๐Ÿ› bugfix ๐Ÿงน cleanup/internals โšก speed ๐Ÿ“„ docs โœจโญ๐ŸŒŸ๐ŸŒ  smaller or larger features ๐ŸŽ race condition -๐ŸŒ™ MQL ๐ŸŒˆ visual ๐ŸŸข fix tests ๐ŸŽซ auth ๐Ÿฆ… falcon ๐Ÿณ container - +๐ŸŒ™ MQL ๐ŸŒˆ visual ๐ŸŸข fix tests ๐ŸŽซ auth ๐Ÿฆ… falcon ๐Ÿณ container diff --git a/providers-sdk/v1/inventory/inventory.pb.go b/providers-sdk/v1/inventory/inventory.pb.go index a8031c35a6..38e346f9a1 100644 --- a/providers-sdk/v1/inventory/inventory.pb.go +++ b/providers-sdk/v1/inventory/inventory.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.12 +// protoc-gen-go v1.31.0 +// protoc v4.24.3 // source: inventory.proto package inventory diff --git a/providers-sdk/v1/inventory/inventory.proto b/providers-sdk/v1/inventory/inventory.proto index 1025ebf1be..3ee81684d9 100644 --- a/providers-sdk/v1/inventory/inventory.proto +++ b/providers-sdk/v1/inventory/inventory.proto @@ -248,7 +248,7 @@ message OwnerReference { string uid = 4; } -// Invetory declares the all assets and their credentials +// Inventory declares the all assets and their credentials message Inventory { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata