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

DESENG-493: CRON config alignment and engagement metadata dependency removal #2375

Merged
merged 11 commits into from
Feb 6, 2024

Conversation

VineetBala-AOT
Copy link
Collaborator

Issue #: https://apps.itsm.gov.bc.ca/jira/browse/DESENG-493

Description of changes:

  • Aligned the CRON configuration and sample environment files with the structure used in the Met API.
  • Eliminated the reliance on engagement metadata within cron jobs, improving their independence.
  • Implemented necessary code adjustments to seamlessly integrate with the updated CRON configuration.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the met-public license (Apache 2.0).

@VineetBala-AOT VineetBala-AOT marked this pull request as ready for review February 6, 2024 17:17
Copy link
Collaborator

@Baelx Baelx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

Could you please just remove a commented-out environment variable that appears to be duplicated. Also, I feel some comments could be a bit clearer for developers. Could you please respond to my questions about certain comments?

@@ -295,7 +295,7 @@ def _render_email_template(engagement: EngagementModel):
engagement_url = notification.get_tenant_site_url(engagement.tenant_id, dashboard_path)
templates = current_app.config['EMAIL_TEMPLATES']
subject = templates['CLOSEOUT']['SUBJECT'].format(engagement_name=engagement.name)
email_environment = templates['ENVIROMENT']
email_environment = templates['ENVIRONMENT']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!


# Miscellaneous Settings
SECRET_KEY="" # For Flask sessions. If unset, this value is randomized
# disables certain checks for user permissions and tenant access. Buggy.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this comment mean that when you disable certain checks for user permissions and tenant access that unexpected behaviour may occur? Why would a developer want to disable those checks in the first place?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this comment as it's not applicable to our scenario. The checks in this case are associated with the tenant. In a multi-tenant environment like ours, we verify if this variable is set to false. In such cases, we interpret the application as multi-tenant, and consequently, we assess user access to a specific tenant to restrict engagement access within that tenant. Conversely, if this variable is set to true, we consider it a single-tenant environment, eliminating the need to check user tenant access.

JWT_OIDC_WELL_KNOWN_CONFIG="" # default: constructed from issuer
JWT_OIDC_JWKS_URI="" # default: constructed from issuer
# Object path to access roles from JWT token
# JWT_OIDC_ROLE_CLAIM=realm_access.roles # SSO schema
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this commented-out line if it's not being used

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed it, thanks.

EMAIL_ENVIRONMENT=
EMAIL_FROM_ADDRESS="[email protected]"
# Email Template Configuration
# Subject lines have a reasonable default value
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain this comment a little bit more please?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I revised the comment to enhance clarity.

DATABASE_TEST_PORT=

# A keycloak server is started automatically by Pytest; there is no need to start your own instance.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this comment!

project_name = None
if metadata_model and 'project_name' in metadata_model.project_metadata:
project_name = metadata_model.project_metadata.get('project_name')
# TODO should be re-visited once the engagement metadata functionality of completed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the TODO comments. This is exactly what we want to see when we're commenting out code

@codecov-commenter
Copy link

codecov-commenter commented Feb 6, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (c16efb8) 72.22% compared to head (0f9a527) 72.21%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2375      +/-   ##
==========================================
- Coverage   72.22%   72.21%   -0.02%     
==========================================
  Files         509      509              
  Lines       17129    17130       +1     
  Branches     1288     1288              
==========================================
- Hits        12372    12370       -2     
- Misses       4517     4520       +3     
  Partials      240      240              
Flag Coverage Δ
metapi 86.89% <80.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
met-api/src/met_api/config.py 97.26% <ø> (ø)
met-api/src/met_api/utils/notification.py 65.51% <100.00%> (+1.23%) ⬆️
met-api/src/met_api/utils/user_context.py 85.07% <100.00%> (ø)
met-api/src/met_api/services/engagement_service.py 72.13% <0.00%> (ø)

... and 2 files with indirect coverage changes

Copy link

sonarqubecloud bot commented Feb 6, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@VineetBala-AOT VineetBala-AOT requested a review from Baelx February 6, 2024 19:21
@VineetBala-AOT VineetBala-AOT merged commit 16d4f32 into bcgov:main Feb 6, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants