From c82fd5c44e0727a6cfd6a1fe2b586b507ddb923a Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Wed, 19 Jun 2024 12:16:36 -0700 Subject: [PATCH] feat(ci): Trigger security scanner from release pipeline (#63280) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves [REL-100](https://linear.app/sourcegraph/issue/REL-100/automate-posting-the-security-check-step) by calling the security scanner as part of the release pipeline, during the internal image creation time. @WillDollman kindly dropped me some notes on how to use this, notably in this PR I've removed `dryRun=true` given how this will only be run from the release process. I'm also using a `tag` with no `images` listed. I've added the token will sent me to 1Password under `image-scanner-webhook` and added a check to ensure it exists when being called. ### Will's Notes: ``` curl --location 'https://incoming.sgdev.org/new-image-scan?images=sourcegraph%2Fgitserver%2Csourcegraph%2Ffrontend&tag=5.3.0&scanType=release&dev=true&dryRun=true' \ --header 'X-Special-Header: ' ``` > it’s not quite set up for releases yet, but you can play around - results are sent to elastic which you don’t have access to, and there’s no api to get the results > to scan everything at a specific tag, remove the images parameter and set tag to the image tag > dryRun=true will ensure it doesn’t actually run a scan, but will still return a json response - best to leave that enabled while you’re working on it otherwise you’ll trigger lots of scans :stuck_out_tongue: ## Test plan Ran `sg release create --version=auto --pretend` to ensure the script still works ## Changelog - Added security scanner to the release pipeline --- release.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/release.yaml b/release.yaml index 83d0cb8f299..83c3f29af66 100644 --- a/release.yaml +++ b/release.yaml @@ -73,6 +73,9 @@ internal: echo "Release created, see:" echo $body fi + - name: 'Trigger Security scan' + cmd: | + curl --location 'https://incoming.sgdev.org/new-image-scan?tag={{tag}}&scanType=release&dev=true' --header 'X-Special-Header: ${SCANNER_TOKEN}' - name: 'notifications' cmd: | set -eu