Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: updates to the pipeline #515

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"db:seed:staging": "npx prisma db seed -- --environment staging",
"db:seed:development": "npx prisma db seed -- --environment development --jurisdictionName 'Bay Area'",
"db:reseed:with-external:dev": "yarn db:setup:staging && IMPORT_ENV=dev yarn db:import-listings",
"db:reseed:ci": "SUPPRESS_NOTICE=true PGDATABASE=template1 yarn db:setup:staging",
"generate:client": "ts-node scripts/generate-axios-client.ts && prettier -w ../shared-helpers/src/types/backend-swagger.ts",
"test:e2e": "yarn db:resetup && yarn db:migration:run && jest --config ./test/jest-e2e.config.js",
"db:setup": "yarn db:resetup && yarn db:migration:run && yarn db:seed:development",
Expand Down
8 changes: 5 additions & 3 deletions build/docker/Dockerfile.backend
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ CMD yarn start:prod
# The run stage contains an optimized image for running the application
FROM run AS migrate

ENV SKIP_MIGRATIONS=TRUE

WORKDIR /app

# These parts have to be run as root
Expand All @@ -144,6 +146,6 @@ COPY --from=source --chown=node:node /app/api/scripts ./scripts
USER node

# We need to skip all migrations that are just for local development (changes already exist in deployed environment)
CMD yarn db:migration:skip 00_init || true && yarn db:migration:skip 02_hba_to_prisma || true && yarn db:migration:skip 03_0_external_listing || true && yarn db:migration:run
## uncomment the below if starting on a new environment
# CMD yarn db:migration:run
CMD if [ "$SKIP_MIGRATIONS" = TRUE ]; then yarn db:migration:skip 00_init || true && yarn db:migration:skip 02_hba_to_prisma || true && yarn db:migration:skip 03_0_external_listing || true && yarn db:migration:run; \
else yarn db:migration:run; \
fi
5 changes: 3 additions & 2 deletions ci/buildspec/build_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ phases:
- export ECR_HOST="${ECR_ACCOUNT_ID}.dkr.ecr.${ECR_REGION}.amazonaws.com"
- export ECR_REPO="${ECR_HOST}/${ECR_NAMESPACE}"

- docker build . -f build/docker/Dockerfile.backend --target test -t backend/core:test
- docker run backend/core:test yarn test
# Skip the test step as it is handle before merge. But re-add if you want more verification
# - docker build . -f build/docker/Dockerfile.backend --target test -t backend/core:test
# - docker run backend/core:test yarn test
- docker build . -f build/docker/Dockerfile.backend --target run -t backend/core:run-candidate
- docker build . -f build/docker/Dockerfile.backend --target migrate -t backend/core:migrate-candidate

Expand Down
1 change: 1 addition & 0 deletions ci/buildspec/migrate_stop_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ phases:
--env CLOUDINARY_KEY="${CLOUDINARY_KEY:-dummy_key}"
--env PARTNERS_BASE_URL="${PARTNERS_BASE_URL:-http://localhost:3001/not-used}"
--env PARTNERS_PORTAL_URL="${PARTNERS_PORTAL_URL:-http://localhost:3001/not-used}"
--env SKIP_MIGRATIONS=FALSE
"${MIGRATION_IMAGE}" sh -c "yarn ${MIGRATION_CMD}"

# Start the backend back up with the previous number of desired containers
Expand Down
Loading