aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2023-08-30 14:18:12 +0100
committerGravatar Chris Lovering <[email protected]>2023-08-30 14:18:12 +0100
commit818307f294f7efe1d2585daffe52b3ad6bde5062 (patch)
tree4f2ede702166f39f85102d3885f6720883704b3b
parentMerge pull request #113 from python-discord/jb3/shared-mem (diff)
Test deployment init container in CI
-rw-r--r--.github/workflows/test.yaml28
-rw-r--r--deployment.yaml1
2 files changed, 29 insertions, 0 deletions
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index acbfd1f..473b8a7 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -93,3 +93,31 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage.lcov
+
+ dry-run-deploy:
+ name: Dry run deployment.yaml init container
+ runs-on: ubuntu-latest
+ needs: test
+ steps:
+ - name: Download image artifact
+ uses: actions/download-artifact@v3
+ with:
+ name: ${{ inputs.artifact }}
+
+ - name: Load image from archive
+ run: docker load -i ${{ inputs.artifact }}.tar
+
+ # Needed for the Docker Compose file.
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ # Install eval deps the same way as init container from deployment.yaml
+ # This is to ensure that deployment won't fail at that step
+ - 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 \;
diff --git a/deployment.yaml b/deployment.yaml
index 3ce8d00..6f188c9 100644
--- a/deployment.yaml
+++ b/deployment.yaml
@@ -13,6 +13,7 @@ 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