Skip to content

Commit 1ec0548

Browse files
committed
ci: add workflow to refreeze image deps
1 parent 01450ce commit 1ec0548

File tree

3 files changed

+48
-30
lines changed

3 files changed

+48
-30
lines changed

.github/workflows/watch-dependencies.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,35 @@ jobs:
8787
body: >-
8888
A new ${{ matrix.repository }} image version has been detected, version
8989
`${{ steps.latest.outputs.tag }}`.
90+
91+
refreeze-dockerfile-requirements-txt:
92+
# Don't run this job on forks, but also not on the daily schedule to reduce
93+
# noise. If we could run this weekly that would be reasonable, but updating
94+
# these dependencies every day is too much noise.
95+
#
96+
if: github.repository == 'jupyterhub/binderhub' && github.event_name != 'schedule'
97+
runs-on: ubuntu-latest
98+
99+
steps:
100+
- uses: actions/checkout@v3
101+
102+
- name: Refreeze helm-chart/images/binderhub/requirements.txt based on requirements.in
103+
run: ci/refreeze
104+
105+
- name: git diff
106+
run: git --no-pager diff --color=always
107+
108+
# ref: https://github.com/peter-evans/create-pull-request
109+
- name: Create a PR
110+
uses: peter-evans/create-pull-request@v4
111+
with:
112+
token: "${{ secrets.jupyterhub_bot_pat }}"
113+
author: JupyterHub Bot Account <[email protected]>
114+
committer: JupyterHub Bot Account <[email protected]>
115+
branch: update-image-requirements
116+
labels: dependencies
117+
commit-message: "binderhub image: refreeze requirements.txt"
118+
title: "binderhub image: refreeze requirements.txt"
119+
body: >-
120+
The binderhub image's requirements.txt has been refrozen based on
121+
requirements.in.

ci/refreeze

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
set -xeuo pipefail
3+
4+
# Because `pip-compile` resolves `requirements.txt` with the current
5+
# Python for the current platform, it should be run on the same Python
6+
# version and platform as our Dockerfile.
7+
8+
docker run --rm \
9+
--env=CUSTOM_COMPILE_COMMAND='Use the "Run workflow" button at https://github.com/jupyterhub/binderhub/actions/workflows/watch-dependencies.yaml' \
10+
--volume="$PWD:/io" \
11+
--workdir=/io \
12+
--user=root \
13+
python:3.9-bullseye \
14+
sh -c 'pip install pip-tools==6.* && pip-compile --upgrade helm-chart/images/binderhub/requirements.in'

helm-chart/images/binderhub/README.md

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,5 @@ Built with [chartpress][].
77

88
## Updating requirements.txt
99

10-
Dependencies are specified in `requirements.in` and `requirements.txt`,
11-
which are managed by [`pip-compile`][].
12-
13-
[pip-compile]: https://pip-tools.readthedocs.io
14-
15-
`requirements.in` contains our loosely specified direct requirements.
16-
This is the file we edit to change what should be in the image.
17-
18-
`requirements.txt` is the fully pinned exact set of packages and versions.
19-
This file is generated by `pip-compile` and should not be edited.
20-
21-
Because `pip-compile` resolves `requirements.txt` with the current Python for the current platform,
22-
it must be run on the same Python version and platform as our Dockerfile.
23-
This can be done from anywhere, by running `pip-compile` in docker from the top-level of the binderhub repo:
24-
25-
```shell
26-
docker run --rm \
27-
--env=CUSTOM_COMPILE_COMMAND="see README.md" \
28-
--volume=$PWD:/io \
29-
--workdir=/io/helm-chart/images/binderhub \
30-
--user=root \
31-
python:3.9-slim-bullseye \
32-
sh -c 'pip install pip-tools==6.* && pip-compile --upgrade'
33-
```
34-
35-
or you can just run `CUSTOM_COMPILE_COMMAND="see README.md" pip-compile --upgrade` if you are already using Python 3.9 on linux.
36-
37-
See the [pip-compile docs][updating] for options to control the upgrading of packages.
38-
39-
[updating]: https://pip-tools.readthedocs.io/en/latest/#updating-requirements
10+
Use the "Run workflow" button at
11+
https://github.com/jupyterhub/binderhub/actions/workflows/watch-dependencies.yaml.

0 commit comments

Comments
 (0)