Skip to content

Commit

Permalink
ci: remove frontend nginx version
Browse files Browse the repository at this point in the history
- Use the gateway-front in the e2e tests
- Simplify the integration tests step removing gateway and front images

Signed-off-by: Florian Amsallem <[email protected]>
  • Loading branch information
flomonster committed Jan 16, 2025
1 parent accd619 commit db89c1a
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 123 deletions.
43 changes: 7 additions & 36 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-build, front-tests, front-devel]
- [osrdyne, osrdyne-test]
steps:
- name: Checkout
Expand Down Expand Up @@ -900,12 +900,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 +912,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 +921,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 +940,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 +1007,11 @@ jobs:
with:
name: core
path: .
- name: Download built gateway-standalone image
- name: Download built gateway-front 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
name: gateway-front
path: .
- name: Download built osrdyne image
if: needs.build.outputs.output_method == 'artifact'
Expand All @@ -1053,8 +1025,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 +1050,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
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ 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-standalone}
container_name: osrd-gateway
build:
context: gateway
Expand Down
4 changes: 0 additions & 4 deletions docker/docker-bake-simple.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ target "base-front-dev" {
tags = tags("front-dev")
}

target "base-front-nginx" {
tags = tags("front-nginx")
}

target "base-front-build" {
tags = tags("front-build")
}
Expand Down
12 changes: 2 additions & 10 deletions docker/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ group "default" {
"editoast",
"editoast-test",
"front-devel",
"front-nginx",
"front-build",
"front-tests",
"gateway-standalone",
Expand Down Expand Up @@ -101,26 +100,19 @@ target "front-devel" {
dockerfile = "docker/Dockerfile.devel"
}

target "base-front-nginx" {}
target "front-nginx" {
inherits = ["base", "base-front-nginx"]
context = "front"
dockerfile = "docker/Dockerfile.nginx"
}

target "base-front-build" {}
target "front-build" {
inherits = ["base", "base-front-build"]
context = "front"
dockerfile = "docker/Dockerfile.nginx"
dockerfile = "docker/Dockerfile"
target = "build"
}

target "base-front-tests" {}
target "front-tests" {
inherits = ["base", "base-front-tests"]
context = "front"
dockerfile = "docker/Dockerfile.nginx"
dockerfile = "docker/Dockerfile"
target = "tests"
contexts = {
test_data = "./tests/data"
Expand Down
2 changes: 1 addition & 1 deletion docker/gateway-front.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ WORKDIR /srv
COPY --from=front_build /app/build /srv/front/

# Copy an example config file
COPY --from=gateway_src ./gateway.prod.sample.toml /gateway.sample.toml
COPY --from=gateway_src ./gateway.prod.sample.toml /srv/gateway.toml
COPY --chmod=755 ./gateway-entrypoint.sh /srv/entrypoint.sh
ENTRYPOINT ["/srv/entrypoint.sh"]
CMD ["/usr/local/bin/osrd_gateway"]
20 changes: 20 additions & 0 deletions front/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### BUILD STAGE

FROM node:20-bookworm AS build

WORKDIR /app

# Build dependencies
COPY package.json package-lock.json /app/
RUN npm install --frozen-lockfile

# Generate the licenses file and build
COPY . /app
RUN npm run generate-licenses && npm run build

### TESTS STAGE

FROM build AS tests

# Allow to import tests data files
COPY --from=test_data . /tests/data
40 changes: 0 additions & 40 deletions front/docker/Dockerfile.nginx

This file was deleted.

7 changes: 0 additions & 7 deletions front/docker/nginx-entrypoint.sh

This file was deleted.

15 changes: 0 additions & 15 deletions front/docker/nginx.conf

This file was deleted.

34 changes: 25 additions & 9 deletions gateway/gateway.prod.sample.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This is an example production file. It's meant to be mounted inside the container at /gateway.toml

secret_key = "NOT+A+SECRET++NOT+A+SECRET++NOT+A+SECRET++NOT+A+SECRET++NOT+A+SECRET++NOT+A+SECRET++NOT+A+SECRET"
listen_addr = "0.0.0.0"
port = 80
trusted_proxies = ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]
Expand All @@ -10,19 +11,34 @@ redirect_404_to_index = true

[[targets]]
prefix = "/api"
upstream = "%EDITOAST_INTERNAL_URL%"
upstream = "http://osrd-editoast:80"
require_auth = true

[[targets]]
prefix = "/images"
upstream = "%OSRD_IMAGE_INTERNAL_URL%"
upstream = "http://osrd-images:8080"
require_auth = false

[auth]
default_provider = "mock"
secure_cookies = false

[[auth.providers]]
type = "Oidc"
provider_id = "example_provider"
issuer_url = "https://%PROVIDER_URL%"
post_login_url = "https://%POST_LOGIN_URL%"
callback_url = "https://%APP_ROOT_URL%/auth/provider/example_provider/callback"
client_id = "%CLIENT_ID%"
client_secret = "%CLIENT_SECRET%"
type = "Mocked"
provider_id = "mock"
username = "Example User"
require_login = false

# Example of OIDC auth
# [auth]
# default_provider = "oidc_provider"
# secure_cookies = true
#
# [[auth.providers]]
# type = "Oidc"
# provider_id = "oidc_provider"
# issuer_url = "https://%PROVIDER_URL%"
# post_login_url = "https://%POST_LOGIN_URL%"
# callback_url = "https://%APP_ROOT_URL%/auth/provider/example_provider/callback"
# client_id = "%CLIENT_ID%"
# client_secret = "%CLIENT_SECRET%"

0 comments on commit db89c1a

Please sign in to comment.