Skip to content

Commit fe1b2d6

Browse files
committed
ci, dev: remove frontend nginx version, dev stack with bundled front 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 <elysasrc@proton.me>
1 parent 79ce74c commit fe1b2d6

24 files changed

+370
-326
lines changed

.github/scripts/bake-metadata.py

-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ def suffix(self):
3838
Target(name="editoast", image="editoast", release=True),
3939
Target(name="editoast-test", image="editoast", variant="test"),
4040

41-
Target(name="front-devel", image="front", variant="devel"),
42-
Target(name="front-nginx", image="front", variant="nginx"),
43-
Target(name="front-build", image="front", variant="build"),
4441
Target(name="front-tests", image="front", variant="tests"),
4542

4643
Target(name="gateway-standalone", image="gateway", variant="standalone"),

.github/workflows/build.yml

+21-60
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- [core-build, core]
2828
- [editoast, editoast-test]
2929
- [gateway-test, gateway-standalone, gateway-front]
30-
- [front-build, front-tests, front-devel, front-nginx]
30+
- [front-tests]
3131
- [osrdyne, osrdyne-test]
3232
steps:
3333
- name: Checkout
@@ -105,12 +105,6 @@ jobs:
105105
echo "All retries failed, exiting."
106106
exit 1
107107
108-
- name: Upload front-build artifact
109-
uses: actions/upload-artifact@v4
110-
if: steps.bake-metadata.outputs.output_method == 'artifact' && contains(matrix.targets, 'front-build')
111-
with:
112-
name: front-build
113-
path: osrd-front-build.tar
114108
- name: Upload core-build artifact
115109
uses: actions/upload-artifact@v4
116110
if: steps.bake-metadata.outputs.output_method == 'artifact' && contains(matrix.targets, 'core-build')
@@ -159,12 +153,6 @@ jobs:
159153
with:
160154
name: gateway-standalone
161155
path: osrd-gateway-standalone.tar
162-
- name: Upload front-nginx artifact
163-
uses: actions/upload-artifact@v4
164-
if: steps.bake-metadata.outputs.output_method == 'artifact' && contains(matrix.targets, 'front-nginx')
165-
with:
166-
name: front-nginx
167-
path: osrd-front-nginx.tar
168156
- name: Upload osrdyne artifact
169157
uses: actions/upload-artifact@v4
170158
if: steps.bake-metadata.outputs.output_method == 'artifact' && contains(matrix.targets, 'osrdyne')
@@ -191,6 +179,8 @@ jobs:
191179
docker build -t test_data - <Dockerfile.empty
192180
docker build -t static_assets - <Dockerfile.empty
193181
docker build -t front_tests:latest - <Dockerfile.empty
182+
docker build -t front_build:latest - <Dockerfile.empty
183+
docker build -t front_src:latest - <Dockerfile.empty
194184
195185
- name: Find and check all Dockerfiles using docker build --check
196186
run: |
@@ -468,13 +458,13 @@ jobs:
468458
if: needs.build.outputs.output_method == 'artifact'
469459
uses: actions/download-artifact@v4
470460
with:
471-
name: front-build
461+
name: front-tests
472462
path: .
473463

474464
- name: Load built images
475465
if: needs.build.outputs.output_method == 'artifact'
476466
run: |
477-
docker load --input ./osrd-front-build.tar
467+
docker load --input ./osrd-front-tests.tar
478468
docker image ls -a
479469
480470
- name: Generate rtk bindings
@@ -483,7 +473,7 @@ jobs:
483473
-v $PWD/editoast:/editoast
484474
-v $PWD/gateway:/gateway
485475
-v $PWD/front/src/common/api:/app/src/common/api
486-
${{ fromJSON(needs.build.outputs.stable_tags).front-build }}
476+
${{ fromJSON(needs.build.outputs.stable_tags).front-tests }}
487477
npm run generate-types
488478
489479
- name: Check for unexpected changes
@@ -679,18 +669,18 @@ jobs:
679669
with:
680670
name: editoast
681671
path: .
682-
- name: Download built front-build image
672+
- name: Download built front-tests image
683673
if: needs.build.outputs.output_method == 'artifact'
684674
uses: actions/download-artifact@v4
685675
with:
686-
name: front-build
676+
name: front-tests
687677
path: .
688678

689679
- name: Load built images
690680
if: needs.build.outputs.output_method == 'artifact'
691681
run: |
692682
docker load --input ./osrd-editoast.tar
693-
docker load --input ./osrd-front-build.tar
683+
docker load --input ./osrd-front-tests.tar
694684
695685
- name: Generate OpenAPI
696686
run: |
@@ -705,7 +695,7 @@ jobs:
705695
- name: Check for i18n API errors
706696
run: |
707697
docker run --name=front-i18n-api-error --net=host -v $PWD/output/openapi.yaml:/editoast/openapi.yaml \
708-
${{ fromJSON(needs.build.outputs.stable_tags).front-build }} \
698+
${{ fromJSON(needs.build.outputs.stable_tags).front-tests }} \
709699
npm run i18n-api-errors
710700
exit $(docker wait front-i18n-api-error)
711701
@@ -849,33 +839,33 @@ jobs:
849839
if: needs.build.outputs.output_method == 'artifact'
850840
uses: actions/download-artifact@v4
851841
with:
852-
name: front-build
842+
name: front-tests
853843
path: .
854844

855845
- name: Load built images
856846
if: needs.build.outputs.output_method == 'artifact'
857847
run: |
858-
docker load --input ./osrd-front-build.tar
848+
docker load --input ./osrd-front-tests.tar
859849
860850
- name: Check code formatting
861851
run: |
862852
docker run --name=front-format --net=host \
863-
${{ fromJSON(needs.build.outputs.stable_tags).front-build }} \
853+
${{ fromJSON(needs.build.outputs.stable_tags).front-tests }} \
864854
npx prettier . --check
865855
866856
exit $(docker wait front-format)
867857
868858
- name: Check for i18n missing keys
869859
run: |
870860
docker run --name=front-i18n-checker --net=host \
871-
${{ fromJSON(needs.build.outputs.stable_tags).front-build }} \
861+
${{ fromJSON(needs.build.outputs.stable_tags).front-tests }} \
872862
npm run i18n-checker
873863
exit $(docker wait front-i18n-checker)
874864
875865
- name: Execute tests within container
876866
run: |
877867
docker run --name=front-test --net=host -v $PWD/output:/app/tests/unit \
878-
${{ fromJSON(needs.build.outputs.stable_tags).front-build }} \
868+
${{ fromJSON(needs.build.outputs.stable_tags).front-tests }} \
879869
npm run test-coverage
880870
881871
exit $(docker wait front-test)
@@ -900,12 +890,6 @@ jobs:
900890
# https://www.jameskerr.blog/posts/sharing-steps-in-github-action-workflows/
901891
- name: Checkout
902892
uses: actions/checkout@v4
903-
- name: Download built front-tests image
904-
if: needs.build.outputs.output_method == 'artifact'
905-
uses: actions/download-artifact@v4
906-
with:
907-
name: front-tests
908-
path: .
909893
- name: Download built editoast image
910894
if: needs.build.outputs.output_method == 'artifact'
911895
uses: actions/download-artifact@v4
@@ -918,18 +902,6 @@ jobs:
918902
with:
919903
name: core
920904
path: .
921-
- name: Download built gateway-standalone image
922-
if: needs.build.outputs.output_method == 'artifact'
923-
uses: actions/download-artifact@v4
924-
with:
925-
name: gateway-standalone
926-
path: .
927-
- name: Download built front-nginx image
928-
if: needs.build.outputs.output_method == 'artifact'
929-
uses: actions/download-artifact@v4
930-
with:
931-
name: front-nginx
932-
path: .
933905
- name: Download built osrdyne image
934906
if: needs.build.outputs.output_method == 'artifact'
935907
uses: actions/download-artifact@v4
@@ -939,11 +911,8 @@ jobs:
939911
- name: Load built images
940912
if: needs.build.outputs.output_method == 'artifact'
941913
run: |
942-
docker load --input ./osrd-front-tests.tar
943914
docker load --input ./osrd-editoast.tar
944915
docker load --input ./osrd-core.tar
945-
docker load --input ./osrd-gateway-standalone.tar
946-
docker load --input ./osrd-front-nginx.tar
947916
docker load --input ./osrd-osrdyne.tar
948917
- name: Install poetry
949918
run: pipx install 'poetry<2.0'
@@ -961,14 +930,13 @@ jobs:
961930
id: start_integration_worker
962931
run: |
963932
set -e
964-
export OSRD_FRONT_MODE=nginx
965933
export TAG='${{ needs.build.outputs.stable_version }}'
966934
967935
# Inside /docker/osrdyne.yml, replace core_image "osrd-core:dev" with "osrd-core:$TAG"
968936
# to match the version of the core image we just built inside osrdyne
969937
sed -i "s/osrd-core:dev/osrd-core:$TAG/" docker/osrdyne.yml
970938
971-
services='editoast osrdyne front core gateway'
939+
services='editoast osrdyne core'
972940
composes='-f docker-compose.yml'
973941
docker compose $composes pull --policy missing $services
974942
docker compose $composes up --no-build -d $services jaeger
@@ -1029,17 +997,11 @@ jobs:
1029997
with:
1030998
name: core
1031999
path: .
1032-
- name: Download built gateway-standalone image
1033-
if: needs.build.outputs.output_method == 'artifact'
1034-
uses: actions/download-artifact@v4
1035-
with:
1036-
name: gateway-standalone
1037-
path: .
1038-
- name: Download built front-nginx image
1000+
- name: Download built gateway-front image
10391001
if: needs.build.outputs.output_method == 'artifact'
10401002
uses: actions/download-artifact@v4
10411003
with:
1042-
name: front-nginx
1004+
name: gateway-front
10431005
path: .
10441006
- name: Download built osrdyne image
10451007
if: needs.build.outputs.output_method == 'artifact'
@@ -1053,8 +1015,7 @@ jobs:
10531015
docker load --input ./osrd-front-tests.tar
10541016
docker load --input ./osrd-editoast.tar
10551017
docker load --input ./osrd-core.tar
1056-
docker load --input ./osrd-gateway-standalone.tar
1057-
docker load --input ./osrd-front-nginx.tar
1018+
docker load --input ./osrd-gateway-front.tar
10581019
docker load --input ./osrd-osrdyne.tar
10591020
10601021
- name: Detect Playwright version
@@ -1079,14 +1040,14 @@ jobs:
10791040
id: start_playwright_worker
10801041
run: |
10811042
set -e
1082-
export OSRD_FRONT_MODE=nginx
10831043
export TAG='${{ needs.build.outputs.stable_version }}'
1044+
export GATEWAY_FLAVOR='front'
10841045
10851046
# Inside /docker/osrdyne.yml, replace core_image "osrd-core:dev" with "osrd-core:$TAG"
10861047
# to match the version of the core image we just built inside osrdyne
10871048
sed -i "s/osrd-core:dev/osrd-core:$TAG/" docker/osrdyne.yml
10881049
1089-
services='editoast osrdyne front core gateway'
1050+
services='editoast osrdyne core gateway'
10901051
composes='-f docker-compose.yml'
10911052
docker compose $composes pull --policy missing $services
10921053
docker compose $composes up --no-build -d $services jaeger

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ __pycache__
77
# Direnv
88
.envrc
99
.direnv
10+
11+
# Helper script
12+
.osrd-compose-state

docker-compose.yml

+5-28
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ volumes:
55
valkey_data:
66
rabbitmq_data:
77

8+
89
services:
910
postgres:
1011
image: ${OSRD_POSTGIS_IMAGE:-postgis/postgis:16-3.4-alpine}
@@ -84,30 +85,6 @@ services:
8485
restart: "no"
8586
command: "true"
8687

87-
front:
88-
image: ghcr.io/openrailassociation/osrd-edge/osrd-front:${TAG-dev}-${OSRD_FRONT_MODE-devel}
89-
container_name: osrd-front
90-
build:
91-
context: front
92-
additional_contexts:
93-
test_data: tests/data
94-
dockerfile: docker/Dockerfile.${OSRD_FRONT_MODE-devel}
95-
args:
96-
OSRD_GIT_DESCRIBE: development
97-
environment:
98-
FRONT_PORT: 3000 # only useful with the prod config
99-
OSRD_EDITOAST_URL: /api
100-
volumes:
101-
- "./front:/app"
102-
- "./tests/data:/tests/data"
103-
restart: unless-stopped
104-
ports: [ "3000:3000" ]
105-
healthcheck:
106-
test: [ "CMD", "curl", "-f", "http://localhost:3000" ]
107-
start_period: 4s
108-
interval: 5s
109-
retries: 6
110-
11188
editoast:
11289
image: ghcr.io/openrailassociation/osrd-edge/osrd-editoast:${TAG-dev}
11390
container_name: osrd-editoast
@@ -146,16 +123,16 @@ services:
146123
retries: 6
147124

148125
gateway:
149-
image: ghcr.io/openrailassociation/osrd-edge/osrd-gateway:${TAG-dev}-standalone
126+
image: ghcr.io/openrailassociation/osrd-edge/osrd-gateway:${TAG-dev}-${GATEWAY_FLAVOR-front}
150127
container_name: osrd-gateway
151128
build:
152129
context: gateway
153130
dockerfile: Dockerfile
154131
args:
155-
OSRD_GIT_DESCRIBE: ${OSRD_GIT_DESCRIBE}
132+
OSRD_GIT_DESCRIBE: development
156133
CARGO_PROFILE: dev
157-
volumes:
158-
- "./docker/gateway.dev.simple.toml:/gateway.toml"
134+
additional_contexts:
135+
front_src: front
159136
restart: unless-stopped
160137
ports: [ "4000:4000" ]
161138

docker/docker-bake-simple.hcl

-57
This file was deleted.

0 commit comments

Comments
 (0)