From 7cd229fa8855bbac29b76fe98b47c19c1eece0c7 Mon Sep 17 00:00:00 2001 From: rachidatecs Date: Thu, 17 Aug 2023 18:47:58 -0400 Subject: [PATCH 1/5] filter applications by excluding approved --- src/registrar/tests/test_views.py | 16 ++++++++++++++++ src/registrar/views/index.py | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py index feb553bf7..b2d6290f6 100644 --- a/src/registrar/tests/test_views.py +++ b/src/registrar/tests/test_views.py @@ -1500,3 +1500,19 @@ class TestApplicationStatus(TestWithUser, WebTest): reverse(url_name, kwargs={"pk": application.pk}) ) self.assertEqual(page.status_code, 403) + + +def test_approved_application_not_in_active_requests(self): + """An approved application is not shown in the Active + Requests table on home.html.""" + application = completed_application( + status=DomainApplication.APPROVED, user=self.user + ) + application.save() + + home_page = self.app.get("/") + # This works in our test environemnt because creating + # an approved application here does not generate a + # domain object, so we do not expect to see 'city.gov' + # in either the Domains or Requests tables. + self.assertNotContains(home_page, "city.gov") diff --git a/src/registrar/views/index.py b/src/registrar/views/index.py index 35a67bceb..876983c4e 100644 --- a/src/registrar/views/index.py +++ b/src/registrar/views/index.py @@ -9,7 +9,7 @@ def index(request): context = {} if request.user.is_authenticated: applications = DomainApplication.objects.filter(creator=request.user) - context["domain_applications"] = applications + context["domain_applications"] = applications.exclude(status="approved") domains = request.user.permissions.values( "role", From 892ad926df1f585b1fd57f3f0eaa9199bc4c9abb Mon Sep 17 00:00:00 2001 From: rachidatecs Date: Mon, 21 Aug 2023 12:22:56 -0400 Subject: [PATCH 2/5] Add comment explaining why we're excluding approved applications --- src/registrar/views/index.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/registrar/views/index.py b/src/registrar/views/index.py index 876983c4e..273ba8cb0 100644 --- a/src/registrar/views/index.py +++ b/src/registrar/views/index.py @@ -9,6 +9,9 @@ def index(request): context = {} if request.user.is_authenticated: applications = DomainApplication.objects.filter(creator=request.user) + # Let's exclude the approved applications since our + # domain_applications context will be used to populate + # the active applications table context["domain_applications"] = applications.exclude(status="approved") domains = request.user.permissions.values( From 279a986ffdb03b8b9513d96f85e86ed9f96b7e72 Mon Sep 17 00:00:00 2001 From: rachidatecs Date: Mon, 21 Aug 2023 16:34:43 -0400 Subject: [PATCH 3/5] Add dk yaml, add dk to workflows, update org name --- .../ISSUE_TEMPLATE/developer-onboarding.md | 2 +- .github/workflows/deploy-sandbox.yaml | 3 +- .github/workflows/deploy-stable.yaml | 2 +- .github/workflows/deploy-staging.yaml | 2 +- .github/workflows/migrate.yaml | 3 +- .github/workflows/reset-db.yaml | 7 +++-- ops/manifests/manifest-dk.yaml | 29 +++++++++++++++++++ ops/scripts/create_dev_sandbox.sh | 12 ++++---- ops/scripts/deploy.sh | 2 +- ops/scripts/destroy_dev_sandbox.sh | 4 +-- ops/scripts/rotate_cloud_secrets.sh | 4 +-- src/registrar/config/settings.py | 1 + src/registrar/fixtures.py | 5 ++++ 13 files changed, 57 insertions(+), 19 deletions(-) create mode 100644 ops/manifests/manifest-dk.yaml diff --git a/.github/ISSUE_TEMPLATE/developer-onboarding.md b/.github/ISSUE_TEMPLATE/developer-onboarding.md index 8d0f9c2d8..94b2a367d 100644 --- a/.github/ISSUE_TEMPLATE/developer-onboarding.md +++ b/.github/ISSUE_TEMPLATE/developer-onboarding.md @@ -37,7 +37,7 @@ cf login -a api.fr.cloud.gov --sso - [ ] Optional- add yourself as a codeowner if desired. See the [Developer readme](https://github.com/cisagov/getgov/blob/main/docs/developer/README.md) for how to do this and what it does. ### Steps for the onboarder -- [ ] Add the onboardee to cloud.gov org (cisa-getgov-prototyping) +- [ ] Add the onboardee to cloud.gov org (cisa-dotgov) - [ ] Setup a [developer specific space for the new developer](#setting-up-developer-sandbox) - [ ] Add the onboardee to our login.gov sandbox team (`.gov Registrar`) via the [dashboard](https://dashboard.int.identitysandbox.gov/) diff --git a/.github/workflows/deploy-sandbox.yaml b/.github/workflows/deploy-sandbox.yaml index 3b418c4d5..5d9000401 100644 --- a/.github/workflows/deploy-sandbox.yaml +++ b/.github/workflows/deploy-sandbox.yaml @@ -18,6 +18,7 @@ jobs: || startsWith(github.head_ref, 'za/') || startsWith(github.head_ref, 'rh/') || startsWith(github.head_ref, 'nl/') + || startsWith(github.head_ref, 'dk/') outputs: environment: ${{ steps.var.outputs.environment}} runs-on: "ubuntu-latest" @@ -52,7 +53,7 @@ jobs: with: cf_username: ${{ secrets[env.CF_USERNAME] }} cf_password: ${{ secrets[env.CF_PASSWORD] }} - cf_org: cisa-getgov-prototyping + cf_org: cisa-dotgov cf_space: ${{ env.ENVIRONMENT }} push_arguments: "-f ops/manifests/manifest-${{ env.ENVIRONMENT }}.yaml" comment: diff --git a/.github/workflows/deploy-stable.yaml b/.github/workflows/deploy-stable.yaml index 2f1a2a6b4..0a40ac097 100644 --- a/.github/workflows/deploy-stable.yaml +++ b/.github/workflows/deploy-stable.yaml @@ -36,6 +36,6 @@ jobs: with: cf_username: ${{ secrets.CF_STABLE_USERNAME }} cf_password: ${{ secrets.CF_STABLE_PASSWORD }} - cf_org: cisa-getgov-prototyping + cf_org: cisa-dotgov cf_space: stable push_arguments: "-f ops/manifests/manifest-stable.yaml" diff --git a/.github/workflows/deploy-staging.yaml b/.github/workflows/deploy-staging.yaml index 068751c30..1db63e2a2 100644 --- a/.github/workflows/deploy-staging.yaml +++ b/.github/workflows/deploy-staging.yaml @@ -36,6 +36,6 @@ jobs: with: cf_username: ${{ secrets.CF_STAGING_USERNAME }} cf_password: ${{ secrets.CF_STAGING_PASSWORD }} - cf_org: cisa-getgov-prototyping + cf_org: cisa-dotgov cf_space: staging push_arguments: "-f ops/manifests/manifest-staging.yaml" diff --git a/.github/workflows/migrate.yaml b/.github/workflows/migrate.yaml index fbfc7f17a..705014af1 100644 --- a/.github/workflows/migrate.yaml +++ b/.github/workflows/migrate.yaml @@ -24,6 +24,7 @@ on: - ab - bl - rjm + - dk jobs: migrate: @@ -37,6 +38,6 @@ jobs: with: cf_username: ${{ secrets[env.CF_USERNAME] }} cf_password: ${{ secrets[env.CF_PASSWORD] }} - cf_org: cisa-getgov-prototyping + cf_org: cisa-dotgov cf_space: ${{ github.event.inputs.environment }} full_command: "cf run-task getgov-${{ github.event.inputs.environment }} --command 'python manage.py migrate' --name migrate" diff --git a/.github/workflows/reset-db.yaml b/.github/workflows/reset-db.yaml index fea4f19e2..0bf1af2d9 100644 --- a/.github/workflows/reset-db.yaml +++ b/.github/workflows/reset-db.yaml @@ -25,6 +25,7 @@ on: - ab - bl - rjm + - dk jobs: reset-db: @@ -38,7 +39,7 @@ jobs: with: cf_username: ${{ secrets[env.CF_USERNAME] }} cf_password: ${{ secrets[env.CF_PASSWORD] }} - cf_org: cisa-getgov-prototyping + cf_org: cisa-dotgov cf_space: ${{ github.event.inputs.environment }} full_command: "cf run-task getgov-${{ github.event.inputs.environment }} --command 'python manage.py flush --no-input' --name flush" @@ -47,7 +48,7 @@ jobs: with: cf_username: ${{ secrets[env.CF_USERNAME] }} cf_password: ${{ secrets[env.CF_PASSWORD] }} - cf_org: cisa-getgov-prototyping + cf_org: cisa-dotgov cf_space: ${{ github.event.inputs.environment }} full_command: "cf run-task getgov-${{ github.event.inputs.environment }} --command 'python manage.py migrate' --name migrate" @@ -56,6 +57,6 @@ jobs: with: cf_username: ${{ secrets[env.CF_USERNAME] }} cf_password: ${{ secrets[env.CF_PASSWORD] }} - cf_org: cisa-getgov-prototyping + cf_org: cisa-dotgov cf_space: ${{ github.event.inputs.environment }} full_command: "cf run-task getgov-${{ github.event.inputs.environment }} --command 'python manage.py load' --name loaddata" diff --git a/ops/manifests/manifest-dk.yaml b/ops/manifests/manifest-dk.yaml new file mode 100644 index 000000000..87de8a496 --- /dev/null +++ b/ops/manifests/manifest-dk.yaml @@ -0,0 +1,29 @@ +--- +applications: +- name: getgov-dk + buildpacks: + - python_buildpack + path: ../../src + instances: 1 + memory: 512M + stack: cflinuxfs4 + timeout: 180 + command: ./run.sh + health-check-type: http + health-check-http-endpoint: /health + env: + # Send stdout and stderr straight to the terminal without buffering + PYTHONUNBUFFERED: yup + # Tell Django where to find its configuration + DJANGO_SETTINGS_MODULE: registrar.config.settings + # Tell Django where it is being hosted + DJANGO_BASE_URL: https://getgov-dk.app.cloud.gov + # Tell Django how much stuff to log + DJANGO_LOG_LEVEL: INFO + # Public site base URL + GETGOV_PUBLIC_SITE_URL: https://federalist-877ab29f-16f6-4f12-961c-96cf064cf070.sites.pages.cloud.gov/site/cisagov/getgov-home/ + routes: + - route: getgov-dk.app.cloud.gov + services: + - getgov-credentials + - getgov-dk-database diff --git a/ops/scripts/create_dev_sandbox.sh b/ops/scripts/create_dev_sandbox.sh index f180ada8d..5eeed9c10 100755 --- a/ops/scripts/create_dev_sandbox.sh +++ b/ops/scripts/create_dev_sandbox.sh @@ -21,9 +21,9 @@ then git checkout -b new-dev-sandbox-$1 fi -cf target -o cisa-getgov-prototyping +cf target -o cisa-dotgov -read -p "Are you logged in to the cisa-getgov-prototyping CF org above? (y/n) " -n 1 -r +read -p "Are you logged in to the cisa-dotgov CF org above? (y/n) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]] then @@ -49,9 +49,9 @@ sed -i '' '/getgov-staging.app.cloud.gov/ {a\ echo "Creating new cloud.gov space for $1..." cf create-space $1 -cf target -o "cisa-getgov-prototyping" -s $1 -cf bind-security-group public_networks_egress cisa-getgov-prototyping --space $1 -cf bind-security-group trusted_local_networks_egress cisa-getgov-prototyping --space $1 +cf target -o "cisa-dotgov" -s $1 +cf bind-security-group public_networks_egress cisa-dotgov --space $1 +cf bind-security-group trusted_local_networks_egress cisa-dotgov --space $1 echo "Creating new cloud.gov DB for $1. This usually takes about 5 minutes..." cf create-service aws-rds micro-psql getgov-$1-database @@ -91,7 +91,7 @@ cd .. cf push getgov-$1 -f ops/manifests/manifest-$1.yaml read -p "Please provide the email of the space developer: " -r -cf set-space-role $REPLY cisa-getgov-prototyping $1 SpaceDeveloper +cf set-space-role $REPLY cisa-dotgov $1 SpaceDeveloper read -p "Should we run migrations? (y/n) " -n 1 -r echo diff --git a/ops/scripts/deploy.sh b/ops/scripts/deploy.sh index d8dd45fbc..50f0f5bfa 100755 --- a/ops/scripts/deploy.sh +++ b/ops/scripts/deploy.sh @@ -4,7 +4,7 @@ ../ops/scripts/build.sh # Deploy to sandbox -cf target -o cisa-getgov-prototyping -s $1 +cf target -o cisa-dotgov -s $1 cf push getgov-$1 -f ../ops/manifests/manifest-$1.yaml # migrations need to be run manually. Developers can use this command diff --git a/ops/scripts/destroy_dev_sandbox.sh b/ops/scripts/destroy_dev_sandbox.sh index 47a7f26d8..9e233b2f1 100755 --- a/ops/scripts/destroy_dev_sandbox.sh +++ b/ops/scripts/destroy_dev_sandbox.sh @@ -20,9 +20,9 @@ then git checkout -b remove-dev-sandbox-$1 fi -cf target -o cisa-getgov-prototyping -s $1 +cf target -o cisa-dotgov -s $1 -read -p "Are you logged in to the cisa-getgov-prototyping CF org above? (y/n) " -n 1 -r +read -p "Are you logged in to the cisa-dotgov CF org above? (y/n) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]] then diff --git a/ops/scripts/rotate_cloud_secrets.sh b/ops/scripts/rotate_cloud_secrets.sh index aa77c39a8..23e4aa590 100755 --- a/ops/scripts/rotate_cloud_secrets.sh +++ b/ops/scripts/rotate_cloud_secrets.sh @@ -9,8 +9,8 @@ if [ -z "$1" ]; then exit 1 fi -cf target -o cisa-getgov-prototyping -s $1 -read -p "Are you logged in to the cisa-getgov-prototyping CF org above and targeting the correct space? (y/n) " -n 1 -r +cf target -o cisa-dotgov -s $1 +read -p "Are you logged in to the cisa-dotgov CF org above and targeting the correct space? (y/n) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]] then diff --git a/src/registrar/config/settings.py b/src/registrar/config/settings.py index f6873b226..8b53fa82a 100644 --- a/src/registrar/config/settings.py +++ b/src/registrar/config/settings.py @@ -580,6 +580,7 @@ ALLOWED_HOSTS = [ "getgov-ab.app.cloud.gov", "getgov-bl.app.cloud.gov", "getgov-rjm.app.cloud.gov", + "getgov-dk.app.cloud.gov", "get.gov", ] diff --git a/src/registrar/fixtures.py b/src/registrar/fixtures.py index 2c94a1eb4..3ef9640fe 100644 --- a/src/registrar/fixtures.py +++ b/src/registrar/fixtures.py @@ -72,6 +72,11 @@ class UserFixture: "first_name": "Rebecca", "last_name": "Hsieh", }, + { + "username": "fa69c8e8-da83-4798-a4f2-263c9ce93f52", + "first_name": "Dave", + "last_name": "Kennedy", + }, ] STAFF = [ From 5a8c4c072b9367f7048efb8c9959ec22a6b00ac6 Mon Sep 17 00:00:00 2001 From: rachidatecs Date: Mon, 21 Aug 2023 16:53:12 -0400 Subject: [PATCH 4/5] Linting and remove Dave from fixtures so he can do it himself --- src/registrar/fixtures.py | 5 ----- src/registrar/views/index.py | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/registrar/fixtures.py b/src/registrar/fixtures.py index 3ef9640fe..2c94a1eb4 100644 --- a/src/registrar/fixtures.py +++ b/src/registrar/fixtures.py @@ -72,11 +72,6 @@ class UserFixture: "first_name": "Rebecca", "last_name": "Hsieh", }, - { - "username": "fa69c8e8-da83-4798-a4f2-263c9ce93f52", - "first_name": "Dave", - "last_name": "Kennedy", - }, ] STAFF = [ diff --git a/src/registrar/views/index.py b/src/registrar/views/index.py index 273ba8cb0..186535aa3 100644 --- a/src/registrar/views/index.py +++ b/src/registrar/views/index.py @@ -10,7 +10,7 @@ def index(request): if request.user.is_authenticated: applications = DomainApplication.objects.filter(creator=request.user) # Let's exclude the approved applications since our - # domain_applications context will be used to populate + # domain_applications context will be used to populate # the active applications table context["domain_applications"] = applications.exclude(status="approved") From f4ce27a4ab8b195c571fc54f68956e602c730a7c Mon Sep 17 00:00:00 2001 From: rachidatecs Date: Tue, 22 Aug 2023 11:58:23 -0400 Subject: [PATCH 5/5] Clean up branch from unrelated work --- src/registrar/tests/test_views.py | 16 ---------------- src/registrar/views/index.py | 5 +---- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py index b2d6290f6..feb553bf7 100644 --- a/src/registrar/tests/test_views.py +++ b/src/registrar/tests/test_views.py @@ -1500,19 +1500,3 @@ class TestApplicationStatus(TestWithUser, WebTest): reverse(url_name, kwargs={"pk": application.pk}) ) self.assertEqual(page.status_code, 403) - - -def test_approved_application_not_in_active_requests(self): - """An approved application is not shown in the Active - Requests table on home.html.""" - application = completed_application( - status=DomainApplication.APPROVED, user=self.user - ) - application.save() - - home_page = self.app.get("/") - # This works in our test environemnt because creating - # an approved application here does not generate a - # domain object, so we do not expect to see 'city.gov' - # in either the Domains or Requests tables. - self.assertNotContains(home_page, "city.gov") diff --git a/src/registrar/views/index.py b/src/registrar/views/index.py index 186535aa3..35a67bceb 100644 --- a/src/registrar/views/index.py +++ b/src/registrar/views/index.py @@ -9,10 +9,7 @@ def index(request): context = {} if request.user.is_authenticated: applications = DomainApplication.objects.filter(creator=request.user) - # Let's exclude the approved applications since our - # domain_applications context will be used to populate - # the active applications table - context["domain_applications"] = applications.exclude(status="approved") + context["domain_applications"] = applications domains = request.user.permissions.values( "role",