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

Add bicep jsonrpc command to CLI for programmatic consumption #12397

Merged
merged 2 commits into from
Dec 1, 2023

Conversation

anthony-c-martin
Copy link
Member

@anthony-c-martin anthony-c-martin commented Nov 7, 2023

Adds a new cli group bicep jsonrpc to the Bicep CLI. Main goals:

  • Provide the ability for consumers to avoid cold startup costs when building many Bicep files in a loop (see notes below about performance)
  • Provide an API for other tools to use to with the CLI in a programmatic fashion (similar to the goals of git's --porcelain flag: https://stackoverflow.com/a/6978402)
  • Opens up a future possibility for "wrapper" libraries to expose Bicep functionality with minimal logic (e.g. an NPM library - see here for an example)

Closes #11875.

Tested running compilation over 225 .bicep files in the quickstarts repo yields a >100x speed up:

  • Running bicep build in a bash loop: 585s
  • Using bicep jsonrpc to build the same files and avoid startup costs: 5s
Microsoft Reviewers: Open in CodeFlow

Copy link
Contributor

github-actions bot commented Nov 7, 2023

Test this change out locally with the following install scripts (Action run 7063479311)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 7063479311
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 7063479311"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 7063479311
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 7063479311"

@anthony-c-martin anthony-c-martin marked this pull request as ready for review November 10, 2023 14:29
Copy link
Contributor

github-actions bot commented Nov 10, 2023

Test Results

     132 files  ±0       132 suites  ±0   4h 28m 37s ⏱️ + 7m 28s
10 860 tests ±0  10 860 ✔️ ±0  0 💤 ±0  0 ±0 
52 363 runs  ±0  52 363 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit e9f5225. ± Comparison against base commit 81b4a22.

♻️ This comment has been updated with latest results.

@anthony-c-martin anthony-c-martin force-pushed the ant/exp/jsonrpc branch 2 times, most recently from ae30183 to b6c0607 Compare November 30, 2023 17:15
Copy link
Member

@majastrz majastrz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@majastrz
Copy link
Member

majastrz commented Dec 1, 2023

This is really nice!

@anthony-c-martin anthony-c-martin changed the title POC: JSONRPC CLI command Add bicep jsonrpc command to CLI Dec 1, 2023
@anthony-c-martin anthony-c-martin changed the title Add bicep jsonrpc command to CLI Add bicep jsonrpc command to CLI for programmatic consumption Dec 1, 2023
@anthony-c-martin anthony-c-martin merged commit edf1324 into main Dec 1, 2023
47 checks passed
@anthony-c-martin anthony-c-martin deleted the ant/exp/jsonrpc branch December 1, 2023 17:59
@ahelland ahelland mentioned this pull request Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal - JSONRPC interface for Bicep CLI
2 participants