Skip to content

Commit

Permalink
ci, dev: remove frontend nginx version, dev stack with bundled front …
Browse files Browse the repository at this point in the history
…by default

- Use the gateway-front in the e2e tests
- Simplify the integration tests step removing gateway and front images
- Use the gateway front image for the front, removing the container front
  of the default stack
- Create a Docker compose for the front devel stack

Signed-off-by: Élyse Viard <[email protected]>
  • Loading branch information
ElysaSrc committed Jan 23, 2025
1 parent d651580 commit 9ca9543
Show file tree
Hide file tree
Showing 18 changed files with 283 additions and 297 deletions.
75 changes: 21 additions & 54 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- [core-build, core]
- [editoast, editoast-test]
- [gateway-test, gateway-standalone, gateway-front]
- [front-build, front-tests, front-devel, front-nginx]
- [front-tests]
- [osrdyne, osrdyne-test]
steps:
- name: Checkout
Expand Down Expand Up @@ -105,12 +105,6 @@ jobs:
echo "All retries failed, exiting."
exit 1
- name: Upload front-build artifact
uses: actions/upload-artifact@v4
if: steps.bake-metadata.outputs.output_method == 'artifact' && contains(matrix.targets, 'front-build')
with:
name: front-build
path: osrd-front-build.tar
- name: Upload core-build artifact
uses: actions/upload-artifact@v4
if: steps.bake-metadata.outputs.output_method == 'artifact' && contains(matrix.targets, 'core-build')
Expand Down Expand Up @@ -191,6 +185,8 @@ jobs:
docker build -t test_data - <Dockerfile.empty
docker build -t static_assets - <Dockerfile.empty
docker build -t front_tests:latest - <Dockerfile.empty
docker build -t front_build:latest - <Dockerfile.empty
docker build -t front_src:latest - <Dockerfile.empty
- name: Find and check all Dockerfiles using docker build --check
run: |
Expand Down Expand Up @@ -468,13 +464,13 @@ jobs:
if: needs.build.outputs.output_method == 'artifact'
uses: actions/download-artifact@v4
with:
name: front-build
name: front-tests
path: .

- name: Load built images
if: needs.build.outputs.output_method == 'artifact'
run: |
docker load --input ./osrd-front-build.tar
docker load --input ./osrd-front-tests.tar
docker image ls -a
- name: Generate rtk bindings
Expand All @@ -483,7 +479,7 @@ jobs:
-v $PWD/editoast:/editoast
-v $PWD/gateway:/gateway
-v $PWD/front/src/common/api:/app/src/common/api
${{ fromJSON(needs.build.outputs.stable_tags).front-build }}
${{ fromJSON(needs.build.outputs.stable_tags).front-tests }}
npm run generate-types
- name: Check for unexpected changes
Expand Down Expand Up @@ -679,18 +675,18 @@ jobs:
with:
name: editoast
path: .
- name: Download built front-build image
- name: Download built front-tests image
if: needs.build.outputs.output_method == 'artifact'
uses: actions/download-artifact@v4
with:
name: front-build
name: front-tests
path: .

- name: Load built images
if: needs.build.outputs.output_method == 'artifact'
run: |
docker load --input ./osrd-editoast.tar
docker load --input ./osrd-front-build.tar
docker load --input ./osrd-front-tests.tar
- name: Generate OpenAPI
run: |
Expand All @@ -705,7 +701,7 @@ jobs:
- name: Check for i18n API errors
run: |
docker run --name=front-i18n-api-error --net=host -v $PWD/output/openapi.yaml:/editoast/openapi.yaml \
${{ fromJSON(needs.build.outputs.stable_tags).front-build }} \
${{ fromJSON(needs.build.outputs.stable_tags).front-tests }} \
npm run i18n-api-errors
exit $(docker wait front-i18n-api-error)
Expand Down Expand Up @@ -849,33 +845,33 @@ jobs:
if: needs.build.outputs.output_method == 'artifact'
uses: actions/download-artifact@v4
with:
name: front-build
name: front-tests
path: .

- name: Load built images
if: needs.build.outputs.output_method == 'artifact'
run: |
docker load --input ./osrd-front-build.tar
docker load --input ./osrd-front-tests.tar
- name: Check code formatting
run: |
docker run --name=front-format --net=host \
${{ fromJSON(needs.build.outputs.stable_tags).front-build }} \
${{ fromJSON(needs.build.outputs.stable_tags).front-tests }} \
npx prettier . --check
exit $(docker wait front-format)
- name: Check for i18n missing keys
run: |
docker run --name=front-i18n-checker --net=host \
${{ fromJSON(needs.build.outputs.stable_tags).front-build }} \
${{ fromJSON(needs.build.outputs.stable_tags).front-tests }} \
npm run i18n-checker
exit $(docker wait front-i18n-checker)
- name: Execute tests within container
run: |
docker run --name=front-test --net=host -v $PWD/output:/app/tests/unit \
${{ fromJSON(needs.build.outputs.stable_tags).front-build }} \
${{ fromJSON(needs.build.outputs.stable_tags).front-tests }} \
npm run test-coverage
exit $(docker wait front-test)
Expand All @@ -900,12 +896,6 @@ jobs:
# https://www.jameskerr.blog/posts/sharing-steps-in-github-action-workflows/
- name: Checkout
uses: actions/checkout@v4
- name: Download built front-tests image
if: needs.build.outputs.output_method == 'artifact'
uses: actions/download-artifact@v4
with:
name: front-tests
path: .
- name: Download built editoast image
if: needs.build.outputs.output_method == 'artifact'
uses: actions/download-artifact@v4
Expand All @@ -918,18 +908,6 @@ jobs:
with:
name: core
path: .
- name: Download built gateway-standalone image
if: needs.build.outputs.output_method == 'artifact'
uses: actions/download-artifact@v4
with:
name: gateway-standalone
path: .
- name: Download built front-nginx image
if: needs.build.outputs.output_method == 'artifact'
uses: actions/download-artifact@v4
with:
name: front-nginx
path: .
- name: Download built osrdyne image
if: needs.build.outputs.output_method == 'artifact'
uses: actions/download-artifact@v4
Expand All @@ -939,11 +917,8 @@ jobs:
- name: Load built images
if: needs.build.outputs.output_method == 'artifact'
run: |
docker load --input ./osrd-front-tests.tar
docker load --input ./osrd-editoast.tar
docker load --input ./osrd-core.tar
docker load --input ./osrd-gateway-standalone.tar
docker load --input ./osrd-front-nginx.tar
docker load --input ./osrd-osrdyne.tar
- name: Install poetry
run: pipx install 'poetry<2.0'
Expand All @@ -961,14 +936,13 @@ jobs:
id: start_integration_worker
run: |
set -e
export OSRD_FRONT_MODE=nginx
export TAG='${{ needs.build.outputs.stable_version }}'
# Inside /docker/osrdyne.yml, replace core_image "osrd-core:dev" with "osrd-core:$TAG"
# to match the version of the core image we just built inside osrdyne
sed -i "s/osrd-core:dev/osrd-core:$TAG/" docker/osrdyne.yml
services='editoast osrdyne front core gateway'
services='editoast osrdyne core'
composes='-f docker-compose.yml'
docker compose $composes pull --policy missing $services
docker compose $composes up --no-build -d $services jaeger
Expand Down Expand Up @@ -1029,17 +1003,11 @@ jobs:
with:
name: core
path: .
- name: Download built gateway-standalone image
if: needs.build.outputs.output_method == 'artifact'
uses: actions/download-artifact@v4
with:
name: gateway-standalone
path: .
- name: Download built front-nginx image
- name: Download built gateway-front image
if: needs.build.outputs.output_method == 'artifact'
uses: actions/download-artifact@v4
with:
name: front-nginx
name: gateway-front
path: .
- name: Download built osrdyne image
if: needs.build.outputs.output_method == 'artifact'
Expand All @@ -1053,8 +1021,7 @@ jobs:
docker load --input ./osrd-front-tests.tar
docker load --input ./osrd-editoast.tar
docker load --input ./osrd-core.tar
docker load --input ./osrd-gateway-standalone.tar
docker load --input ./osrd-front-nginx.tar
docker load --input ./osrd-gateway-front.tar
docker load --input ./osrd-osrdyne.tar
- name: Detect Playwright version
Expand All @@ -1079,14 +1046,14 @@ jobs:
id: start_playwright_worker
run: |
set -e
export OSRD_FRONT_MODE=nginx
export TAG='${{ needs.build.outputs.stable_version }}'
export GATEWAY_FLAVOR='front'
# Inside /docker/osrdyne.yml, replace core_image "osrd-core:dev" with "osrd-core:$TAG"
# to match the version of the core image we just built inside osrdyne
sed -i "s/osrd-core:dev/osrd-core:$TAG/" docker/osrdyne.yml
services='editoast osrdyne front core gateway'
services='editoast osrdyne core gateway'
composes='-f docker-compose.yml'
docker compose $composes pull --policy missing $services
docker compose $composes up --no-build -d $services jaeger
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ __pycache__
# Direnv
.envrc
.direnv

# Helper script
.osrd-compose-state
33 changes: 5 additions & 28 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ volumes:
valkey_data:
rabbitmq_data:


services:
postgres:
image: ${OSRD_POSTGIS_IMAGE:-postgis/postgis:16-3.4-alpine}
Expand Down Expand Up @@ -84,30 +85,6 @@ services:
restart: "no"
command: "true"

front:
image: ghcr.io/openrailassociation/osrd-edge/osrd-front:${TAG-dev}-${OSRD_FRONT_MODE-devel}
container_name: osrd-front
build:
context: front
additional_contexts:
test_data: tests/data
dockerfile: docker/Dockerfile.${OSRD_FRONT_MODE-devel}
args:
OSRD_GIT_DESCRIBE: development
environment:
FRONT_PORT: 3000 # only useful with the prod config
OSRD_EDITOAST_URL: /api
volumes:
- "./front:/app"
- "./tests/data:/tests/data"
restart: unless-stopped
ports: [ "3000:3000" ]
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:3000" ]
start_period: 4s
interval: 5s
retries: 6

editoast:
image: ghcr.io/openrailassociation/osrd-edge/osrd-editoast:${TAG-dev}
container_name: osrd-editoast
Expand Down Expand Up @@ -146,16 +123,16 @@ services:
retries: 6

gateway:
image: ghcr.io/openrailassociation/osrd-edge/osrd-gateway:${TAG-dev}-standalone
image: ghcr.io/openrailassociation/osrd-edge/osrd-gateway:${TAG-dev}-${GATEWAY_FLAVOR-front}
container_name: osrd-gateway
build:
context: gateway
dockerfile: Dockerfile
args:
OSRD_GIT_DESCRIBE: ${OSRD_GIT_DESCRIBE}
OSRD_GIT_DESCRIBE: development
CARGO_PROFILE: dev
volumes:
- "./docker/gateway.dev.simple.toml:/gateway.toml"
additional_contexts:
front_src: front
restart: unless-stopped
ports: [ "4000:4000" ]

Expand Down
57 changes: 0 additions & 57 deletions docker/docker-bake-simple.hcl

This file was deleted.

Loading

0 comments on commit 9ca9543

Please sign in to comment.