Skip to content

Commit bac486b

Browse files
authored
Merge pull request #4409 from GSA-TTS/main
2 parents 332edc7 + f50d9cc commit bac486b

File tree

73 files changed

+1841
-855
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1841
-855
lines changed

.github/workflows/deploy-application.yml

+8
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,11 @@ jobs:
126126
cf_space: ${{ env.space }}
127127
command: cf restart logshipper
128128

129+
check-tables:
130+
needs: [push-with-creds]
131+
uses: ./.github/workflows/fac-check-tables.yml
132+
secrets: inherit
133+
with:
134+
environment: ${{ inputs.environment }}
135+
util_version: "v0.1.8"
136+
backup_operation: "check_tables"

.github/workflows/fac-backup-scheduler.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ jobs:
1919
secrets: inherit
2020
with:
2121
environment: ${{ matrix.environment.name }}
22-
util_version: "v0.1.5"
22+
util_version: "v0.1.8"
2323
backup_operation: "scheduled_backup"
2424

.github/workflows/fac-backup-util-scheduled.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
name: Backup the database with fac-backup-utility
33
### Common Commands:
4-
# ./fac-backup-util.sh v0.1.5 scheduled_backup
5-
# ./fac-backup-util.sh v0.1.5 daily_backup
4+
# ./fac-backup-util.sh v0.1.8 scheduled_backup
5+
# ./fac-backup-util.sh v0.1.8 daily_backup
66
on:
77
workflow_call:
88
inputs:

.github/workflows/fac-backup-util.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
name: Backup the database with fac-backup-utility
33
### Common Commands:
4-
# ./fac-backup-util.sh v0.1.5 initial_backup
5-
# ./fac-backup-util.sh v0.1.5 deploy_backup
4+
# ./fac-backup-util.sh v0.1.8 initial_backup
5+
# ./fac-backup-util.sh v0.1.8 deploy_backup
66
on:
77
workflow_dispatch:
88
inputs:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Check Tables Daily
3+
on:
4+
schedule:
5+
# Invoke every 12 hours
6+
- cron: '0 */12 * * *'
7+
workflow_dispatch: null
8+
9+
jobs:
10+
check-tables:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
environment:
15+
- name: dev
16+
- name: staging
17+
- name: production
18+
- name: preview
19+
uses: ./.github/workflows/fac-check-tables.yml
20+
secrets: inherit
21+
with:
22+
environment: ${{ matrix.environment.name }}
23+
util_version: "v0.1.8"
24+
backup_operation: "check_tables"
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: Check existing tables in an environment
3+
### Common Commands:
4+
# ./fac-backup-util.sh v0.1.8 check_tables
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
environment:
9+
required: true
10+
type: choice
11+
options:
12+
- 'dev'
13+
- 'preview'
14+
- 'staging'
15+
- 'production'
16+
util_version:
17+
description: Version for fac backup utility to use (ex. vX.Y.Z)
18+
required: true
19+
type: string
20+
backup_operation:
21+
description: Operation for fac-backup-utility
22+
required: true
23+
type: choice
24+
options:
25+
- 'check_tables'
26+
workflow_call:
27+
inputs:
28+
environment:
29+
required: true
30+
type: string
31+
util_version:
32+
description: Version for fac backup utility to use (ex. vX.Y.Z)
33+
required: true
34+
type: string
35+
backup_operation:
36+
description: Operation for fac-backup-utility
37+
required: true
38+
type: string
39+
jobs:
40+
fac-check-tables:
41+
name: Check tables in FAC Database
42+
runs-on: ubuntu-latest
43+
environment: ${{ inputs.environment }}
44+
env:
45+
space: ${{ inputs.environment }}
46+
steps:
47+
- name: Check tables in ${{ env.space }}
48+
uses: cloud-gov/cg-cli-tools@main
49+
with:
50+
cf_username: ${{ secrets.CF_USERNAME }}
51+
cf_password: ${{ secrets.CF_PASSWORD }}
52+
cf_org: gsa-tts-oros-fac
53+
cf_space: ${{ env.space }}
54+
command: cf run-task gsa-fac -k 2G -m 3G --name check_tables --command "./fac-backup-util.sh ${{ inputs.util_version }} ${{ inputs.backup_operation }}"

.github/workflows/testing-from-build.yml

+17-4
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,25 @@ jobs:
4747
pwd
4848
ls -al | grep 'coverage'
4949
50-
- name: Coverage Action
50+
- name: Code Coverage Summary Report
51+
uses: irongut/CodeCoverageSummary@v1.3.0
52+
with:
53+
filename: ./coverage.xml
54+
badge: true
55+
fail_below_min: true
56+
format: markdown
57+
hide_branch_rate: false
58+
hide_complexity: true
59+
indicators: true
60+
output: both
61+
thresholds: '85 90'
62+
63+
- name: Add Coverage PR Comment
64+
uses: marocchino/sticky-pull-request-comment@v2
5165
if: github.event_name == 'pull_request'
52-
uses: orgoro/coverage@v3.1
5366
with:
54-
coverageFile: ./coverage.xml
55-
token: ${{ secrets.GITHUB_TOKEN }}
67+
recreate: true
68+
path: code-coverage-results.md
5669

5770
a11y-testing:
5871
runs-on: ubuntu-latest

.github/workflows/testing-from-ghcr.yml

+17-4
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,25 @@ jobs:
4949
pwd
5050
ls -al | grep 'coverage'
5151
52-
- name: Coverage Action
52+
- name: Code Coverage Summary Report
53+
uses: irongut/CodeCoverageSummary@v1.3.0
54+
with:
55+
filename: ./coverage.xml
56+
badge: true
57+
fail_below_min: false
58+
format: markdown
59+
hide_branch_rate: false
60+
hide_complexity: true
61+
indicators: true
62+
output: both
63+
thresholds: '85'
64+
65+
- name: Add Coverage PR Comment
66+
uses: marocchino/sticky-pull-request-comment@v2
5367
if: github.event_name == 'pull_request'
54-
uses: orgoro/coverage@v3.1
5568
with:
56-
coverageFile: ./coverage.xml
57-
token: ${{ secrets.GITHUB_TOKEN }}
69+
recreate: true
70+
path: code-coverage-results.md
5871

5972
a11y-testing:
6073
runs-on: ubuntu-latest

.github/workflows/trivy.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
run: docker build -t ${{ env.DOCKER_NAME }}:${{ steps.date.outputs.date }} .
4040

4141
- name: Run Trivy vulnerability scanner
42-
uses: aquasecurity/trivy-action@0.27.0
42+
uses: aquasecurity/trivy-action@0.28.0
4343
with:
4444
image-ref: '${{ env.DOCKER_NAME }}:${{ steps.date.outputs.date }}'
4545
scan-type: 'image'
@@ -74,7 +74,7 @@ jobs:
7474
run: docker pull ${{ matrix.image.name }}
7575

7676
- name: Run Trivy vulnerability scanner on Third Party Images
77-
uses: aquasecurity/trivy-action@0.27.0
77+
uses: aquasecurity/trivy-action@0.28.0
7878
with:
7979
image-ref: '${{ matrix.image.name }}'
8080
scan-type: 'image'

.github/workflows/zap-scan.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: actions/checkout@v4
1919

2020
- name: ZAP Scan of ${{ env.url }}
21-
uses: zaproxy/action-baseline@v0.12.0
21+
uses: zaproxy/action-baseline@v0.13.0
2222
with:
2323
token: ${{ secrets.GITHUB_TOKEN }}
2424
docker_name: 'ghcr.io/zaproxy/zaproxy:stable'

backend/audit/intake_to_dissemination.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,14 @@ def load_passthrough(self):
246246
self.loaded_objects["Passthroughs"] = pass_objects
247247
return pass_objects
248248

249-
def _get_dates_from_sac(self):
249+
def _get_first_date_by_status_from_sac(self, status):
250+
sac = self.single_audit_checklist
251+
for i in range(len(sac.transition_name)):
252+
if sac.transition_name[i] == status:
253+
return sac.transition_date[i]
254+
raise ValueError("This SAC does not have the requested status.")
255+
256+
def _get_most_recent_dates_from_sac(self):
250257
return_dict = dict()
251258
sac = self.single_audit_checklist
252259
for status_choice in sac.STATUS_CHOICES:
@@ -283,12 +290,12 @@ def load_general(self):
283290
cognizant_agency = self.single_audit_checklist.cognizant_agency
284291
oversight_agency = self.single_audit_checklist.oversight_agency
285292

286-
dates_by_status = self._get_dates_from_sac()
293+
dates_by_status = self._get_most_recent_dates_from_sac()
287294
status = self.single_audit_checklist.get_statuses()
288295
ready_for_certification_date = dates_by_status[status.READY_FOR_CERTIFICATION]
289296
if self.mode == IntakeToDissemination.DISSEMINATION:
290297
submitted_date = self._convert_utc_to_american_samoa_zone(
291-
dates_by_status[status.SUBMITTED]
298+
self._get_first_date_by_status_from_sac(status.SUBMITTED)
292299
)
293300
fac_accepted_date = submitted_date
294301
auditee_certify_name = auditee_certification["auditee_signature"][

backend/audit/intakelib/checks/runners.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from django.core.exceptions import ValidationError
22
import logging
33

4-
from .check_finding_uniqueness import check_finding_uniqueness
4+
# from .check_finding_uniqueness import check_finding_uniqueness
55
from census_historical_migration.invalid_record import InvalidRecord
66

77
from .check_finding_award_references_pattern import award_references_pattern
@@ -113,7 +113,8 @@
113113
finding_reference_pattern,
114114
no_repeat_findings,
115115
findings_grid_validation,
116-
check_finding_uniqueness,
116+
# See ticket #4385 for more information on why this check is disabled
117+
# check_finding_uniqueness,
117118
]
118119

119120
additional_eins_checks = general_checks + [
@@ -158,7 +159,8 @@
158159
require_gsa_migration_flag = [
159160
findings_grid_validation,
160161
finding_reference_pattern,
161-
check_finding_uniqueness,
162+
# See ticket #4385 for more information on why this check is disabled
163+
# check_finding_uniqueness,
162164
]
163165

164166

backend/audit/intakelib/constants.py

+1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
FEDERAL_AGENCY_PREFIX = "federal_agency_prefix"
1010
THREE_DIGIT_EXTENSION = "three_digit_extension"
1111
SECTION_NAME = "section_name"
12+
VERSION = "version"
1213
XLSX_TEMPLATE_DEFINITION_DIR = settings.XLSX_TEMPLATE_JSON_DIR

backend/audit/intakelib/mapping_meta.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from .constants import (
22
SECTION_NAME,
3+
VERSION,
34
)
45

56
from .mapping_util import (
@@ -9,4 +10,5 @@
910

1011
meta_mapping: FieldMapping = {
1112
SECTION_NAME: (f"Meta.{SECTION_NAME}", _set_by_path),
13+
VERSION: (f"Meta.{VERSION}", _set_by_path),
1214
}

backend/audit/intakelib/transforms/runners.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import logging
22
from copy import deepcopy
33

4+
from .xform_clean_version_value import remove_equals_and_quotes
5+
46
from .xform_resize_award_references import resize_award_reference
57

68
from .xform_all_amount_expended_need_to_be_integers import (
@@ -93,6 +95,7 @@ def run_all_secondary_auditors_transforms(ir):
9395

9496
general_transforms = [
9597
convert_to_stripped_string,
98+
remove_equals_and_quotes,
9699
]
97100

98101
notes_to_sefa_transforms = general_transforms + [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import logging
2+
from audit.intakelib.intermediate_representation import (
3+
get_range_by_name,
4+
replace_range_by_name,
5+
)
6+
7+
logger = logging.getLogger(__name__)
8+
9+
10+
def remove_equals_and_quotes(ir):
11+
versions = get_range_by_name(ir, "version")
12+
new_values = list(
13+
map(
14+
lambda v: v.replace("=", "").replace('"', "") if v else v,
15+
versions["values"],
16+
)
17+
)
18+
new_ir = replace_range_by_name(ir, "version", new_values)
19+
20+
return new_ir

0 commit comments

Comments
 (0)