Skip to content

Commit

Permalink
Tracking pull request to merge release-1.20.0 to master - Sprint 30 (…
Browse files Browse the repository at this point in the history
…Darwin) (#557)
  • Loading branch information
kuanfandevops authored Feb 24, 2021
1 parent 3013109 commit 3f5441c
Show file tree
Hide file tree
Showing 91 changed files with 33,565 additions and 496 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ db.sqlite3
.coverage
frontend/coverage/
backend/minio/
.sql.gz
33 changes: 30 additions & 3 deletions .pipeline/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,16 @@ const phases = {
instance: `${name}-dev-${changeId}` , version:`${version}-${changeId}`, tag:`dev-${version}-${changeId}`,
host: `zeva-dev-${changeId}.${ocpName}.gov.bc.ca`, djangoDebug: 'True', logoutHostName: 'logontest.gov.bc.ca',
frontendCpuRequest: '100m', frontendCpuLimit: '700m', frontendMemoryRequest: '300M', frontendMemoryLimit: '4G', frontendReplicas: 1,
creditTransfersEnabled: 'true', creditTransactionsEnabled: 'true', initiativeAgreementsEnabled: 'true', modelYearReportEnabled: 'true', purchaseRequestsEnabled: 'true', notificationsEnabled: 'true', complianceReportEnabled: 'true', rolesEnabled: 'true',
complianceReportEnabled: 'true',
complianceCalculatorEnabled: 'true',
complianceRatiosEnabled: 'true',
creditTransfersEnabled: 'true',
creditTransactionsEnabled: 'true',
initiativeAgreementsEnabled: 'true',
modelYearReportEnabled: 'true',
purchaseRequestsEnabled: 'true',
notificationsEnabled: 'true',
rolesEnabled: '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 @@ -33,7 +42,16 @@ const phases = {
instance: `${name}-test`, version:`${version}`, tag:`test-${version}`,
host: `zeva-test.${ocpName}.gov.bc.ca`, djangoDebug: 'False', logoutHostName: 'logontest.gov.bc.ca',
frontendCpuRequest: '300m', frontendCpuLimit: '600m', frontendMemoryRequest: '500M', frontendMemoryLimit: '1G', frontendReplicas: 2, frontendMinReplicas: 2, frontendMaxReplicas: 5,
creditTransfersEnabled: 'true', creditTransactionsEnabled: 'true', initiativeAgreementsEnabled: 'false', modelYearReportEnabled: 'false', purchaseRequestsEnabled: 'false', notificationsEnabled: 'true', complianceReportEnabled: 'true', rolesEnabled: 'false',
complianceReportEnabled: 'true',
complianceCalculatorEnabled: 'true',
complianceRatiosEnabled: 'true',
creditTransfersEnabled: 'true',
creditTransactionsEnabled: 'true',
initiativeAgreementsEnabled: 'false',
modelYearReportEnabled: 'true',
purchaseRequestsEnabled: 'false',
notificationsEnabled: 'true',
rolesEnabled: 'false',
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 @@ -45,7 +63,16 @@ const phases = {
instance: `${name}-prod`, version:`${version}`, tag:`prod-${version}`,
host: 'zeroemissionvehicles.gov.bc.ca', djangoDebug: 'False', logoutHostName: 'logon7.gov.bc.ca',
frontendCpuRequest: '300m', frontendCpuLimit: '600m', frontendMemoryRequest: '1G', frontendMemoryLimit: '2G', frontendReplicas: 2, frontendMinReplicas: 2, frontendMaxReplicas: 5,
creditTransfersEnabled: 'true', creditTransactionsEnabled: 'true', initiativeAgreementsEnabled: 'false', modelYearReportEnabled: 'false', purchaseRequestsEnabled: 'false', notificationsEnabled: 'false', complianceReportEnabled: 'false', rolesEnabled: 'false',
complianceReportEnabled: 'false',
complianceCalculatorEnabled: 'false',
complianceRatiosEnabled: 'false',
creditTransfersEnabled: 'true',
creditTransactionsEnabled: 'true',
initiativeAgreementsEnabled: 'false',
modelYearReportEnabled: 'false',
purchaseRequestsEnabled: 'false',
notificationsEnabled: 'true',
rolesEnabled: '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
34 changes: 18 additions & 16 deletions .pipeline/lib/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,23 +133,25 @@ module.exports = settings => {
}))
*/

if(phase === 'dev') {
//if(phase === 'dev') {
// deploy frontend configmap
objects = objects.concat(oc.processDeploymentTemplate(`${templatesLocalBaseUrl}/templates/frontend/frontend-configmap.yaml`, {
'param': {
'NAME': phases[phase].name,
'SUFFIX': phases[phase].suffix,
'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,
'COMPLIANCE_REPORT_ENABLED': phases[phase].complianceReportEnabled,
'ROLES_ENABLED': phases[phase].rolesEnabled
}
}))
}
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
}
}))
//}

// deploy frontend
objects = objects.concat(oc.processDeploymentTemplate(`${templatesLocalBaseUrl}/templates/frontend/frontend-dc.yaml`, {
Expand Down
24 changes: 24 additions & 0 deletions backend/api/fixtures/operational/0020_update_credit_classes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from django.db import transaction

from api.management.data_script import OperationalDataScript
from api.models.credit_class import CreditClass


class UpdateCreditClasses(OperationalDataScript):
is_revertable = False
comment = 'Updates the credit classes'

def check_run_preconditions(self):
return True

@transaction.atomic
def run(self):
CreditClass.objects.get_or_create(
credit_class='C',
defaults={
'effective_date': "2018-01-01"
}
)


script_class = UpdateCreditClasses
37 changes: 37 additions & 0 deletions backend/api/fixtures/operational/0021_update_model_year.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from django.db import transaction

from api.management.data_script import OperationalDataScript
from api.models.model_year import ModelYear


class UpdateModelYear(OperationalDataScript):
"""
Add 2017-2018 model years
"""
is_revertable = False
comment = 'Add 2017-2018 model years'

def check_run_preconditions(self):
to_check = ["2017,2018"]
for year in to_check:
if ModelYear.objects.filter(name=year).exists():
return False
return True

@transaction.atomic
def run(self):
ModelYear.objects.create(
effective_date="2017-01-01",
expiration_date="2017-12-31",
name="2017"
)

ModelYear.objects.create(
effective_date="2018-01-01",
expiration_date="2018-12-31",
name="2018"
)



script_class = UpdateModelYear
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Generated by Django 3.0.7 on 2021-02-10 20:45

import api.models.model_year_report_statuses
import db_comments.model_mixins
from django.db import migrations, models
import django.db.models.deletion
import enumfields.fields


class Migration(migrations.Migration):

dependencies = [
('api', '0089_auto_20210203_1044'),
]

operations = [
migrations.CreateModel(
name='ModelYearReport',
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)),
('organization_name', models.CharField(max_length=500)),
('supplier_class', models.CharField(max_length=1)),
('validation_status', enumfields.fields.EnumField(default='DRAFT', enum=api.models.model_year_report_statuses.ModelYearReportStatuses, max_length=20)),
('model_year', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.ModelYear')),
],
options={
'db_table': 'model_year_report',
},
bases=(models.Model, db_comments.model_mixins.DBComments),
),
migrations.CreateModel(
name='ModelYearReportMake',
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)),
('make', models.CharField(max_length=250)),
('model_year_report', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='model_year_report_makes', to='api.ModelYearReport')),
],
options={
'db_table': 'model_year_report_make',
},
bases=(models.Model, db_comments.model_mixins.DBComments),
),
migrations.CreateModel(
name='ModelYearReportHistory',
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)),
('validation_status', enumfields.fields.EnumField(default='DRAFT', enum=api.models.model_year_report_statuses.ModelYearReportStatuses, max_length=20)),
('model_year_report', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='model_year_report_history', to='api.ModelYearReport')),
],
options={
'db_table': 'model_year_report_history',
},
bases=(models.Model, db_comments.model_mixins.DBComments),
),
migrations.CreateModel(
name='ModelYearReportConfirmation',
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)),
('has_accepted', models.BooleanField()),
('title', models.CharField(blank=True, max_length=100, null=True)),
('model_year_report', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='model_year_report_confirmations', to='api.ModelYearReport')),
('signing_authority_assertion', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='model_year_report_confirmations', to='api.SigningAuthorityAssertion')),
],
options={
'db_table': 'model_year_report_confirmation',
},
bases=(models.Model, db_comments.model_mixins.DBComments),
),
]
41 changes: 41 additions & 0 deletions backend/api/migrations/0091_modelyearreportaddress.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Generated by Django 3.0.7 on 2021-02-10 23:12

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


class Migration(migrations.Migration):

dependencies = [
('api', '0090_modelyearreport_modelyearreportconfirmation_modelyearreporthistory_modelyearreportmake'),
]

operations = [
migrations.CreateModel(
name='ModelYearReportAddress',
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)),
('representative_name', models.CharField(blank=True, max_length=100, null=True)),
('address_line_1', models.CharField(blank=True, max_length=500, null=True)),
('address_line_2', models.CharField(blank=True, max_length=100, null=True)),
('address_line_3', models.CharField(blank=True, max_length=100, null=True)),
('city', models.CharField(blank=True, max_length=100, null=True)),
('postal_code', models.CharField(blank=True, max_length=10, null=True)),
('state', models.CharField(blank=True, max_length=50, null=True)),
('county', models.CharField(blank=True, max_length=50, null=True)),
('country', models.CharField(blank=True, max_length=100, null=True)),
('other', models.CharField(blank=True, max_length=100, null=True)),
('address_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='api.AddressType')),
('model_year_report', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='model_year_report_addresses', to='api.ModelYearReport')),
],
options={
'db_table': 'model_year_report_address',
},
bases=(models.Model, db_comments.model_mixins.DBComments),
),
]
59 changes: 59 additions & 0 deletions backend/api/migrations/0092_auto_20210210_1357.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Generated by Django 3.0.7 on 2021-02-10 21:57

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


class Migration(migrations.Migration):

dependencies = [
('api', '0091_modelyearreportaddress'),
]

operations = [
migrations.AddField(
model_name='modelyearreport',
name='ldv_sales',
field=models.DecimalField(decimal_places=2, max_digits=20, null=True),
),
migrations.CreateModel(
name='ModelYearReportVehicle',
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)),
('pending_sales', models.IntegerField()),
('sales_issued', models.IntegerField()),
('make', models.CharField(max_length=250)),
('model', models.CharField(max_length=250)),
('range', models.DecimalField(decimal_places=2, max_digits=20)),
('model_year', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.ModelYear')),
('zev_class', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.VehicleClass')),
('zev_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.ZevType')),
],
options={
'db_table': 'model_year_report_vehicle',
},
bases=(models.Model, db_comments.model_mixins.DBComments),
),
migrations.CreateModel(
name='ModelYearReportPreviousSales',
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)),
('previous_sales', models.DecimalField(decimal_places=2, max_digits=20)),
('model_year', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.ModelYear')),
('model_year_report', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.ModelYearReport')),
],
options={
'db_table': 'model_year_report_previous_sales',
},
bases=(models.Model, db_comments.model_mixins.DBComments),
),
]
20 changes: 20 additions & 0 deletions backend/api/migrations/0093_modelyearreport_organization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 3.0.7 on 2021-02-16 21:29

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


class Migration(migrations.Migration):

dependencies = [
('api', '0092_auto_20210210_1357'),
]

operations = [
migrations.AddField(
model_name='modelyearreport',
name='organization',
field=models.ForeignKey(default=0, on_delete=django.db.models.deletion.PROTECT, to='api.Organization'),
preserve_default=False,
),
]
Loading

0 comments on commit 3f5441c

Please sign in to comment.