Skip to content

[FEATURE] Improve performance of Bicep expansion with json-rpc #3877

Description

@BernieWhite

Your suggestion

Currently PSRule wraps the Bicep CLI for expanding each Bicep module/ parameter file. For large repositories like AVM, this could take a lot of time for a full test and complex module dependencies.

A large contributor to this is the cold start of Bicep for each file.

To improve this let's add support for using the JSON-RPC that has been added to the CLI.

Intended behaviour:

  • If feature is enabled, and expansion of Bicep is enabled start the Bicep JSON-RPC server.
  • Any expansion requests are expanded by the JSON-RPC server.
  • JSON-RPC server is terminates after PSRule runs.

Initially this should be a feature flagged code path that will opt-in to the new model (e.g. configuration AZURE_BICEP_JSON_RPC=true) disabled by default, which will be flipped in a future release.

Considerations

  • If the, an older version of the Bicep CLI is used that doesn't support the minimum version or JSON-RPC, error but revert to the old expansion method.
  • The minimum supported version for JSON-RPC should be hard coded and will be bumped when the minimum contract changes.

Alternatives

n/a

Additional context

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions