|
| 1 | +# Updating dependencies |
| 2 | + |
| 3 | +## Dependabot |
| 4 | + |
| 5 | +We use [GitHub Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-dependencies-updated-automatically) |
| 6 | +([bought by GitHub in 2019](https://dependabot.com/blog/hello-github/) and now |
| 7 | +[baked into GitHub](https://github.blog/2020-06-01-keep-all-your-packages-up-to-date-with-dependabot/)) |
| 8 | +to manage our dependencies. |
| 9 | + |
| 10 | +Whenever possible we let Dependabot update our dependencies automatically (by |
| 11 | +[automatically creating a PR](https://docs.github.com/en/github/administering-a-repository/managing-pull-requests-for-dependency-updates#about-github-dependabot-pull-requests) |
| 12 | +for us to merge). |
| 13 | + |
| 14 | +Dependabot will |
| 15 | +[automatically update non-Docker dependencies in our GitHub Actions](https://github.blog/2020-06-25-dependabot-now-updates-your-actions-workflows/). |
| 16 | + |
| 17 | +### Workaround for other dependencies |
| 18 | + |
| 19 | +For our other dependencies which cannot be updated automatically by Dependabot, we employ a bit of a hack. |
| 20 | +We have a [`dependabot_hack.yml`](workflows/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 |
| 21 | +[GitHub releases](https://docs.github.com/en/github/administering-a-repository/about-releases)** - we are not limited to just dependencies which are themselves GitHub Actions (this is because Dependabot doesn't care |
| 22 | +whether the dependencies are valid GitHub Actions, it just parses the file and updates any versions that are |
| 23 | +managed through GitHub releases). |
| 24 | + |
| 25 | +We could in theory automate this entirely (by e.g. having a GitHub Action that is triggered by Dependabot PRs, |
| 26 | +which updates the version in the requisite files and then adds the change in a new commit to the Dependabot PR), |
| 27 | +but that would be overkill for now. |
| 28 | + |
| 29 | +Eventually as Dependabot adds more features we may be able to remove this workaround. |
| 30 | + |
| 31 | + |
| 32 | +## Dockerfile dependencies |
| 33 | + |
| 34 | +We have [pinned the linux dependencies in the devcontainer Dockerfile](https://github.com/agilepathway/hoverfly-github-action/pull/46/files), but there is no mechanism to automatically update them, currently. It looks like [it's on Dependabot's roadmap](https://github.com/dependabot/dependabot-core/issues/2129#issuecomment-511552345), so we have reminders every 6 months to |
| 35 | +1. update the dependencies manually |
| 36 | +2. see if Dependabot now offer this functionality |
| 37 | + |
| 38 | +### Updating the Dockerfile dependencies manually |
| 39 | + |
| 40 | +1. Temporarily unpin the versions (i.e. remove `=<version>` from each package in the Dockerfile) |
| 41 | +2. Execute the Dockerfile (e.g. if it's a remote container Dockerfile build the remote container) |
| 42 | +3. Run `apt-cache policy <package>` for each package, to see the version installed |
| 43 | +4. Pin all the versions, replacing any old versions with new ones |
| 44 | + |
| 45 | + |
| 46 | +## Ubuntu version |
| 47 | + |
| 48 | +[Ubuntu releases annually in April](https://wiki.ubuntu.com/Releases). In 2020 the GitHub Actions team [supported the new version by mid June](https://github.com/actions/virtual-environments/issues/228#issuecomment-644065532), so we have an annual reminder for 1st July each year to see if we can upgrade. We can find out [here](https://docs.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources). When we do upgrade to the new version it involves e.g. for 2021, simply replacing every case of `ubuntu-20.04` with `ubuntu-21.04`. |
0 commit comments