Skip to content

Commit 4156333

Browse files
authored
feat(sms): add scm_run_id to scan-create interface (#306)
For SMS, we would like to be able to connect a particular Scan object to the SCM (source control manager) run_id that it is associated with. Details [here](https://www.notion.so/semgrep/SMS-Supportability-1273009241a880579e9ae90928391a0e?pvs=4#1313009241a880d79d77eb0d6773ad56). If we create the SCM run before the scan exists (desirable because there are actually many steps between us receiving a webhook and a Scan object getting created, leading to a significant time delay), then when we create the Scan, we need to know what the SCM run id is in order to connect it to the Scan and update it as the Scan progresses. This interface change allows us to pass the SCM run from the CLI to the backend. Changes in `semgrep` to follow this PR will actually set this value based on an environment variable and then send it to the app. - [x] I ran `make setup && make` to update the generated code after editing a `.atd` file (TODO: have a CI check) - [x] I made sure we're still backward compatible with old versions of the CLI. For example, the Semgrep backend need to still be able to *consume* data generated by Semgrep 1.17.0. See https://atd.readthedocs.io/en/latest/atdgen-tutorial.html#smooth-protocol-upgrades
1 parent 2d5264d commit 4156333

7 files changed

+67
-4
lines changed

semgrep_output_v1.atd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,9 @@ type scan_metadata = {
14221422
unique_id: uuid; (* client generated uuid for the scan *)
14231423
requested_products: product list;
14241424
~dry_run: bool; (* from 1.47.0 *)
1425+
(* since 1.96.0 *)
1426+
(* unique id associated with the scan run in the source control manager (e.g. github or gitlab) *)
1427+
?scm_run_id: string option;
14251428
}
14261429

14271430
(* Sent by the CLI to the POST /api/cli/scans to create a scan. *)

semgrep_output_v1.jsonschema

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.proto

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.py

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.ts

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1_j.ml

Lines changed: 51 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1_j.mli

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)