Skip to content

Commit

Permalink
Merge branch 'main' into jgasiorek-ffs-880
Browse files Browse the repository at this point in the history
  • Loading branch information
tdooner committed Jul 1, 2024
2 parents 2be842e + 768da2d commit b2e5b3d
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/app/controllers/cbv/agreements_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Cbv::AgreementsController < Cbv::BaseController
def show
end
end
2 changes: 2 additions & 0 deletions app/app/controllers/cbv/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def set_payments
def next_path
case params[:controller]
when "cbv/entries"
cbv_flow_agreement_path
when "cbv/agreements"
cbv_flow_employer_search_path
when "cbv/employer_searches"
cbv_flow_summary_path
Expand Down
23 changes: 23 additions & 0 deletions app/app/views/cbv/agreements/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<h1><%= t('.header') %></h1>
<p><%= t('.subheader') %></p>
<ul>
<li><%= t('.step1') %></li>
<li><%= t('.step2') %></li>
<li><%= t('.step3') %></li>
<li><%= t('.step4') %></li>
<li><%= t('.step5') %></li>
</ul>

<div class="usa-alert usa-alert--info margin-bottom-3 margin-top-3">
<div class="usa-alert__body">
<p class="usa-alert__text">
<%= t('.information_is_secure') %>
</p>
</div>
</div><p class="text-bold"><%= t('.by_continuing') %></p>

<%= link_to next_path do %>
<button class="usa-button usa-button--outline" type="button">
<%= t('.continue') %>
</button>
<% end %>
2 changes: 1 addition & 1 deletion app/config/initializers/content_security_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
policy.frame_ancestors :none
policy.img_src :self, :data, "https://*.cloudinary.com", "http://*.cloudinary.com", "https://www.google-analytics.com", "https://cdn.getpinwheel.com"
policy.object_src :none
policy.script_src :self, "https://js-agent.newrelic.com", "https://*.nr-data.net", "https://dap.digitalgov.gov", "https://www.google-analytics.com", "https://cdn.getpinwheel.com"
policy.script_src :self, :unsafe_inline, "https://js-agent.newrelic.com", "https://*.nr-data.net", "https://dap.digitalgov.gov", "https://www.google-analytics.com", "https://cdn.getpinwheel.com"
policy.connect_src :self, "https://get.geojs.io", "https://*.nr-data.net", "https://dap.digitalgov.gov", "https://www.google-analytics.com"
policy.worker_src :self, "blob:"
policy.frame_src :self, "https://cdn.getpinwheel.com"
Expand Down
12 changes: 12 additions & 0 deletions app/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ en:
subject: Verify your income for your benefit application
thank_you: Thank you!
cbv:
agreements:
show:
by_continuing: By continuing, you are letting Verify.gov access your payment information.
continue: Continue
header: How verifying your income works
information_is_secure: Your information is secure. We will not share or keep your log in information. You will be able to preview and approve everything that is shared with your caseworker.
step1: Find your employer or payroll provider
step2: Sign into your employer's account
step3: Review your payment records
step4: Add other employers to your records if you have them
step5: Share your payment information with your caseworker
subheader: 'All you have to do is complete five easy steps:'
employer_searches:
show:
employer_not_listed: Employer not listed?
Expand Down
1 change: 1 addition & 0 deletions app/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
resource :summary, only: %i[show update]
resource :share, only: %i[show update]
resource :success, only: %i[show]
resource :agreement, only: %i[show]

# Utility route to clear your session; useful during development
resource :reset, only: %i[show]
Expand Down
10 changes: 10 additions & 0 deletions app/lib/new_relic_event_tracker.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module NewRelicEventTracker
def self.track(event_type, attributes = {})
Rails.logger.info "Sending New Relic event: #{event_type} with attributes: #{attributes}"
response = NewRelic::Agent.record_custom_event(event_type, attributes)
Rails.logger.info "New Relic event sent"
response
rescue StandardError => e
Rails.logger.error "Failed to send New Relic event: #{e.message}"
end
end
25 changes: 25 additions & 0 deletions app/spec/lib/new_relic_event_tracker_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'rails_helper'
require 'new_relic_event_tracker'

RSpec.describe NewRelicEventTracker do
describe '.track' do
let(:event_type) { 'TestEvent' }
let(:attributes) { { key: 'value' } }

it 'calls NewRelic::Agent.record_custom_event with correct parameters' do
expect(NewRelic::Agent).to receive(:record_custom_event).with(event_type, attributes)
described_class.track(event_type, attributes)
end

context 'when an error occurs' do
before do
allow(NewRelic::Agent).to receive(:record_custom_event).and_raise(StandardError.new('Test error'))
end

it 'logs an error message' do
expect(Rails.logger).to receive(:error).with("Failed to send New Relic event: Test error")
described_class.track(event_type, attributes)
end
end
end
end
36 changes: 36 additions & 0 deletions docs/app/runbooks/deploy-failures.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Deploy Failure Runbook

Add documentation to this runbook to help future us diagnose deploy problems.


## Failed "Run Migration" Github Action

This action sometimes fails when "Waiting for log stream to be created". This means the container running migrations failed to start for some reason.

You can see the container startup error by going to the AWS ECS service and changing "Filter Desired Status" to "Any Desired Status":
* https://us-east-1.console.aws.amazon.com/ecs/v2/clusters/app-dev/services/app-dev/tasks?region=us-east-1

<details>
<summary>
<strong>ResourceInitializationError: unable to pull secrets or registry auth</strong>
</summary>
Did you (or someone else) add an environment variable lately? You may need to run `make infra-update-app-service APP_NAME=app ENVIRONMENT=dev` in order for Terraform to give the ECS task executor user permission to pull the value of the environment variable.
</details>

## Unsure what version is deployed?

If you're not sure what version of code is currently deployed, follow these steps to understand the state of the last deploy:

1. Check the latest Github commit and whether it was successfully deployed
2. Check the healthcheck endpoint: https://{host}/health
3. Check the AWS ECS task definition to see what version of the container image is supposed to be used.

## Failed "Build release" step

This action sometimes fails when the Docker rate limit has been reached:

> ERROR: failed to solve: registry.docker.com/library/ruby:3.3.0-slim: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry.docker.com/v2/library/ruby/manifests/sha256:{commit sha}: 429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
Docker is likely rate limiting pulling of the Ruby image. This limit resets every 6 hours. Still, Github uses multiple IPs to make egress calls. **Simply redeploying the workflow usually works.** [Further discussion](https://nava.slack.com/archives/C06FC5TPAR3/p1719865408255839?thread_ts=1719862944.272089&cid=C06FC5TPAR3).


0 comments on commit b2e5b3d

Please sign in to comment.