api pr workflow#1076
Open
josekudiyirippil wants to merge 94 commits into
Open
Conversation
- Updated database access methods from `query.get()` to `db.session.get()` for consistency and improved performance in `appointment_post.py`, `appointment_put.py`, `exam_list.py`, `citizen_detail.py`, `citizen_generic_invite.py`, `citizen_list.py`, `health.py`, `service_requests_detail.py`, `service_requests_list.py`, `services.py`, and `snowplow.py`. - Refactored citizen state retrieval logic into dedicated functions in `citizen_detail.py`, `citizen_list.py`, and `service_requests_list.py` to enhance readability and maintainability. - Improved error handling in `citizen_detail.py` and `citizen_generic_invite.py` by using `get_json(silent=True)` to avoid exceptions on empty requests. - Updated SQLAlchemy and Flask-SQLAlchemy versions - Added new smoke test scripts for SQLAlchemy to validate database interactions and ensure application stability. - Refactored application initialization in `manage.py` and `qsystem.py` to streamline the setup process and improve logging. - Removed deprecated code and comments to clean up the codebase and enhance clarity.
Replace SSR setup with a client-side Vite React app and simplify runtime server. Removed server-side entry and SSR rendering, renamed client entry to main.tsx using createRoot, and updated index.html to remove SSR outlet. package.json scripts now use vite for dev and build. server.js simplified to a static file server that serves dist files and exposes /config/runtime-config.json. Dockerfile and compose.yaml adjusted to run the frontend image (added appointment-booking service in compose, exposed port 5173, and updated Postgres image/ports). Documentation updated across README files to document the new React Vite app and dev/run instructions.
Switch to nginx and serve built assets statically. Added nginx.conf and public/config/runtime-config.json, removed the custom Node server and in-image logos, and updated Dockerfile to copy dist into /app and run nginx on 8080. Updated package.json preview script to use vite preview, adjusted docker compose port mapping (5173:8080) and README instructions, and added ci_output.txt to .gitignore while deleting the file. Also expanded local CORS origins in api/config.py to include Vite ports 5173/5174.
Switch the runtime config filename to appointment-configuration.json. Rename public/config/runtime-config.json to public/config/appointment-configuration.json, update README references, and change the RUNTIME_CONFIG_URL in runtime-config.service.ts to '/config/appointment-configuration.json' so the app fetches the new config path on startup.
Rename the runtime config file from appointment-configuration.json to configuration.json and update related code and docs. Added public/config/configuration.json (uses VUE_APP_ROOT_API and requestTimeoutMs), removed the old appointment-configuration.json, updated runtime-config.service to fetch /config/configuration.json and map VUE_APP_ROOT_API to apiBaseUrl (with fallback and timeout handling), and updated the README to reference the new file path.
… of https://github.com/bcgov/queue-management into dev-44-develop-boilerplate-new-appointment-booking-app
…pointment-booking-app Dev 44 develop boilerplate new appointment booking app
removed cypress testing
Update pull-request-appointment.yml
changing deployment-config to deployment
Update reusable-wait-for-rollouts.yaml
Update pull-request-appointment.yml
Update reusable-tag-image.yaml
Update reusable-wait-for-rollouts.yaml
Update reusable-wait-for-rollouts.yaml
Update pull-request-deploy-frontend.yaml
pull-request workflow for api
Update pull-request-api.yaml
updating for the main branch push
Comment on lines
+12
to
+34
| name: Quality Checks | ||
| runs-on: ubuntu-latest | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: appointment-booking | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22' | ||
| cache: 'npm' | ||
| cache-dependency-path: appointment-booking/package-lock.json | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Run quality gates | ||
| run: npm run ci:check |
Comment on lines
+23
to
+87
| name: Prepare deployment inputs | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| environment: ${{ steps.parse.outputs.environment }} | ||
| image-tag: ${{ steps.parse.outputs.image-tag }} | ||
| push-qms: ${{ steps.parse.outputs.push-qms }} | ||
| push-theq: ${{ steps.parse.outputs.push-theq }} | ||
| ref: ${{ steps.parse.outputs.ref }} | ||
|
|
||
| steps: | ||
| - name: Parse Inputs | ||
| id: parse | ||
| shell: bash | ||
| env: | ||
| DISPATCH_PR_NUMBER: ${{ inputs['pr-number'] }} | ||
| DISPATCH_NAMESPACE: ${{ inputs.namespace }} | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then | ||
| TARGET_NAMESPACE="${DISPATCH_NAMESPACE}" | ||
| REF="refs/pull/${DISPATCH_PR_NUMBER}/head" | ||
| IMAGE_TAG="pr${DISPATCH_PR_NUMBER}" | ||
| else | ||
| # A push to develop deploys the exact commit that triggered the run. | ||
| TARGET_NAMESPACE="The Q Dev" | ||
| REF="${GITHUB_SHA}" | ||
| IMAGE_TAG="develop-${GITHUB_RUN_NUMBER}" | ||
| fi | ||
|
|
||
| ENVIRONMENT=$( | ||
| echo "${TARGET_NAMESPACE}" | | ||
| awk -F' ' '{print $NF}' | | ||
| tr '[:upper:]' '[:lower:]' | ||
| ) | ||
|
|
||
| if [[ "${GITHUB_REPOSITORY_OWNER}" != "bcgov" ]]; then | ||
| # Never push from forks. | ||
| PUSH_QMS=false | ||
| PUSH_THEQ=false | ||
| elif [[ "${TARGET_NAMESPACE}" == QMS* ]]; then | ||
| PUSH_QMS=true | ||
| PUSH_THEQ=false | ||
| else | ||
| PUSH_QMS=false | ||
| PUSH_THEQ=true | ||
| fi | ||
|
|
||
| echo "Event: ${GITHUB_EVENT_NAME}" | ||
| echo "Target namespace: ${TARGET_NAMESPACE}" | ||
| echo "Environment: ${ENVIRONMENT}" | ||
| echo "Image tag: ${IMAGE_TAG}" | ||
| echo "Git ref: ${REF}" | ||
| echo "Push QMS: ${PUSH_QMS}" | ||
| echo "Push The Q: ${PUSH_THEQ}" | ||
|
|
||
| echo "environment=${ENVIRONMENT}" >> "${GITHUB_OUTPUT}" | ||
| echo "image-tag=${IMAGE_TAG}" >> "${GITHUB_OUTPUT}" | ||
| echo "push-qms=${PUSH_QMS}" >> "${GITHUB_OUTPUT}" | ||
| echo "push-theq=${PUSH_THEQ}" >> "${GITHUB_OUTPUT}" | ||
| echo "ref=${REF}" >> "${GITHUB_OUTPUT}" | ||
|
|
||
| ##### BUILD ################################################################## | ||
|
|
||
| queue-management-api: |
Comment on lines
+88
to
+113
| name: queue-management-api | ||
| needs: | ||
| - parse-inputs | ||
| uses: ./.github/workflows/reusable-build-dockerfile.yaml | ||
| secrets: | ||
| artifactory-password: ${{ secrets.ARTIFACTORY_PASSWORD }} | ||
| artifactory-registry: ${{ secrets.ARTIFACTORY_REGISTRY }} | ||
| artifactory-username: ${{ secrets.ARTIFACTORY_USERNAME }} | ||
| namespace-theq: ${{ secrets.LICENCE_PLATE_THEQ }}-tools | ||
| namespace-theq-password: ${{ secrets.SA_PASSWORD_THEQ_TOOLS }} | ||
| namespace-theq-username: ${{ secrets.SA_USERNAME }} | ||
| namespace-qms: ${{ secrets.LICENCE_PLATE_QMS }}-tools | ||
| namespace-qms-password: ${{ secrets.SA_PASSWORD_QMS_TOOLS }} | ||
| namespace-qms-username: ${{ secrets.SA_USERNAME }} | ||
| openshift-registry: ${{ secrets.OPENSHIFT_REGISTRY }} | ||
| with: | ||
| ref: ${{ needs.parse-inputs.outputs.ref }} | ||
| directory: api | ||
| image-name: queue-management-api | ||
| image-tags: ${{ needs.parse-inputs.outputs.image-tag }} | ||
| push-qms: ${{ needs.parse-inputs.outputs.push-qms == 'true' }} | ||
| push-theq: ${{ needs.parse-inputs.outputs.push-theq == 'true' }} | ||
|
|
||
| ##### DEPLOY ################################################################# | ||
|
|
||
| tag: |
Comment on lines
+114
to
+129
| name: Tag | ||
| if: github.repository_owner == 'bcgov' | ||
| needs: | ||
| - parse-inputs | ||
| - queue-management-api | ||
| uses: ./.github/workflows/reusable-tag-image.yaml | ||
| secrets: | ||
| licence-plate: ${{ needs.parse-inputs.outputs.push-qms == 'true' && secrets.LICENCE_PLATE_QMS || secrets.LICENCE_PLATE_THEQ }} | ||
| openshift-api: ${{ secrets.OPENSHIFT_API }} | ||
| token: ${{ needs.parse-inputs.outputs.push-qms == 'true' && secrets.SA_PASSWORD_QMS_TOOLS || secrets.SA_PASSWORD_THEQ_TOOLS }} | ||
| with: | ||
| image-names: queue-management-api | ||
| tag-from: ${{ needs.parse-inputs.outputs.image-tag }} | ||
| tag-to: ${{ needs.parse-inputs.outputs.environment }} | ||
|
|
||
| wait-for-rollouts: |
Comment on lines
+130
to
+143
| name: Wait for Rollouts | ||
| if: github.repository_owner == 'bcgov' | ||
| needs: | ||
| - parse-inputs | ||
| - tag | ||
| uses: ./.github/workflows/reusable-wait-for-rollouts.yaml | ||
| secrets: | ||
| licence-plate: ${{ needs.parse-inputs.outputs.push-qms == 'true' && secrets.LICENCE_PLATE_QMS || secrets.LICENCE_PLATE_THEQ }} | ||
| openshift-api: ${{ secrets.OPENSHIFT_API }} | ||
| token: ${{ needs.parse-inputs.outputs.push-qms == 'true' && secrets.SA_PASSWORD_QMS_DEV || (needs.parse-inputs.outputs.environment == 'dev' && secrets.SA_PASSWORD_THEQ_DEV || secrets.SA_PASSWORD_THEQ_TEST) }} | ||
| with: | ||
| # Kubernetes Deployment name; do not append "-dev" or "-test". | ||
| image-names: queue-management-api | ||
| tag-to: ${{ needs.parse-inputs.outputs.environment }} |
Comment on lines
+115
to
+125
| name: Wait for Rollouts | ||
| if: github.repository_owner == 'bcgov' | ||
| needs: [parse-inputs, tag] | ||
| uses: ./.github/workflows/reusable-wait-for-rollouts.yaml | ||
| secrets: | ||
| licence-plate: ${{ needs.parse-inputs.outputs.push-qms == 'true' && secrets.LICENCE_PLATE_QMS || secrets.LICENCE_PLATE_THEQ }} | ||
| openshift-api: ${{ secrets.OPENSHIFT_API }} | ||
| token: ${{ needs.parse-inputs.outputs.push-qms == 'true' && secrets.SA_PASSWORD_QMS_DEV || ( needs.parse-inputs.outputs.environment == 'dev' && secrets.SA_PASSWORD_THEQ_DEV || secrets.SA_PASSWORD_THEQ_TEST ) }} | ||
| with: | ||
| image-names: appointment-nginx-frontend-${{ needs.parse-inputs.outputs.environment }} | ||
| tag-to: ${{ needs.parse-inputs.outputs.environment }} |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




adding api pr workflow