Skip to content

Commit 66f4183

Browse files
authored
Improve dependency updating process documentation (#49)
1 parent f69e3ab commit 66f4183

File tree

4 files changed

+55
-23
lines changed

4 files changed

+55
-23
lines changed

.github/DEPENDENCIES.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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`.

.github/workflows/dependabot_hack.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
# See ../DEPENDENCIES.md#workaround-for-other-dependencies
23
name: Dependabot hack
34
on: # yamllint disable-line rule:truthy
45
push:

CONTRIBUTING.md

+1-23
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,8 @@ The [tests](.github/workflows/tests.yml) are [end-to-end black box tests](http:/
2424

2525
There is no need for a separate language for the tests - as we are running the actual GitHub Action we are able to use the [GitHub Action workflow syntax](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions), which gives us what we need (e.g. [expressions](https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#about-contexts-and-expressions)) to write clean tests.
2626

27-
2827
## Updating dependencies
2928

30-
We use [GitHub Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-dependencies-updated-automatically)
31-
([bought by GitHub in 2019](https://dependabot.com/blog/hello-github/) and now
32-
[baked into GitHub](https://github.blog/2020-06-01-keep-all-your-packages-up-to-date-with-dependabot/))
33-
to manage our dependencies.
34-
35-
Whenever possible, we let Dependabot update our dependencies automatically (by
36-
[automatically creating a PR](https://docs.github.com/en/github/administering-a-repository/managing-pull-requests-for-dependency-updates#about-github-dependabot-pull-requests)
37-
for us to merge).
38-
39-
Dependabot will
40-
[automatically update non-Docker dependencies in our GitHub Actions](https://github.blog/2020-06-25-dependabot-now-updates-your-actions-workflows/).
41-
42-
For our other dependencies which cannot be updated automatically by Dependabot, we employ a bit of a hack.
43-
We have a [`dependabot_hack.yml`](.github/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
44-
[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
45-
whether the dependencies are valid GitHub Actions, it just parses the file and updates any versions that are
46-
managed through GitHub releases).
47-
48-
We could in theory automate this entirely (by e.g. having a GitHub Action that is triggered by Dependabot PRs,
49-
which updates the version in the requisite files and then adds the change in a new commit to the Dependabot PR),
50-
but that would be overkill for now.
29+
See the [DEPENDENCIES.md](.github/DEPENDENCIES.md)
5130

52-
Eventually as Dependabot adds more features we may be able to remove this workaround.
5331

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,8 @@ The project is [open source](https://opensource.guide/how-to-contribute/) and al
141141
* [How to report a bug or suggest a new feature](CONTRIBUTING.md#how-to-report-a-bug-or-suggest-a-new-feature)
142142

143143
* [How to make a contribution](CONTRIBUTING.md#how-to-make-a-contribution)
144+
145+
146+
## Updating dependencies
147+
148+
See the [DEPENDENCIES.md](.github/DEPENDENCIES.md)

0 commit comments

Comments
 (0)