We use GitHub Dependabot (bought by GitHub in 2019 and now baked into GitHub) to manage our dependencies.
Whenever possible we let Dependabot update our dependencies automatically (by automatically creating a PR for us to merge).
Dependabot automatically updates our:
Dependabot updates our dependencies and modifies go.mod
and go.sum
accordingly.
It does not remove any now-obsolete entries from go.sum
, though.
So we have to clean up go.sum
by doing the following:
- check out the branch created by Dependabot, locally
- run
go mod tidy
- commit and push the updated
go.sum
to the same Dependabot branch - review and merge the PR
For our other dependencies which cannot be updated automatically by Dependabot, we employ a bit of a hack.
We have a dependabot_hack.yml
GitHub Action which triggers a Dependabot PR when these other dependencies have a new version to update to. This GitHub Action is set to never actually run; it exists just so that Dependabot can do its thing. The dependabot_hack.yml
documents where in our codebase that we then need to update to the new version manually (we then add this manual update as another commit to the PR that Dependabot creates). NB we are able to use this hack to manage any dependency that uses
GitHub releases - we are not limited to just dependencies which are themselves GitHub Actions (this is because Dependabot doesn't care
whether the dependencies are valid GitHub Actions, it just parses the file and updates any versions that are
managed through GitHub releases).
We could in theory automate this entirely (by e.g. having a GitHub Action that is triggered by Dependabot PRs, which updates the version in the requisite files and then adds the change in a new commit to the Dependabot PR), but that would be overkill for now.
Eventually as Dependabot adds more features we may be able to remove this workaround.
We have pinned the linux dependencies in the devcontainer Dockerfile, but there is no mechanism to automatically update them, currently. It looks like it's on Dependabot's roadmap, so we have an issue automatically created every 6 months to
- update the dependencies manually
- see if Dependabot now offer this functionality
- Temporarily unpin the versions (i.e. remove
=<version>
from each package in the Dockerfile) - Execute the Dockerfile (e.g. if it's a remote container Dockerfile build the remote container)
- Run
apt-cache policy <package>
for each package, to see the version installed - Pin all the versions, replacing any old versions with new ones
GitHub Actions supports Ubuntu LTS versions only. Ubuntu releases a new LTS version every second year in April. In 2020 the GitHub Actions team supported the new version by mid- June, so the owner of the repo has a reminder in their calendar every 2 years (on 15 July as that should have given GitHub sufficient time to update to the new LTS version) to update the GitHub Actions on this repo with the new version.