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

06/26/2024 Production Deploy #1120

Merged
merged 169 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
c3a20ec
add some debug around report generation
May 14, 2024
a274aae
fix invite text
May 15, 2024
e7c6853
fix flake 8
May 15, 2024
a749b8c
bring coverage back up to 95%
May 15, 2024
71931a5
add omission of migrations to checks.yml
May 15, 2024
6f420c3
Create codeql.yml
terrazoon May 21, 2024
752a13f
replace utcnow with timezone naive utc call
May 23, 2024
905df17
remove datetime.utcnow()
May 23, 2024
07650e3
remove datetime.utcnow()
May 23, 2024
362b2ad
merge from main
May 24, 2024
f1206a7
update
May 24, 2024
7f852ac
merge from main
May 24, 2024
4aba47e
merge from main again
May 24, 2024
22ffc56
remove v2
May 30, 2024
85fecf2
Bump botocore from 1.34.115 to 1.34.116
dependabot[bot] May 30, 2024
0d3a0c5
Merge pull request #1038 from GSA/dependabot/pip/botocore-1.34.116
ccostino May 31, 2024
d42de15
Bump moto from 5.0.8 to 5.0.9
dependabot[bot] May 31, 2024
543a20f
Merge pull request #987 from GSA/pr_debug_reports
ccostino May 31, 2024
37691ff
Merge pull request #1039 from GSA/dependabot/pip/moto-5.0.9
ccostino May 31, 2024
25df0e2
Merge pull request #1018 from GSA/terrazoon-patch-1
ccostino May 31, 2024
826f178
Bump boto3 from 1.34.114 to 1.34.116
dependabot[bot] May 31, 2024
638b068
Merge pull request #1041 from GSA/dependabot/pip/boto3-1.34.116
ccostino May 31, 2024
bce5220
merge from main
May 31, 2024
f74d08a
merge from main
May 31, 2024
a555bd4
Merge pull request #1022 from GSA/notify-api-951
ccostino May 31, 2024
a3ef6de
Merge pull request #992 from GSA/notify-admin-1396
ccostino May 31, 2024
67392e6
Merge pull request #993 from GSA/notify-api-843
ccostino May 31, 2024
7aa6f62
Fix debug statement
ccostino May 31, 2024
e792f89
Merge pull request #1042 from GSA/fix-debug-statement
ccostino May 31, 2024
3d7cd91
Bump botocore from 1.34.116 to 1.34.117
dependabot[bot] May 31, 2024
fb87433
Merge pull request #1043 from GSA/dependabot/pip/botocore-1.34.117
ccostino May 31, 2024
cf5661f
Add my recent experience to Troubleshooting part of README
jskinne3 Jun 1, 2024
495e15d
Merge pull request #1045 from GSA/jskinne3-SSB-error-to-README
ccostino Jun 3, 2024
fbf0f33
Upgrade terraform-cloudgov to v1.0.0, remove recursive_delete params
jskinne3 Jun 3, 2024
a1a312f
Avoid redirect by updating module path name
jskinne3 Jun 3, 2024
26d0d69
Making the test come back good.
xlorepdarkhelm Jun 4, 2024
db68583
merge from main
Jun 4, 2024
0429a54
merge from main
Jun 4, 2024
952c04a
Making things cleaner with set operators.
xlorepdarkhelm Jun 4, 2024
77f4d85
Cleaning up the test a little.
xlorepdarkhelm Jun 4, 2024
66751a8
Merge pull request #1054 from GSA/api-1044_Test_Bug
ccostino Jun 4, 2024
59da7e4
Merge branch 'main' into jskinne3-terraform-cloudgov-1.0.0
jskinne3 Jun 4, 2024
18abaa3
Bump certifi from 2024.2.2 to 2024.6.2
dependabot[bot] Jun 4, 2024
403c581
Merge pull request #1052 from GSA/jskinne3-terraform-cloudgov-1.0.0
ccostino Jun 4, 2024
cb66eae
Merge pull request #1048 from GSA/dependabot/pip/certifi-2024.6.2
ccostino Jun 5, 2024
da38f8a
Bump botocore from 1.34.117 to 1.34.119
dependabot[bot] Jun 5, 2024
3430380
Merge pull request #1055 from GSA/dependabot/pip/botocore-1.34.119
ccostino Jun 5, 2024
b843ef9
Bump faker from 25.3.0 to 25.5.0
dependabot[bot] Jun 5, 2024
8544a29
Merge pull request #1056 from GSA/dependabot/pip/faker-25.5.0
ccostino Jun 5, 2024
3a06b1d
Bump boto3 from 1.34.116 to 1.34.119
dependabot[bot] Jun 5, 2024
c138fbd
Merge pull request #1057 from GSA/dependabot/pip/boto3-1.34.119
ccostino Jun 5, 2024
920d2c4
debug for notify-admin-1588
Jun 5, 2024
57d97e1
Bump cryptography from 42.0.7 to 42.0.8
dependabot[bot] Jun 5, 2024
1dbdebe
Merge pull request #1060 from GSA/notify-admin-1588
ccostino Jun 6, 2024
85be706
Merge pull request #1061 from GSA/dependabot/pip/cryptography-42.0.8
ccostino Jun 6, 2024
7103f88
Bump phonenumbers from 8.13.37 to 8.13.38
dependabot[bot] Jun 6, 2024
9fad307
Merge pull request #1062 from GSA/dependabot/pip/phonenumbers-8.13.38
ccostino Jun 6, 2024
074d010
Bump pytest from 8.2.1 to 8.2.2
dependabot[bot] Jun 6, 2024
4df2368
Merge pull request #1063 from GSA/dependabot/pip/pytest-8.2.2
ccostino Jun 6, 2024
cf9ccd4
Bump botocore from 1.34.119 to 1.34.120
dependabot[bot] Jun 6, 2024
065d2db
Merge pull request #1064 from GSA/dependabot/pip/botocore-1.34.120
ccostino Jun 6, 2024
aed0b7b
lets make the 7 day cache work properly
Jun 6, 2024
feb8a1b
merge from main
Jun 6, 2024
6081ff4
merge from main
Jun 6, 2024
66eef3b
Merge pull request #1066 from GSA/fix_cache
ccostino Jun 6, 2024
22e5641
Bump marshmallow from 3.21.2 to 3.21.3
dependabot[bot] Jun 6, 2024
563b8de
Add a null_resource with prevent_destroy to Sandbox
jskinne3 Jun 8, 2024
a9c42b5
Merge pull request #1068 from GSA/dependabot/pip/marshmallow-3.21.3
ccostino Jun 8, 2024
4631dd3
Bump redis from 5.0.4 to 5.0.5
dependabot[bot] Jun 8, 2024
0f1d2ef
Merge pull request #1069 from GSA/dependabot/pip/redis-5.0.5
ccostino Jun 8, 2024
30b1934
Bump boto3 from 1.34.119 to 1.34.120
dependabot[bot] Jun 8, 2024
6b0a8a7
Merge pull request #1070 from GSA/dependabot/pip/boto3-1.34.120
ccostino Jun 8, 2024
0176f89
Bump faker from 25.5.0 to 25.8.0
dependabot[bot] Jun 8, 2024
bb6b093
Merge pull request #1071 from GSA/dependabot/pip/faker-25.8.0
ccostino Jun 8, 2024
2a6b69a
Upgrade terraform-cloudgov, remove recursive_delete, add prevent_destroy
jskinne3 Jun 10, 2024
a580368
Terraform fmt
jskinne3 Jun 10, 2024
76c34ff
Need magic PII-free debugging method for API
Jun 11, 2024
bfae1f5
hmmm
Jun 11, 2024
d1ab771
hmmm
Jun 11, 2024
2a00507
fix bug where only exception is passed to logger
Jun 12, 2024
1c69720
improve email masking
Jun 13, 2024
b65239a
Bump botocore from 1.34.120 to 1.34.126
dependabot[bot] Jun 13, 2024
3a0e0d6
Merge pull request #1079 from GSA/dependabot/pip/botocore-1.34.126
ccostino Jun 14, 2024
b3a22cd
Bump redis from 5.0.5 to 5.0.6
dependabot[bot] Jun 14, 2024
fdedd53
Merge pull request #1080 from GSA/dependabot/pip/redis-5.0.6
ccostino Jun 14, 2024
4b945e7
Bump packaging from 24.0 to 24.1
dependabot[bot] Jun 14, 2024
510c226
Merge pull request #1074 from GSA/dependabot/pip/packaging-24.1
ccostino Jun 14, 2024
8693205
Bump bandit from 1.7.8 to 1.7.9
dependabot[bot] Jun 14, 2024
357011f
Merge pull request #1081 from GSA/dependabot/pip/bandit-1.7.9
ccostino Jun 14, 2024
52516f4
Merge pull request #1072 from GSA/jskinne3-null-resource-prevent-destroy
ccostino Jun 14, 2024
6a9f2d3
code review feedback
Jun 14, 2024
320e560
merge from main
Jun 14, 2024
9a146bd
flake8
Jun 14, 2024
0867cd9
Merge pull request #1037 from GSA/notify-api-838
ccostino Jun 14, 2024
0e1aa2f
Proposal for how we create a service instance to upgrade
jskinne3 Jun 15, 2024
d7279c7
revamp PII masking
Jun 17, 2024
5961588
Bump urllib3 from 2.2.1 to 2.2.2
dependabot[bot] Jun 17, 2024
decbd25
Upgrade terraform-cloudgov, add prevent_destroy
jskinne3 Jun 18, 2024
b2b7134
Merge pull request #1087 from GSA/dependabot/pip/urllib3-2.2.2
ccostino Jun 18, 2024
e7c5e75
Bump botocore from 1.34.126 to 1.34.128
dependabot[bot] Jun 18, 2024
651a28d
Merge pull request #1088 from GSA/dependabot/pip/botocore-1.34.128
ccostino Jun 18, 2024
a6df136
Bump boto3 from 1.34.120 to 1.34.128
dependabot[bot] Jun 18, 2024
75cce3b
Merge pull request #1090 from GSA/dependabot/pip/boto3-1.34.128
ccostino Jun 18, 2024
8515c9d
Bump newrelic from 9.10.0 to 9.11.0
dependabot[bot] Jun 18, 2024
61cffcc
Merge pull request #1082 from GSA/dependabot/pip/newrelic-9.11.0
ccostino Jun 18, 2024
3be8e20
Merge pull request #1086 from GSA/jskinne3-redis-upgrade-sandbox
ccostino Jun 18, 2024
a75bc67
Add Redis v7.0 module, terraform-cloudgov v1.0.0
jskinne3 Jun 18, 2024
e52f44a
Comment explaining resource to delete
jskinne3 Jun 18, 2024
833ebfa
Merge pull request #1091 from GSA/jskinne3-redis-upgrade-demo
ccostino Jun 18, 2024
7929b75
Merge branch 'main' into jskinne3-upgrade-and-protect-demo-modules
jskinne3 Jun 18, 2024
96fc71a
Bump phonenumbers from 8.13.38 to 8.13.39
dependabot[bot] Jun 18, 2024
560304e
Merge branch 'main' into jskinne3-upgrade-and-protect-bootstrap-env
jskinne3 Jun 18, 2024
be000ba
Upgrade terraform-cloudgov, remove recursive_delete, add prevent_destroy
jskinne3 Jun 18, 2024
c57bdc2
Make value of prevent_destroy match recursive_delete
jskinne3 Jun 18, 2024
d84a199
Typo
jskinne3 Jun 18, 2024
5d592f1
Upgrade terraform-cloudgov, remove recursive_delete, add prevent_destroy
jskinne3 Jun 19, 2024
76cc718
Remove recursive_delete from SNS & SES shared modules
jskinne3 Jun 19, 2024
fde4c47
Terraform format the SNS and SES modules
jskinne3 Jun 19, 2024
6449c13
Running fmt to create a tf plan output file to make PR pass
jskinne3 Jun 19, 2024
c10e232
Merge pull request #1093 from GSA/dependabot/pip/phonenumbers-8.13.39
ccostino Jun 20, 2024
6ac5be1
Add Redis v7.0 module, terraform-cloudgov v1.0.0 to Staging space
jskinne3 Jun 20, 2024
8e23a6c
Same in Production space
jskinne3 Jun 20, 2024
573b147
pin python to 3.12.2
Jun 20, 2024
11e9172
Merge pull request #1105 from GSA/pin_python_to_3_12_2
ccostino Jun 20, 2024
e0ba917
Merge branch 'main' into jskinne3-redis-upgrade-1-higher-envs
jskinne3 Jun 20, 2024
c9b39a8
Fix runtime.txt for cloud.gov and Python
ccostino Jun 20, 2024
360d4f2
fix raw_set and raw_get
Jun 20, 2024
0385e6a
pin python to 3.12.3
Jun 20, 2024
5b39b77
move github to 3.12.3
Jun 20, 2024
2e4fd3b
fix tests
Jun 20, 2024
03fce75
Merge pull request #1106 from GSA/fix-python-runtime
ccostino Jun 20, 2024
1c64c80
Update runtime.txt to match Python 3.12.3 for the cloud.gov python bu…
ccostino Jun 20, 2024
7df242c
Merge branch 'main' into pin_python_to_3_12_2
ccostino Jun 20, 2024
398eb22
Merge pull request #1108 from GSA/pin_python_to_3_12_2
ccostino Jun 20, 2024
83f5482
Merge pull request #1073 from GSA/jskinne3-upgrade-and-protect-demo-m…
ccostino Jun 21, 2024
e0f3208
merge from main
Jun 21, 2024
750d43d
Bump sqlalchemy from 2.0.30 to 2.0.31
dependabot[bot] Jun 21, 2024
b8ee933
Merge branch 'main' into jskinne3-remove-deprecated-from-shared-module
jskinne3 Jun 21, 2024
58cd48f
Merge pull request #1107 from GSA/fix_raw_set_and_get
ccostino Jun 24, 2024
530e437
Increased production memory to 2 GB
ccostino Jun 24, 2024
72a67b7
Merge pull request #1111 from GSA/increase-prod-memory
ccostino Jun 24, 2024
c5a8ae9
Merge pull request #1104 from GSA/jskinne3-redis-upgrade-1-higher-envs
ccostino Jun 24, 2024
13f5629
Merge branch 'main' into jskinne3-upgrade-and-protect-staging-env
jskinne3 Jun 24, 2024
41fed3f
Merge branch 'main' into jskinne3-upgrade-and-protect-production-env
jskinne3 Jun 24, 2024
2ec5123
Merge pull request #1089 from GSA/jskinne3-upgrade-and-protect-bootst…
ccostino Jun 24, 2024
affa904
Merge pull request #1096 from GSA/jskinne3-upgrade-and-protect-stagin…
ccostino Jun 24, 2024
18be509
Merge pull request #1109 from GSA/dependabot/pip/sqlalchemy-2.0.31
ccostino Jun 24, 2024
7bab6ae
Merge pull request #1097 from GSA/jskinne3-upgrade-and-protect-produc…
ccostino Jun 24, 2024
8a1851b
Bump botocore from 1.34.128 to 1.34.131
dependabot[bot] Jun 24, 2024
aef1273
Merge pull request #1110 from GSA/dependabot/pip/botocore-1.34.131
ccostino Jun 24, 2024
3b152b2
Bump boto3 from 1.34.128 to 1.34.131
dependabot[bot] Jun 24, 2024
1dacb1f
Merge branch 'main' into jskinne3-remove-deprecated-from-shared-module
jskinne3 Jun 24, 2024
88b5c3a
Merge pull request #1112 from GSA/dependabot/pip/boto3-1.34.131
ccostino Jun 25, 2024
f69f52b
Bump setuptools from 70.0.0 to 70.1.0
dependabot[bot] Jun 25, 2024
4cb99d3
Merge pull request #1113 from GSA/dependabot/pip/setuptools-70.1.0
ccostino Jun 25, 2024
ec538da
Merge pull request #1076 from GSA/notify-api-937
ccostino Jun 25, 2024
cac5ef7
Merge pull request #1098 from GSA/jskinne3-remove-deprecated-from-sha…
ccostino Jun 25, 2024
28d77b1
Upgrade major verion 41 to 44 of tj-actions
jskinne3 Jun 25, 2024
35f2a0e
Merge pull request #1114 from GSA/jskinne3-upgrade-tj-actions
ccostino Jun 25, 2024
8aa3683
Upgrade from v41 to v44 in demo and prod deploy workflows
jskinne3 Jun 25, 2024
a07a790
Remove old version of Redis from Staging (and Sandbox)
jskinne3 Jun 25, 2024
efea5c9
Merge pull request #1116 from GSA/jskinne3-remove-v62-redis-staging
stvnrlly Jun 25, 2024
52d02f3
Merge pull request #1115 from GSA/jskinne3-upgrade-tj-actions-demo-prod
stvnrlly Jun 25, 2024
f70ab54
Bump botocore from 1.34.131 to 1.34.133
dependabot[bot] Jun 25, 2024
9d2ac37
Merge pull request #1117 from GSA/dependabot/pip/botocore-1.34.133
ccostino Jun 26, 2024
edc002e
Bump setuptools from 70.1.0 to 70.1.1
dependabot[bot] Jun 26, 2024
ceaca41
Merge pull request #1118 from GSA/dependabot/pip/setuptools-70.1.1
ccostino Jun 26, 2024
063ec69
Update name of Redis to include v70
jskinne3 Jun 26, 2024
6dd27a0
Merge pull request #1119 from GSA/jskinne3-manifest-update-redis-name
ccostino Jun 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/setup-project/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ runs:
sudo apt-get update \
&& sudo apt-get install -y --no-install-recommends \
libcurl4-openssl-dev
- name: Set up Python 3.12
- name: Set up Python 3.12.3
uses: actions/setup-python@v4
with:
python-version: "3.12"
python-version: "3.12.3"
- name: Install poetry
shell: bash
run: pip install --upgrade poetry
4 changes: 2 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Check for dead code
run: make dead-code
- name: Run tests with coverage
run: poetry run coverage run --omit=*/notifications_utils/* -m pytest --maxfail=10
run: poetry run coverage run --omit=*/notifications_utils/*,*/migrations/* -m pytest --maxfail=10
env:
SQLALCHEMY_DATABASE_TEST_URI: postgresql://user:password@localhost:5432/test_notification_api
NOTIFY_E2E_TEST_EMAIL: ${{ secrets.NOTIFY_E2E_TEST_EMAIL }}
Expand All @@ -62,7 +62,7 @@ jobs:
NOTIFY_E2E_TEST_PASSWORD: ${{ secrets.NOTIFY_E2E_TEST_PASSWORD }}
- name: Check coverage threshold
# TODO get this back up to 95
run: poetry run coverage report --fail-under=87
run: poetry run coverage report --fail-under=95

validate-new-relic-config:
runs-on: ubuntu-latest
Expand Down
93 changes: 93 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main", "production" ]
pull_request:
branches: [ "main", "production" ]
schedule:
- cron: '15 8 * * 2'

jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
include:
- language: python
build-mode: none
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
6 changes: 3 additions & 3 deletions .github/workflows/deploy-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- name: Check for changes to Terraform
id: changed-terraform-files
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v44
with:
files: |
terraform/demo
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:

- name: Check for changes to templates.json
id: changed-templates
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v44
with:
files: |
app/config_files/templates.json
Expand All @@ -86,7 +86,7 @@ jobs:

- name: Check for changes to egress config
id: changed-egress-config
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v44
with:
files: |
deploy-config/egress_proxy/notify-api-demo.*.acl
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- name: Check for changes to Terraform
id: changed-terraform-files
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v44
with:
files: |
terraform/production
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:

- name: Check for changes to templates.json
id: changed-templates
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v44
with:
files: |
app/config_files/templates.json
Expand All @@ -90,7 +90,7 @@ jobs:

- name: Check for changes to egress config
id: changed-egress-config
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v44
with:
files: |
deploy-config/egress_proxy/notify-api-production.*.acl
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- name: Check for changes to Terraform
id: changed-terraform-files
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v44
with:
files: |
terraform/staging
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:

- name: Check for changes to templates.json
id: changed-templates
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v44
with:
files: |
app/config_files/templates.json
Expand All @@ -91,7 +91,7 @@ jobs:

- name: Check for changes to egress config
id: changed-egress-config
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v44
with:
files: |
deploy-config/egress_proxy/notify-api-staging.*.acl
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ test: ## Run tests and create coverage report
poetry run black .
poetry run flake8 .
poetry run isort --check-only ./app ./tests
poetry run coverage run -m pytest --maxfail=10
poetry run coverage run --omit=*/notifications_utils/*,*/migrations/* -m pytest --maxfail=10

poetry run coverage report -m --fail-under=95
poetry run coverage html -d .coverage_cache

Expand Down
29 changes: 0 additions & 29 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ def create_app(application):
document_download_client.init_app(application)

register_blueprint(application)
register_v2_blueprints(application)

# avoid circular imports by importing this file later
from app.commands import setup_commands
Expand Down Expand Up @@ -252,34 +251,6 @@ def register_blueprint(application):
application.register_blueprint(upload_blueprint)


def register_v2_blueprints(application):
from app.authentication.auth import requires_auth
from app.v2.inbound_sms.get_inbound_sms import v2_inbound_sms_blueprint
from app.v2.notifications import ( # noqa
get_notifications,
post_notifications,
v2_notification_blueprint,
)
from app.v2.template import ( # noqa
get_template,
post_template,
v2_template_blueprint,
)
from app.v2.templates.get_templates import v2_templates_blueprint

v2_notification_blueprint.before_request(requires_auth)
application.register_blueprint(v2_notification_blueprint)

v2_templates_blueprint.before_request(requires_auth)
application.register_blueprint(v2_templates_blueprint)

v2_template_blueprint.before_request(requires_auth)
application.register_blueprint(v2_template_blueprint)

v2_inbound_sms_blueprint.before_request(requires_auth)
application.register_blueprint(v2_inbound_sms_blueprint)


def init_app(app):
@app.before_request
def record_request_details():
Expand Down
2 changes: 1 addition & 1 deletion app/aws/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# Temporarily extend cache to 7 days
ttl = 60 * 60 * 24 * 7
JOBS = ExpiringDict(max_len=1000, max_age_seconds=ttl)
JOBS = ExpiringDict(max_len=20000, max_age_seconds=ttl)


JOBS_CACHE_HITS = "JOBS_CACHE_HITS"
Expand Down
20 changes: 10 additions & 10 deletions app/celery/nightly_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
)
from app.enums import NotificationType
from app.models import FactProcessingTime
from app.utils import get_midnight_in_utc
from app.utils import get_midnight_in_utc, utc_now


@notify_celery.task(name="remove_sms_email_jobs")
Expand All @@ -46,7 +46,7 @@ def _remove_csv_files(job_types):

@notify_celery.task(name="cleanup-unfinished-jobs")
def cleanup_unfinished_jobs():
now = datetime.utcnow()
now = utc_now()
jobs = dao_get_unfinished_jobs()
for job in jobs:
# The query already checks that the processing_finished time is null, so here we are saying
Expand Down Expand Up @@ -88,7 +88,7 @@ def _delete_notifications_older_than_retention_by_type(notification_type):

for f in flexible_data_retention:
day_to_delete_backwards_from = get_midnight_in_utc(
datetime.utcnow()
utc_now()
).date() - timedelta(days=f.days_of_retention)

delete_notifications_for_service_and_type.apply_async(
Expand All @@ -100,7 +100,7 @@ def _delete_notifications_older_than_retention_by_type(notification_type):
},
)

seven_days_ago = get_midnight_in_utc(datetime.utcnow()).date() - timedelta(days=7)
seven_days_ago = get_midnight_in_utc(utc_now()).date() - timedelta(days=7)

service_ids_with_data_retention = {x.service_id for x in flexible_data_retention}

Expand Down Expand Up @@ -136,14 +136,14 @@ def _delete_notifications_older_than_retention_by_type(notification_type):
def delete_notifications_for_service_and_type(
service_id, notification_type, datetime_to_delete_before
):
start = datetime.utcnow()
start = utc_now()
num_deleted = move_notifications_to_notification_history(
notification_type,
service_id,
datetime_to_delete_before,
)
if num_deleted:
end = datetime.utcnow()
end = utc_now()
current_app.logger.info(
f"delete-notifications-for-service-and-type: "
f"service: {service_id}, "
Expand All @@ -158,7 +158,7 @@ def delete_notifications_for_service_and_type(
def timeout_notifications():
notifications = ["dummy value so len() > 0"]

cutoff_time = datetime.utcnow() - timedelta(
cutoff_time = utc_now() - timedelta(
seconds=current_app.config.get("SENDING_NOTIFICATIONS_TIMEOUT_PERIOD")
)

Expand All @@ -179,11 +179,11 @@ def timeout_notifications():
@cronitor("delete-inbound-sms")
def delete_inbound_sms():
try:
start = datetime.utcnow()
start = utc_now()
deleted = delete_inbound_sms_older_than_retention()
current_app.logger.info(
"Delete inbound sms job started {} finished {} deleted {} inbound sms notifications".format(
start, datetime.utcnow(), deleted
start, utc_now(), deleted
)
)
except SQLAlchemyError:
Expand All @@ -197,7 +197,7 @@ def save_daily_notification_processing_time(local_date=None):
# local_date is a string in the format of "YYYY-MM-DD"
if local_date is None:
# if a date is not provided, we run against yesterdays data
local_date = (datetime.utcnow() - timedelta(days=1)).date()
local_date = (utc_now() - timedelta(days=1)).date()
else:
local_date = datetime.strptime(local_date, "%Y-%m-%d").date()

Expand Down
5 changes: 3 additions & 2 deletions app/celery/process_ses_receipts_tasks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime, timedelta
from datetime import timedelta

import iso8601
from celery.exceptions import Retry
Expand All @@ -22,6 +22,7 @@
)
from app.enums import CallbackType, NotificationStatus
from app.models import Complaint
from app.utils import utc_now


@notify_celery.task(
Expand Down Expand Up @@ -57,7 +58,7 @@ def process_ses_results(self, response):
message_time = iso8601.parse_date(ses_message["mail"]["timestamp"]).replace(
tzinfo=None
)
if datetime.utcnow() - message_time < timedelta(minutes=5):
if utc_now() - message_time < timedelta(minutes=5):
current_app.logger.info(
f"Notification not found for reference: {reference}"
f"(while attempting update to {notification_status}). "
Expand Down
Loading
Loading