From 46e9e29bfe758291dedf6de98df286c76f4ec0e7 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Wed, 16 Oct 2024 23:10:33 -0700 Subject: [PATCH 1/4] chore(workflows): silence selenium-screenshot archiving error Whenever the `--exclude-tag selenium` tests had a failure the `upload-artifact` step for Selenium screenshots would also fail. It's a particular annoyance, because, on failure, Github automatically expands and presents the `tail` of the last-failed job. And, in the usual case, this would be `selenium-screenshots` not the underlying failure. --- .github/workflows/tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ca599724f5..e09fbd60e7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -97,14 +97,14 @@ jobs: docker exec -e SELENIUM_DEBUG=1 -e SELENIUM_TIMEOUT=30 cl-django python /opt/courtlistener/manage.py test cl --verbosity=2 ${{ matrix.tag_flags }} --parallel - - name: cp selenium results from docker to host + - name: Export selenium results from docker to host if: failure() run: | # This is annoying b/c docker cp doesn't support globs. See: # https://stackoverflow.com/q/35806102/ # https://github.com/moby/moby/issues/7710 mkdir selenium-screenshots - docker exec cl-django bash -c "mkdir /extract && mv /tmp/*-selenium.png /extract" + docker exec cl-django bash -c "mkdir /extract && mv /tmp/*-selenium.png /extract ||:" docker cp 'cl-django:/extract' selenium-screenshots/ - name: Save selenium screenshot as Github artifacts uses: actions/upload-artifact@master @@ -112,6 +112,7 @@ jobs: with: name: selenium-screenshots path: selenium-screenshots/extract + if-no-files-found: ignore # Cancel the current workflow (tests) for pull requests (head_ref) only. See: # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value From b385cde312c1c041b5c5cdeec740aacccd86da7b Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Wed, 16 Oct 2024 23:01:24 -0700 Subject: [PATCH 2/4] chore(workflows): drop `setup-python-dependencies` CodeQL workflow When running the CodeQL workflow, the `codeql-action/init` action lets us know that a parameter with no effect is being used: ``` Warning: The setup-python-dependencies input is deprecated and no longer has any effect. We recommend removing any references from your workflows. See https://github.blog/changelog/2024-01-23-codeql-2-16-python-dependency-installation-disabled-new-queries-and-bug-fixes/ for more information. ``` There is one other warning about `actions/upload-artifact` deprecation. This is a known issue (see github/codeql-action#2402). --- .github/workflows/codeql-analysis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2a56ab5a6f..976dffcf63 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,6 @@ jobs: with: languages: python config-file: ./.github/codeql-config.yml - setup-python-dependencies: true - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 From 2cae019fdbc205bc045ea67ee3341ec6cab121a3 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Wed, 16 Oct 2024 23:18:47 -0700 Subject: [PATCH 3/4] chore(build): drop inapplicable comment in Django Dockerfile The origin of the removed comment was 89a7e696 and concerned the the value of `CELERY_TASKS_DIR`: ``` ## Needs to be two commands so second one can use variables from first. ENV \ CELERY_TASKS_DIR=/opt/celery \ CELERY_USER_ID=33 ENV \ PYTHONPATH="${PYTHONPATH}:${CELERY_TASKS_DIR}" ``` `CELERY_TASKS_DIR` was removed in 1be09378; the comment is being carried around for no reason. --- docker/django/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/django/Dockerfile b/docker/django/Dockerfile index 5025150c5f..3461161a46 100644 --- a/docker/django/Dockerfile +++ b/docker/django/Dockerfile @@ -71,7 +71,6 @@ RUN mkdir /var/log/courtlistener \ WORKDIR /opt/courtlistener -## Needs to be two commands so second one can use variables from first. ENV PYTHONPATH="${PYTHONPATH}:/opt/courtlistener" USER root From 9737692a154b09bf500cd9495acd5e697686f7db Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Wed, 16 Oct 2024 22:49:18 -0700 Subject: [PATCH 4/4] chore(build): Address warnings in the docker/django/Dockerfile release, the action began reporting build configuration warnings. Neato! It highlights three issues, each addressed in this patch. ``` 3 warnings found (use docker --debug to expand): - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 1) - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 44) - UndefinedVar: Usage of undefined variable '$PYTHONPATH' (line 75) ``` --- docker/django/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/django/Dockerfile b/docker/django/Dockerfile index 3461161a46..7536fc7762 100644 --- a/docker/django/Dockerfile +++ b/docker/django/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.13-slim as build-base +FROM python:3.13-slim AS build-base RUN apt-get update --option "Acquire::Retries=3" --quiet=2 && \ apt-get install \ @@ -41,7 +41,7 @@ RUN python -m venv $POETRY_HOME && \ ln -s $POETRY_HOME/bin/poetry "$(dirname $(which python))/poetry" # make accessible via $PATH ARG BUILD_ENV=prod -FROM build-base as python-base +FROM build-base AS python-base WORKDIR $PYSETUP_PATH @@ -71,7 +71,7 @@ RUN mkdir /var/log/courtlistener \ WORKDIR /opt/courtlistener -ENV PYTHONPATH="${PYTHONPATH}:/opt/courtlistener" +ENV PYTHONPATH="/opt/courtlistener" USER root ## Creates a directory for Hyperscan db