Draft: Configure renovate to replace sast bot
What does this MR do?
As part of Replace sast-analyzer-deps-bot with renovate (gitlab-org/gitlab#557439), we are deprecating SASTBot in favor of Renovate for managing SAST analyzer dependencies.
This MR updates Semgrep with scripts required for Renovate.
Todo
-
Once CI Template MR is merged, update ref to main
Overview of changes
This work spans several repos:
-
Changelog Parser (MR1, MR2):
- Added an
update
command to inject{{MERGE_REQUEST_ID}}
placeholders intoCHANGELOG.md
- Added an
-
Renovate gitlab bot (MR):
- Added the Semgrep config to trigger dependency updates
- Defined
postUpgradeTasks
to rundownload-changelog-parser.sh
and theupdate
command
-
Semgrep (This MR):
- Added
download-changelog-parser.sh
to download thechangelog-parser
binary - Added the
update-changelog.yml
CI template
- Added
-
CI Templates (MR):
- Added
update-changelog.yml
containing theupdate changelog mrid
job - This job replaces
{{MERGE_REQUEST_ID}}
in the changelog with the actual MR ID
- Added
Renovate flow:
- In Renovate's pipeline's semgrep job
- Creates a branch (
renovate/all-dependencies)
in the gitlab-renovate-forks/semgrep and opens an MR against semgrep. - The
postUpgradeTask
will:- Download the
changelog-parser
binary withdownload-changelog-parser.sh
script - Run the
update
command to add dependency details and{{MERGE_REQUEST_ID}}
placeholders inCHANGELOG.md
- Download the
- Creates a branch (
- In gitlab-renovate-forks/semgrep pipeline
update changelog mrid
job- Replaces
{{MERGE_REQUEST_ID}}
with actual MR ID - This job runs in gitlab-renovate-forks/semgrep repo and makes a
merge request api
call to semgrep to retrieve the MR ID.
- Replaces
Verification
- Delete any existing
renovate/all-dependencies
branch in gitlab-renovate-forks/semgrep.- This will close any existing renovate MRs and allow us to simulate the full Renovate dependency update flow.
-
Rerun this job from the renovate-gitlab-bot MR where I've
- Disabled dry run to trigger a full renovate job
- Temporarily removed all other projects
- This creates the
renovate/all-dependencies
branch and an MR in semgrep- It initially adds
{{MERGE_REQUEST_ID}}
placeholders inCHANGELOG.md
- Once
update changelog mrid
runs successfully, the{{MERGE_REQUEST_ID}}
placeholders are replaced with the actual MR ID. - Currently 3 pipelines are triggered due to a workaround for forked MRs targeting non default branches.
- I've temporarily targeted the
smtan/configure-renovate
branch to validate this flow - Once we target the
main
branch, only a single pipeline will run (example CS MR)
- I've temporarily targeted the
- It initially adds
What are the relevant issue numbers?
Replace sast-analyzer-deps-bot with renovate (gitlab-org/gitlab#557439)
Does this MR meet the acceptance criteria?
-
Changelog entry added -
Documentation created/updated for GitLab EE, if necessary -
Documentation created/updated for this project, if necessary -
Documentation reviewed by technical writer or follow-up review issue created -
Tests updated/added for this feature/bug -
Job definition updated, if necessary -
Conforms to the code review guidelines -
Conforms to the Go guidelines -
Security reports checked/validated by reviewer
Edited by Shao Ming Tan