Skip to content

Commit dbb176e

Browse files
authored
bug-1945509: switch from make to just (#3116)
This switches from make to just. While doing that, this also fixes a couple of other things: 1. fixes running the Django webapp using `manage.py runserver` when in a local dev environment; I think I broke this in 2023 when I switched the container to use Honcho to run the web and disk manager processes 2. removes the test-ci and frontend-ci services and instead uses docker-compose.override.yml to add volume mounts Tecken should work like other crash ingestion services now.
1 parent 7a8ba71 commit dbb176e

16 files changed

+181
-222
lines changed

.github/workflows/build-and-push.yml

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Build, test and push a Docker image
23

34
on:
@@ -19,7 +20,10 @@ jobs:
1920
contents: read
2021
deployments: write
2122
id-token: write
22-
runs-on: ubuntu-latest
23+
runs-on: ubuntu-24.04
24+
env:
25+
# Disable docker compose volume mounts in docker-compose.override.yml
26+
COMPOSE_FILE: docker-compose.yml
2327
steps:
2428
- uses: actions/checkout@v4
2529
- name: Get info
@@ -37,22 +41,24 @@ jobs:
3741
"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" > version.json
3842
- name: Output version.json
3943
run: cat version.json
44+
- name: Install just
45+
run: sudo apt-get update && sudo apt-get install -y just
4046
- name: Build Docker images
41-
run: make build
47+
run: |
48+
just build
49+
docker compose images
4250
- name: Verify requirements.txt contains correct dependencies
4351
run: |
44-
docker compose run --rm --no-deps test-ci bash ./bin/run_verify_reqs.sh
52+
just verify-reqs
4553
- name: Run lint check
4654
run: |
47-
make .env
48-
docker compose run --rm --no-deps test-ci bash ./bin/run_lint.sh
49-
docker compose run --rm --no-deps frontend-ci lint
55+
just lint
5056
- name: Run tests
5157
run: |
52-
docker compose run --rm test-ci bash ./bin/run_test.sh
58+
just test
5359
- name: Build docs
5460
run: |
55-
docker compose run --rm --no-deps test-ci bash make -C docs/ html
61+
just docs
5662
5763
- name: Set Docker image tag to "latest" for updates of the main branch
5864
if: github.ref == 'refs/heads/main'

Makefile

-134
This file was deleted.

bin/entrypoint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ shift
3030

3131
case ${SERVICE} in
3232
web) ## Run Tecken web service
33-
exec honcho -f /app//Procfile --no-prefix start
33+
exec honcho -f /app/Procfile --no-prefix start
3434
;;
3535
bash) ## Open a bash shell or run something else
3636
if [ -z "$*" ]; then

bin/run_lint.sh

+12-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,16 @@ FILES="bin tecken smoketests systemtests"
1616
PYTHON_VERSION=$(python --version)
1717

1818

19-
if [[ $1 == "--fix" ]]; then
19+
if [[ "${1:-}" == "--help" ]]; then
20+
echo "Usage: $0 [OPTIONS]"
21+
echo
22+
echo " Lint code"
23+
echo
24+
echo "Options:"
25+
echo " --help Show this message and exit."
26+
echo " --fix Reformat code."
27+
28+
elif [[ $1 == "--fix" ]]; then
2029
echo ">>> ruff fix (${PYTHON_VERSION})"
2130
ruff format $FILES
2231
ruff check --fix $FILES
@@ -38,5 +47,6 @@ else
3847
license-check .
3948
fi
4049

41-
# NOTE(willkg): linting frontend files is done in another script
50+
# NOTE(willkg): linting frontend files is done in another script because
51+
# it has to run in the frontend container
4252
fi

bin/run_web.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
export PROCESS_NAME=webapp
1414

15-
if [ "$1" == "--dev" ]; then
15+
if [ "$LOCAL_DEV_ENV" == "true" ]; then
1616
python manage.py migrate --noinput
1717
python manage.py runserver 0.0.0.0:${PORT}
1818

docker-compose.override.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# define volumes in docker-compose.override.yml so that can be ignored in CI
2+
---
3+
services:
4+
base:
5+
volumes:
6+
- .:/app
7+
web:
8+
volumes:
9+
- .:/app
10+
test:
11+
volumes:
12+
- .:/app
13+
frontend:
14+
volumes:
15+
- ./frontend:/app

docker-compose.yml

+2-32
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,8 @@ services:
2929
localstack: *condition_service_healthy
3030
oidcprovider: *condition_service_healthy
3131
statsd: *condition_service_healthy
32-
volumes:
33-
- $PWD:/app
34-
command: ["web", "--dev"]
35-
36-
# Container specifically for running tests.
37-
test-ci:
38-
extends:
39-
service: base
40-
env_file:
41-
- docker/config/local_dev.env
42-
- docker/config/test.env
43-
depends_on:
44-
db: *condition_service_healthy
45-
gcs-emulator: *condition_service_healthy
46-
fakesentry: *condition_service_healthy
47-
redis-cache: *condition_service_healthy
48-
localstack: *condition_service_healthy
49-
oidcprovider: *condition_service_healthy
50-
statsd: *condition_service_healthy
32+
command: ["web"]
5133

52-
# TODO(2024-01-30): This configuration can be simplified using `extends: test-ci` once the fix for
53-
# https://github.com/docker/compose/issues/11413 is available in all relevant environments.
5434
test:
5535
extends:
5636
service: base
@@ -65,8 +45,6 @@ services:
6545
localstack: *condition_service_healthy
6646
oidcprovider: *condition_service_healthy
6747
statsd: *condition_service_healthy
68-
volumes:
69-
- $PWD:/app
7048

7149
# Dev container https://containers.dev/, e.g. for VS Code
7250
devcontainer:
@@ -105,25 +83,17 @@ services:
10583
redis-cache: *condition_service_healthy
10684
command: web
10785

108-
# Same as 'frontend' but no volumes or command
109-
frontend-ci:
86+
frontend:
11087
build:
111-
context: .
11288
dockerfile: frontend/Dockerfile
11389
args:
11490
userid: ${USE_UID:-10001}
11591
groupid: ${USE_GID:-10001}
116-
117-
frontend:
118-
extends:
119-
frontend-ci
12092
environment:
12193
- NODE_ENV=development
12294
ports:
12395
- "3000:3000"
12496
- "35729:35729"
125-
volumes:
126-
- $PWD/frontend:/app
12797
command: start
12898

12999
# https://hub.docker.com/_/postgres/

docker/config/slick.sh-dist

+3-6
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,10 @@ FAKETOKEN="c7c1f8cab79545b6a06bc4122f0eb3cb"
2121
FAKETOKEN_TRY="ebc447f574924b099e1be15527b62436"
2222

2323
# Build Tecken
24-
make build
25-
26-
# Start services
27-
docker compose up -d --remove-orphans db redis-cache statsd localstack oidcprovider fakesentry
24+
just build
2825

2926
# Run setup
30-
make setup
27+
just setup
3128

3229
# Set up user
3330
docker compose exec oidcprovider /code/manage.py createuser "${FAKEUSERNAME}" "${FAKEPASSWORD}" "${FAKEEMAIL}"
@@ -39,4 +36,4 @@ docker compose run --rm web bash python manage.py createtoken "--try-upload" "${
3936
curl -X POST http://localhost:8090/api/flush/
4037

4138
# Reset Redis
42-
make clear-cache
39+
just clear-cache

0 commit comments

Comments
 (0)