Skip to content

Commit

Permalink
Tracking pull request to merge release-1.29.0 to master (#765)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuanfandevops authored Sep 2, 2021
1 parent 9cb610f commit f7acf55
Show file tree
Hide file tree
Showing 189 changed files with 10,215 additions and 33,734 deletions.
3 changes: 3 additions & 0 deletions .pipeline/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const phases = {
purchaseRequestsEnabled: 'true',
notificationsEnabled: 'true',
rolesEnabled: 'true',
creditAgreementsEnabled: 'true',
backendCpuRequest: '300m', backendCpuLimit: '600m', backendMemoryRequest: '1G', backendMemoryLimit: '2G', backendHealthCheckDelay: 30, backendHost: `zeva-backend-dev-${changeId}.${ocpName}.gov.bc.ca`, backendReplicas: 1,
minioCpuRequest: '100m', minioCpuLimit: '200m', minioMemoryRequest: '200M', minioMemoryLimit: '500M', minioPvcSize: '1G',
schemaspyCpuRequest: '50m', schemaspyCpuLimit: '200m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160,
Expand All @@ -52,6 +53,7 @@ const phases = {
purchaseRequestsEnabled: 'false',
notificationsEnabled: 'true',
rolesEnabled: 'false',
creditAgreementsEnabled: 'true',
backendCpuRequest: '100m', backendCpuLimit: '500m', backendMemoryRequest: '500M', backendMemoryLimit: '2G', backendHealthCheckDelay: 30, backendReplicas: 2, backendMinReplicas: 2, backendMaxReplicas: 5, backendHost: `zeva-backend-test.${ocpName}.gov.bc.ca`,
minioCpuRequest: '100m', minioCpuLimit: '300m', minioMemoryRequest: '500M', minioMemoryLimit: '700M', minioPvcSize: '3G',
schemaspyCpuRequest: '20m', schemaspyCpuLimit: '200m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160,
Expand All @@ -73,6 +75,7 @@ const phases = {
purchaseRequestsEnabled: 'false',
notificationsEnabled: 'true',
rolesEnabled: 'false',
creditAgreementsEnabled: 'false',
backendCpuRequest: '200m', backendCpuLimit: '700m', backendMemoryRequest: '1G', backendMemoryLimit: '2G', backendHealthCheckDelay: 30, backendReplicas: 2, backendMinReplicas: 2, backendMaxReplicas: 5, backendHost: `zeva-backend-prod.${ocpName}.gov.bc.ca`,
minioCpuRequest: '100m', minioCpuLimit: '300m', minioMemoryRequest: '500M', minioMemoryLimit: '700M', minioPvcSize: '3G',
schemaspyCpuRequest: '50m', schemaspyCpuLimit: '400m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160,
Expand Down
40 changes: 21 additions & 19 deletions .pipeline/lib/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = settings => {
'KEYCLOAK_REALM': 'rzh2zkjq',
'DJANGO_DEBUG': phases[phase].djangoDebug,
'OCP_NAME': phases[phase].ocpName,
'LOGOUT_HOST_NAME': phases[phase].logoutHostName
'LOGOUT_HOST_NAME': phases[phase].logoutHostName,
}
}))
}
Expand Down Expand Up @@ -91,24 +91,26 @@ module.exports = settings => {
}

// deploy frontend configmap
if(phase === 'dev') {
objects = objects.concat(oc.processDeploymentTemplate(`${templatesLocalBaseUrl}/templates/frontend/frontend-configmap.yaml`, {
'param': {
'NAME': phases[phase].name,
'SUFFIX': phases[phase].suffix,
'COMPLIANCE_REPORT_ENABLED': phases[phase].complianceReportEnabled,
'COMPLIANCE_CALCULATOR_ENABLED': phases[phase].complianceCalculatorEnabled,
'COMPLIANCE_RATIOS_ENABLED': phases[phase].complianceRatiosEnabled,
'CREDIT_TRANSFERS_ENABLED': phases[phase].creditTransfersEnabled,
'CREDIT_TRANSACTIONS_ENABLED': phases[phase].creditTransactionsEnabled,
'INITIATIVE_AGREEMENTS_ENABLED': phases[phase].initiativeAgreementsEnabled,
'MODEL_YEAR_REPORT_ENABLED': phases[phase].modelYearReportEnabled,
'PURCHASE_REQUESTS_ENABLED': phases[phase].purchaseRequestsEnabled,
'NOTIFICATIONS_ENABLED': phases[phase].notificationsEnabled,
'ROLES_ENABLED': phases[phase].rolesEnabled
}
}))
}
//if(phase === 'dev') {
//add CREDIT_AGREEMENTS_ENABLED for release-1.29.0
objects = objects.concat(oc.processDeploymentTemplate(`${templatesLocalBaseUrl}/templates/frontend/frontend-configmap.yaml`, {
'param': {
'NAME': phases[phase].name,
'SUFFIX': phases[phase].suffix,
'COMPLIANCE_REPORT_ENABLED': phases[phase].complianceReportEnabled,
'COMPLIANCE_CALCULATOR_ENABLED': phases[phase].complianceCalculatorEnabled,
'COMPLIANCE_RATIOS_ENABLED': phases[phase].complianceRatiosEnabled,
'CREDIT_TRANSFERS_ENABLED': phases[phase].creditTransfersEnabled,
'CREDIT_TRANSACTIONS_ENABLED': phases[phase].creditTransactionsEnabled,
'INITIATIVE_AGREEMENTS_ENABLED': phases[phase].initiativeAgreementsEnabled,
'MODEL_YEAR_REPORT_ENABLED': phases[phase].modelYearReportEnabled,
'PURCHASE_REQUESTS_ENABLED': phases[phase].purchaseRequestsEnabled,
'NOTIFICATIONS_ENABLED': phases[phase].notificationsEnabled,
'ROLES_ENABLED': phases[phase].rolesEnabled,
'CREDIT_AGREEMENTS_ENABLED': phases[phase].creditAgreementsEnabled
}
}))
//}

// deploy frontend
objects = objects.concat(oc.processDeploymentTemplate(`${templatesLocalBaseUrl}/templates/frontend/frontend-dc.yaml`, {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from django.db import transaction

from api.management.data_script import OperationalDataScript
from api.models.credit_transaction_type import CreditTransactionType


class AddCreditTransactionTypes(OperationalDataScript):
"""
Adds the agreement types
"""
is_revertable = False
comment = 'Adds the credit transfer transaction type'

def check_run_preconditions(self):
return True

@transaction.atomic
def run(self):
CreditTransactionType.objects.get_or_create(
transaction_type='Credit Adjustment Validation'
)
CreditTransactionType.objects.get_or_create(
transaction_type='Credit Adjustment Reduction'
)


script_class = AddCreditTransactionTypes
101 changes: 101 additions & 0 deletions backend/api/fixtures/operational/0033_add_notifications.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
from django.db import transaction

from api.management.data_script import OperationalDataScript
from api.models.notification import Notification
from api.models.permission import Permission
from api.authorities import REQUIRED_AUTHORITIES


class AddNotifications(OperationalDataScript):
"""
Adds the Notifications
"""
is_revertable = False
comment = 'Add the Notifications'

def check_run_preconditions(self):
return True

def add_notifications(self):
Notification.objects.get_or_create(
notification_code='MODEL_YEAR_REPORT_ASSESSED_SUPPLIER',
permission= Permission.objects.get(permission_code='VIEW_BCEID_NOTIFICATIONS'),
defaults={
'name': 'Model Year Report Assessed by the Government of B.C.',
'description': 'when government assess model year report'
}
)
Notification.objects.get_or_create(
notification_code="MODEL_YEAR_REPORT_SUBMITTED",
permission= Permission.objects.get(permission_code="RECOMMEND_COMPLIANCE_REPORT"),
defaults={
'name': 'Model Year Report to Review',
'description': "when supplier submits the report"
}
)
Notification.objects.get_or_create(
notification_code="MODEL_YEAR_REPORT_RETURNED",
permission= Permission.objects.get(permission_code="RECOMMEND_COMPLIANCE_REPORT"),
defaults={
'name': 'Model Year Report Returned by the Director with Comment',
'description': " when director return model year report back to analyst"
}
)
Notification.objects.get_or_create(
notification_code="MODEL_YEAR_REPORT_ASSESSED_GOVT",
permission= Permission.objects.get(permission_code="RECOMMEND_COMPLIANCE_REPORT"),
defaults={
'name': 'Model Year Report Issued by the Director',
'description': "when director issue model year report"
}
)
Notification.objects.get_or_create(
notification_code="MODEL_YEAR_REPORT_RECOMMENDED",
permission= Permission.objects.get(permission_code="SIGN_COMPLIANCE_REPORT"),
defaults={
'name': 'Model Year Report to Assess',
'description': "when analyst recommend model year report to the director"
}
)
Notification.objects.get_or_create(
notification_code='CREDIT_AGREEMENT_ISSUED_SUPPLIER',
permission= Permission.objects.get(permission_code='VIEW_BCEID_NOTIFICATIONS'),
defaults={
'name': 'Initiative or Purchase Agreement Issued by the Government of B.C.',
'description': 'when government issue initiative or purchase agreement'
}
)
Notification.objects.get_or_create(
notification_code="CREDIT_AGREEMENT_RETURNED_WITH_COMMENT",
permission= Permission.objects.get(permission_code="RECOMMEND_INITIATIVE_AGREEMENTS"),
defaults={
'name': 'Credit Adjustment, Agreement or Penalty Returned by the Director with Comment',
'description': "when director return agreement to analyst"
}
)
Notification.objects.get_or_create(
notification_code="CREDIT_AGREEMENT_ISSUED_GOVT",
permission= Permission.objects.get(permission_code="RECOMMEND_INITIATIVE_AGREEMENTS"),
defaults={
'name': 'Credit Adjustment, Agreement or Penalty Issued by the Director',
'description': "when director issue the agreement"
}
)
Notification.objects.get_or_create(
notification_code="CREDIT_AGREEMENT_RECOMMENDED",
permission= Permission.objects.get(permission_code="SIGN_INITIATIVE_AGREEMENTS"),
defaults={
'name': 'Credit Adjustment, Agreement or Penalty to Issue',
'description': "when analyst recommend agreement"
}
)


@transaction.atomic
def run(self):
self.add_notifications()

print('Added Notifications')


script_class = AddNotifications
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from django.db import transaction

from api.management.data_script import OperationalDataScript
from api.models.permission import Permission
from api.models.role import Role
from api.models.role_permission import RolePermission
from api.authorities import REQUIRED_AUTHORITIES


class UpdateRolesPermissions(OperationalDataScript):
"""
Adds the Roles and Permissions
"""
is_revertable = False
comment = 'Updates the permissions for the roles so that they make more ' \
'sense with application.'

def check_run_preconditions(self):
return True

def update_analyst(self):

role = Role.objects.get(
role_code="ZEVA User"
)

permissions_to_be_added = [
'CREATE_COMPLIANCE_REPORTS',
]

for permission_code in permissions_to_be_added:
permission = Permission.objects.get(permission_code=permission_code)
RolePermission.objects.get_or_create(
permission=permission,
role=role
)

@transaction.atomic
def run(self):
self.update_analyst()

print('Updated Permissions')


script_class = UpdateRolesPermissions
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.0.7 on 2021-07-04 22:27

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('api', '0108_modelyearreportcredittransaction'),
]

operations = [
migrations.AddField(
model_name='modelyearreportcomplianceobligation',
name='from_gov',
field=models.BooleanField(default=False),
),
]
33 changes: 33 additions & 0 deletions backend/api/migrations/0110_organizationdeficits.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 3.1.12 on 2021-07-07 18:10

import db_comments.model_mixins
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('api', '0109_modelyearreportcomplianceobligation_from_gov'),
]

operations = [
migrations.CreateModel(
name='OrganizationDeficits',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('create_timestamp', models.DateTimeField(auto_now_add=True, null=True)),
('create_user', models.CharField(default='SYSTEM', max_length=130)),
('update_timestamp', models.DateTimeField(auto_now=True, null=True)),
('update_user', models.CharField(max_length=130, null=True)),
('credit_value', models.DecimalField(decimal_places=2, max_digits=20)),
('credit_class', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='api.creditclass')),
('model_year', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.modelyear')),
('organization', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.organization')),
],
options={
'db_table': 'organization_deficits',
},
bases=(models.Model, db_comments.model_mixins.DBComments),
),
]
Loading

0 comments on commit f7acf55

Please sign in to comment.