From 818307f294f7efe1d2585daffe52b3ad6bde5062 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Wed, 30 Aug 2023 14:18:12 +0100 Subject: Test deployment init container in CI --- .github/workflows/test.yaml | 28 ++++++++++++++++++++++++++++ deployment.yaml | 1 + 2 files changed, 29 insertions(+) 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 -- cgit v1.2.3