Problem/Motivation
At the moment, the process for keeping JavaScript dependencies up to date is informal and dependent on individual contributors ensuring that updates have been applied on time. Ideally we would have processes in place for getting notified of security vulnerabilities in the dependency tree, and a step to make sure that dependencies get updated prior to every release to make (patch, minor and major). This would make sure that if an individual contributor is not available, the team would still be responsible for ensuring that updates have been applied on time.
For context, the total dependency tree at the moment is over 3000 packages meaning that updates are happening at a high frequency. Preparing to a new release should likely include multiple check points where lates updates get applied.

Proposed resolution
There are 2 topics, security warnings and automated dependency MR creation.
Security monitoring
This is fairly easy, a simple gitlabci file such as https://git.drupalcode.org/project/drupal_core_gitlabci_test/-/blob/10.0... will monitor the (JS & PHP) dependencies for security updates and integrates with the gitlab UI : https://git.drupalcode.org/project/drupal_core_gitlabci_test/-/security/.... We can schedule a daily scan for this and I'm sure there are gitlab settings for sending emails or such when a new issues is picked up.
Automated update MR
The principle for the various tools that exist is to make one PR for each package update. The only groupings that would make sense for us are doing all CKEditor 5 packages updates (execpt the @ckeditor/ckeditor5-dev-utils) in the same MR and @bable/core and @babel/preset-env in the same MR since they're released in sync. All other dependencies should have their own MR.
Detect updates
First step is to detect packages updates, this can be done by dependabot or renovate.
- For an exemple of what renovate does on github see: renovate update for glob: https://github.com/theodoreb/drupal/pull/8 notice the links for the changelogs.
- For dependabot see https://github.com/theodoreb/drupal/pull/6 they also have a compatibility score for some updates that can tell us if the update usually breaks other repo using that dependency.
This should be run on all supported branches. One package update in 3 branches would create 3 different merge requests.
Prepare the MR
Once we know what there is to update we need to
- create a d.o issue (template TBD)
- add all relevant core committers as followers of the issue
- create the issue fork
- create a new branch
dep-update-XXX(with XXX the name of the dependency to update) - commit the result of dependabot/renovate to this branch
Update Drupal code
- create a new branch
git checkout -b dep-update-drupal-XXX dep-update-XXX - run
yarn - run
yarn build - Depending on the updated package(s) run different commands:
- if package is used in vendor-update run
yarn vendor-update - if package is part of CKEditor 5 run
yarn run build:ckeditor5-types(yarn build:ckeditor5is already run byyarn buildabove - if package is cspell run
yarn spellcheck:make-drupal-dict
- if package is used in vendor-update run
- commit the code to the branch
- create the merge request against the appropriate core branch
- set the issue as Need Review so that testbot is run against the new code (triggering the various linting scripts and build checks)
CKEditor 5 changes review
When the update package is CKEditor 5 or webpack* in the dep-update-cke5 branch run the following commands:
-
- create a new (
ckeditor5-build) branch from the core branch - run
yarn - run
yarn build:ckeditor5-dev - commit the result
- create a new (
-
- create a new branch using the updated deps
git checkout -b review-ckeditor5-build dep-update-XXX - run
yarn - run
yarn build:ckeditor5-dev - commit the result
- create a new branch using the updated deps
- Create a DRAFT merge request from
review-ckeditor5-buildtockeditor5-buildto review the unminified changes (so that CI doesn't run for this MR)
The various steps involves creating 4 branches max:
dep-update-XXXdep-update-drupal-XXXckeditor5-buildreview-ckeditor5-build
And 2 merge requests:
- from
dep-update-drupal-XXXto core branch (the MR to commit) - a DRAFT MR from
review-ckeditor5-buildtockeditor5-buildfor review
Remaining tasks
Agree on the proposal
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| node-modules-meme.jpeg | 47.51 KB | lauriii |
Issue fork drupal-3280275
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
nod_We could try to have a bot open merge requests automatically on all supported branches to update the minor/patch version automatically. That would trigger CI and tests without human intervention
Comment #3
xjmIt'd be a bit more complicated than essentially "Dependabot for GitLab" because we'd have to run all our build steps afterward, but we still could add a lot of automation that would make things easier. The CI to generate the MR would:
rm -rf node_modules; yarn install; yarn upgrade; yarn vendor-update; yarn build; yarn lint:css; yarn lint:core-js-passingyarn spellcheck:make-drupal-dictyarn run build:ckeditor5; yarn run build:ckeditor5-type. (Do we need this step, or is only necessary when updating CKE5 itself?)node/3060/qa. Maybe all three.yarn-lock-diffof the updated branch against HEAD, and highlight major and minor updates that are happening for the reviewer to look over.Then the reviewer just has to look over the changes to the built assets, figure out why they are happening, and verify that they are good changes for the branch in question (not breaking changes or supply chain attacks or anything else).
Automating all that would save a ton of time because it takes like 15+ min on my machine when the cspell dictionary gets rebuilt, and that for five branches plus the basic mechanics of patch creation and upload leads to two solid hours just to post the results of automated tools.
Comment #4
nod_to get notified of security issues we can rely on gitlabci as in : https://git.drupalcode.org/project/drupal_core_gitlabci_test/-/security/...
Comment #5
nod_updated IS with proposed steps
Comment #6
nod_Comment #7
nod_I'm not sure we need yarn-lock-diff in that situation. The principle of the various auto-updates bots are to make one MR for each package updated and they include the version changes in the MR summary (as well as the changelogs) see the examples MR in the issue summary.
Comment #8
nod_Comment #9
xjmThanks @nod_ for your work on this!
https://git.drupalcode.org/project/drupal_core_gitlabci_test/-/security/vulnerability_reportis 404 for me. This is presumably due to one of:yarn auditis clean locally atm), orThe proposal looks pretty solid to me. One additional feature I'd request under the "Prepare the MR" section is email notifications beyond what following the issue provides. I don't subscribe to emails for issues I follow nor necessarily find them meaningfully in my tracker; as a committer I comment on too many issues for this to work for me (even though I've tried to develop a habit of habitually unfollowing things). I assume the DA could hook us up with an email subscription option somehow as part of the process.
Everything else makes perfect sense as outlined.
I have no strong opinions on dependabot vs. renovate; I'm familiar with dependabot notifications on GH projects but renovate does look pretty nice.
Comment #10
bnjmnmThis overall gets a happy +1 from me. These type of issues get tedious, probably because the majority of the work is literally something a machine could do... so I'm pleased to see a machine doing it.
A few thoughts
Comment #11
lauriiiGreat proposal @nod_! 👏
My main concern is with how we make sure someone takes an action on the issue when update has happened. So far, most of the work has been coordinated by a human pinging people directly for a review. If we are moving that to CI, there needs to be some automation in the sense that some folks get notified that their attention is needed. Getting an email from issue being updated is a good start but maybe we might have to figure out if we could do something like assigning the issue automatically to a person for review and sending them a special email to notify them.
From a technical perspective I'm a bit concerned if we can associate the PR's with a Drupal.org issue. I think that would be something worth testing before putting too much effort to this.
Comment #12
nod_I don't expect renovate/dependabot to create the MR used later in the d.o issue.
We're going a bit much into the implementation part of things but what I had in mind was that we run them periodically "somewhere" and when there are things to update we take the diff from the commit and/or the MR description and commit those to the d.o issue fork. We can create a dummy project on gitlab that's a mirror of core repo. That project is only used to run the bots and there they'll have permission to create branches and MR.
We can set up webhooks to monitor new MR created on that project and trigger the creation of the d.o issue when a new one is created. It'll be a matter of getting the diff and MR description to copy in the d.o issue fork.
Comment #13
nod_A topic still to be defined:
When a dependency release a new version when the previous version is still not committed, what happens? do we update the existing issue/mr, close and create a new one, or something else? (That would be the case if a dependency release a version then the next day releases another for some reason).
Comment #14
hestenetPer DA Staff and core discussion:
However, we are not close to fully support Core GitLabCI yet and there are several potential challenges:
There are some more limited scope considerations:
Comment #15
bbralaJust gonna pitch in here, since i was directed here by @nod_ when posting that we should just run renovate on Gitlab for core.
Seems like automating at least getting new dependencies in is a great QOL improvement. Having updated dependencies ready and tested automatically is a great way to make life easier. We do this (and more) in our company also, feels great to only need to merge to update.
Regarding the open issue in #13.
I'd say that an task like this should only have one MR open. I'd also prefer to have it update the same MR, since that will also generate possible history. Perhaps a few versions have been skipped since last update and something broke along the way, that is information you'd want to have when evaluating a MR like that.
Comment #16
bbralaRegarding #12. Think Gitlab is pretty stable by now because the work of the infra team.
Comment #17
xjm@bbrala, there are still lots of outstanding things for the GitLab migration. :)
Comment #18
smustgrave commentedThis seems more like a plan.
Comment #20
xjmAmending attribution.
Comment #22
smustgrave commentedDoes this related to our new dependency coordinator role #3563613: Define core gate for 'dependency coordination' topic ?