Skip to content

Commit

Permalink
Make CI and deployment.yaml share the same dependency install script (#…
Browse files Browse the repository at this point in the history
…190)

* Make CI and deployment.yaml share the same dependency install script

* squashme: add set -euo pipefail as sane defaults

This also requires running under bash rather than sh

* squashme: add make target for installing eval deps
  • Loading branch information
ChrisLovering authored Aug 31, 2023
1 parent 25b84f4 commit 7303301
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,4 @@ jobs:
- name: Install eval deps
run: |
export IMAGE_SUFFIX='-venv:${{ inputs.version }}'
export PYTHONUSERBASE=/snekbox/user_base
docker compose run \
--rm -T --entrypoint /bin/sh snekbox -c \
find /lang/python -mindepth 1 -maxdepth 1 -type d -exec \
{}/bin/python -m pip install --user -U -r requirements/eval-deps.pip \;
docker compose run --rm -T --entrypoint /bin/bash snekbox scripts/install_eval_deps.sh
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ build:
.PHONY: devsh
devsh:
docker compose run --entrypoint /bin/bash --rm snekbox

.PHONY: eval-deps
eval-deps:
docker compose run --rm -T --entrypoint /bin/bash snekbox scripts/install_eval_deps.sh
11 changes: 2 additions & 9 deletions deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,15 @@ spec:
app: snekbox
spec:
initContainers:
# Ensure "dry-run-deploy" job of test.yaml is updated with any changes to this init container
- name: deps-install
image: ghcr.io/python-discord/snekbox:latest
imagePullPolicy: Always
volumeMounts:
- name: snekbox-user-base-volume
mountPath: /snekbox/user_base
env:
- name: PYTHONUSERBASE
value: /snekbox/user_base
command:
- "/bin/sh"
- "-c"
- >-
find /lang/python -mindepth 1 -maxdepth 1 -type d -exec
{}/bin/python -m pip install --user -U -r requirements/eval-deps.pip \;
- /bin/bash
- scripts/install_eval_deps.sh
containers:
- name: snekbox
image: ghcr.io/python-discord/snekbox:latest
Expand Down
5 changes: 5 additions & 0 deletions scripts/install_eval_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set -euo pipefail

export PYTHONUSERBASE=/snekbox/user_base
find /lang/python -mindepth 1 -maxdepth 1 -type d -exec \
{}/bin/python -m pip install --user -U -r requirements/eval-deps.pip \;

0 comments on commit 7303301

Please sign in to comment.