Update pipeline steps

This commit is contained in:
Santiago Lo Coco 2023-10-23 13:25:35 -03:00
parent a5878b0f92
commit 433c2c3de3
8 changed files with 70 additions and 9 deletions

2
.gitignore vendored
View File

@ -1,4 +1,6 @@
.venv .venv
.env .env
.env.* .env.*
!.env.dev.example
!.env.prod.example
node_modules node_modules

View File

@ -123,11 +123,12 @@ test-auth-api:
script: script:
- export $(cat context.env | xargs) - export $(cat context.env | xargs)
- export API_IMAGE=$BROWSER_CLIENT_TEST_IMAGE_NAME - export API_IMAGE=$USER_MANAGER_TEST_IMAGE_NAME
- export CLIENT_IMAGE=dummy-image - export CLIENT_IMAGE=dummy-image
- docker login -u $CI_REGISTRY_USER --password $CI_JOB_TOKEN $CI_REGISTRY - docker login -u $CI_REGISTRY_USER --password $CI_JOB_TOKEN $CI_REGISTRY
- docker compose -f auth-domain/docker-compose.yml --env-file $ENV_DEV_FILE down
- docker compose -f auth-domain/docker-compose.yml --env-file $ENV_DEV_FILE pull - docker compose -f auth-domain/docker-compose.yml --env-file $ENV_DEV_FILE pull
- docker compose -f auth-domain/docker-compose.yml --env-file $ENV_DEV_FILE up --abort-on-container-exit --renew-anon-volumes - docker compose -f auth-domain/docker-compose.yml --env-file $ENV_DEV_FILE up --abort-on-container-exit --renew-anon-volumes
- docker cp fids_usermanager_api:/usr/src/app/coverage.xml . - docker cp fids_usermanager_api:/usr/src/app/coverage.xml .
@ -156,6 +157,7 @@ test-flights-api:
- docker login -u $CI_REGISTRY_USER --password $CI_JOB_TOKEN $CI_REGISTRY - docker login -u $CI_REGISTRY_USER --password $CI_JOB_TOKEN $CI_REGISTRY
- docker compose -f flights-domain/docker-compose.yml --env-file $ENV_DEV_FILE down
- docker compose -f flights-domain/docker-compose.yml --env-file $ENV_DEV_FILE pull - docker compose -f flights-domain/docker-compose.yml --env-file $ENV_DEV_FILE pull
- docker compose -f flights-domain/docker-compose.yml --env-file $ENV_DEV_FILE up --abort-on-container-exit --renew-anon-volumes - docker compose -f flights-domain/docker-compose.yml --env-file $ENV_DEV_FILE up --abort-on-container-exit --renew-anon-volumes
- docker cp fids_flights_api:/usr/src/app/coverage.xml . - docker cp fids_flights_api:/usr/src/app/coverage.xml .
@ -180,18 +182,58 @@ test-integration:
- export $(cat context.env | xargs) - export $(cat context.env | xargs)
- docker login -u $CI_REGISTRY_USER --password $CI_JOB_TOKEN $CI_REGISTRY - docker login -u $CI_REGISTRY_USER --password $CI_JOB_TOKEN $CI_REGISTRY
- export API_IMAGE=$API_TEST_IMAGE_NAME - export API_IMAGE=$FLIGHTS_INFO_TEST_IMAGE_NAME
- export CLIENT_IMAGE=$CLIENT_TEST_IMAGE_NAME
- export TEST_TARGET=INTEGRATION - export TEST_TARGET=INTEGRATION
# - docker compose -f docker-compose.yml --env-file $ENV_DEV_FILE pull - docker compose -f flights-domain/docker-compose.yml --env-file $ENV_DEV_FILE down
# - docker compose -f docker-compose.yml --env-file $ENV_DEV_FILE up --abort-on-container-exit - docker compose -f flights-domain/docker-compose.yml --env-file $ENV_DEV_FILE pull
- docker compose -f flights-domain/docker-compose.yml --env-file $ENV_DEV_FILE up --abort-on-container-exit
- export API_IMAGE=$USER_MANAGER_TEST_IMAGE_NAME
- export TEST_TARGET=INTEGRATION
- docker compose -f auth-domain/docker-compose.yml --env-file $ENV_DEV_FILE down
- docker compose -f auth-domain/docker-compose.yml --env-file $ENV_DEV_FILE pull
- docker compose -f auth-domain/docker-compose.yml --env-file $ENV_DEV_FILE up --abort-on-container-exit
needs: needs:
- job: test-flights-api - job: test-flights-api
- job: test-auth-api - job: test-auth-api
- job: preparation
artifacts: true
test-browser-integration:
stage: test
tags:
- dev
script:
- export $(cat context.env | xargs)
- docker login -u $CI_REGISTRY_USER --password $CI_JOB_TOKEN $CI_REGISTRY
- export CLIENT_IMAGE=$BROWSER_CLIENT_TEST_IMAGE_NAME
- docker compose -f browser-domain/docker-compose.yml --env-file $ENV_DEV_FILE down
- docker compose -f browser-domain/docker-compose.yml --env-file $ENV_DEV_FILE pull
- docker compose -f browser-domain/docker-compose.yml --env-file $ENV_DEV_FILE up --abort-on-container-exit
needs:
- job: test-integration
- job: build-browser-client - job: build-browser-client
- job: preparation
artifacts: true
test-screen-integration:
stage: test
tags:
- dev
script:
- export $(cat context.env | xargs)
- docker login -u $CI_REGISTRY_USER --password $CI_JOB_TOKEN $CI_REGISTRY
- export CLIENT_IMAGE=$SCREEN_CLIENT_TEST_IMAGE_NAME
- docker compose -f screen-domain/docker-compose.yml --env-file $ENV_DEV_FILE down
- docker compose -f screen-domain/docker-compose.yml --env-file $ENV_DEV_FILE pull
- docker compose -f screen-domain/docker-compose.yml --env-file $ENV_DEV_FILE up --abort-on-container-exit
needs:
- job: test-integration
- job: build-screen-client - job: build-screen-client
- job: preparation - job: preparation
artifacts: true artifacts: true
deliver-dockerhub: deliver-dockerhub:
stage: deliver stage: deliver
@ -213,7 +255,8 @@ deliver-dockerhub:
- docker push $DOCKER_HUB_BROWSER_CLIENT_IMAGE - docker push $DOCKER_HUB_BROWSER_CLIENT_IMAGE
- docker push $DOCKER_HUB_SCREEN_CLIENT_IMAGE - docker push $DOCKER_HUB_SCREEN_CLIENT_IMAGE
needs: needs:
- job: test-integration - job: test-screen-integration
- job: test-browser-integration
- job: preparation - job: preparation
artifacts: true artifacts: true

View File

@ -0,0 +1,4 @@
POSTGRES_USER=user
POSTGRES_PASS=password
POSTGRES_DB=api_dev
APP_SETTINGS=src.config.DevelopmentConfig

View File

@ -0,0 +1,4 @@
POSTGRES_USER=user
POSTGRES_PASS=password
POSTGRES_DB=api_prod
APP_SETTINGS=src.config.ProductionConfig

View File

@ -4,7 +4,7 @@ FROM ${BASE_IMAGE}
ENV FLASK_DEBUG=1 ENV FLASK_DEBUG=1
ENV FLASK_ENV=development ENV FLASK_ENV=development
ENV DATABASE_TEST_URL=postgresql://postgres:postgres@api-db:5432/api_test ENV DATABASE_TEST_URL=postgresql://postgres:postgres@usermanager-db:5432/api_test
# add and install requirements # add and install requirements
COPY --chown=python:python ./requirements.test.txt . COPY --chown=python:python ./requirements.test.txt .

View File

@ -0,0 +1,4 @@
POSTGRES_USER=user
POSTGRES_PASS=password
POSTGRES_DB=api_dev
APP_SETTINGS=src.config.DevelopmentConfig

View File

@ -0,0 +1,4 @@
POSTGRES_USER=user
POSTGRES_PASS=password
POSTGRES_DB=api_prod
APP_SETTINGS=src.config.ProductionConfig

View File

@ -2,7 +2,7 @@ import { Axios, AxiosError } from "axios";
import { Credentials, User, Flight } from "./Types"; import { Credentials, User, Flight } from "./Types";
const instance = new Axios({ const instance = new Axios({
baseURL: process.env.REACT_APP_ENDPOINT, baseURL: process.env.REACT_APP_ENDPOINT ? process.env.REACT_APP_ENDPOINT : "http://127.0.0.1:5000/",
headers: { headers: {
accept: "application/json", accept: "application/json",
"Content-Type": "application/json", "Content-Type": "application/json",