Skip to content

Commit

Permalink
📝 add dev env instructions for beta v9
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeffrey committed Sep 14, 2023
1 parent 6524f54 commit c8fad30
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,38 @@ 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.

## Develop with beta v9
In v9 we introduced providers, which changes the development process a bit (and make it more lightweight and speedy!)

To test a provider locally:
- copy the resources json file `providers/TYPE/resources/TYPE.resources.json` to the `providers` top-level dir
- add the provider to `providers/builtin.go`
```
awsconf "go.mondoo.com/cnquery/providers/aws/config"

Check failure on line 62 in docs/development.md

View workflow job for this annotation

GitHub Actions / Run spell check

`awsconf` is not a recognized word. (unrecognized-spelling)
awsp "go.mondoo.com/cnquery/providers/aws/provider"

Check failure on line 63 in docs/development.md

View workflow job for this annotation

GitHub Actions / Run spell check

`awsp` is not a recognized word. (unrecognized-spelling)

//go:embed aws.resources.json
var awsInfo []byte

awsconf.Config.ID: {

Check failure on line 68 in docs/development.md

View workflow job for this annotation

GitHub Actions / Run spell check

`awsconf` is not a recognized word. (unrecognized-spelling)
Runtime: &RunningProvider{
Name: awsconf.Config.Name,

Check failure on line 70 in docs/development.md

View workflow job for this annotation

GitHub Actions / Run spell check

`awsconf` is not a recognized word. (unrecognized-spelling)
ID: awsconf.Config.ID,

Check failure on line 71 in docs/development.md

View workflow job for this annotation

GitHub Actions / Run spell check

`awsconf` is not a recognized word. (unrecognized-spelling)
Plugin: awsp.Init(),

Check failure on line 72 in docs/development.md

View workflow job for this annotation

GitHub Actions / Run spell check

`awsp` is not a recognized word. (unrecognized-spelling)
Schema: MustLoadSchema("aws", awsInfo),
isClosed: false,
},
Config: &awsconf.Config,

Check failure on line 76 in docs/development.md

View workflow job for this annotation

GitHub Actions / Run spell check

`awsconf` is not a recognized word. (unrecognized-spelling)
},
```

- note the local provider location in `go.mod`
`replace go.mondoo.com/cnquery/providers/aws => ./providers/aws`

- build the provider after making changes: `make providers/build/aws`
- 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
Expand Down

0 comments on commit c8fad30

Please sign in to comment.