Skip to content

Commit

Permalink
Merge branch 'main' into arm-char-limits
Browse files Browse the repository at this point in the history
  • Loading branch information
rjohnson2011 authored Dec 23, 2024
2 parents 9d40f84 + 00e6d29 commit 82d66fc
Show file tree
Hide file tree
Showing 447 changed files with 18,073 additions and 7,376 deletions.
139 changes: 139 additions & 0 deletions .github/workflows/cd-deploy-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Continuous Deploy Production Test Workflow

on:
workflow_dispatch:
inputs:
commit_sha:
description: Deploy specific commit
required: true

jobs:
get-workflow-environment:
runs-on: ubuntu-latest
outputs:
environment_name: ${{ steps.check-environment.outputs.env_name }}
steps:
- name: Check environment
id: check-environment
run: |
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
echo env_name='production' >> $GITHUB_OUTPUT
else
echo env_name='' >> $GITHUB_OUTPUT
fi
deploy:
name: Deploy
if: ${{ github.event.client_payload.github_ref == 'refs/heads/main' }}
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
fetch-depth: 0

- name: Install dependencies
uses: ./.github/workflows/install
timeout-minutes: 30
with:
key: ${{ hashFiles('yarn.lock') }}
yarn_cache_folder: .cache/yarn
path: |
.cache/yarn
node_modules
- name: Check if commit can be deployed
id: check-deployability
run: node ./script/github-actions/check-deployability.js
env:
BUILDTYPE: vagovprod

- name: Configure AWS credentials (1)
if: steps.check-deployability.outputs.is_deployable == 'true'
uses: ./.github/workflows/configure-aws-credentials
with:
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-gov-west-1


- name: Get AWS IAM role
if: steps.check-deployability.outputs.is_deployable == 'true'
uses: ./.github/workflows/inject-secrets
with:
ssm_parameter: /frontend-team/github-actions/parameters/AWS_FRONTEND_PROD_ROLE
env_variable_name: AWS_FRONTEND_PROD_ROLE

- name: Configure AWS Credentials (2)
if: steps.check-deployability.outputs.is_deployable == 'true'
uses: ./.github/workflows/configure-aws-credentials
with:
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-gov-west-1
role: ${{ env.AWS_FRONTEND_NONPROD_ROLE != '' && env.AWS_FRONTEND_NONPROD_ROLE || env.AWS_FRONTEND_PROD_ROLE }}
role_duration: 900
session_name: vsp-frontendteam-githubaction

- name: Deploy
if: steps.check-deployability.outputs.is_deployable == 'true'
run: ./script/github-actions/partial-deploy.sh -s $SRC -d $DEST -a $ASSET_DEST -v

env:
SRC: s3://vetsgov-website-builds-s3-upload/${{ github.event.client_payload.github_sha }}/vagovprod.tar.bz2
DEST: s3://www.va.gov
ASSET_DEST: s3://prod-va-gov-assets

notify-failure:
name: Notify Failure
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' && (failure() || cancelled()) }}
needs: [deploy]
env:
ALERT_TEAMS: true # Alerts teams for single/grouped app builds when set to true
DEVOPS_CHANNEL_ID: C37M86Y8G #devops-deploys
VETS_WEBSITE_CHANNEL_ID: C02V265VCGH #status-vets-website

steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
fetch-depth: 0

- name: Install dependencies
if: env.ALERT_TEAMS == 'true'
uses: ./.github/workflows/install
timeout-minutes: 30
with:
key: ${{ hashFiles('yarn.lock') }}
yarn_cache_folder: .cache/yarn
path: |
.cache/yarn
node_modules
- name: Get changed applications
id: get-changed-apps
if: env.ALERT_TEAMS == 'true'
uses: ./.github/workflows/get-changed-apps
with:
output-type: 'slack_group'

- name: Notify application team in Slack
if: env.ALERT_TEAMS == 'true' && steps.get-changed-apps.outputs.slack_groups != ''
uses: department-of-veterans-affairs/platform-release-tools-actions/slack-notify@main
continue-on-error: true
with:
payload: '{"attachments": [{"color": "#FF0800","blocks": [{"type": "section","text": {"type": "mrkdwn","text": "${{steps.get-changed-apps.outputs.slack_groups}} CI for your application failed on the `main` branch in `vets-website`: <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|${{github.run_id}}>\n For help troubleshooting, see the <https://depo-platform-documentation.scrollhelp.site/developer-docs/Handling-failed-single%2Fgrouped-application-pipelines.2066645150.html|documentation> on failed workflow runs."}}]}]}'
channel_id: ${{ env.VETS_WEBSITE_CHANNEL_ID }}
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Notify Slack
if: steps.get-changed-apps.outputs.slack_groups == ''
uses: department-of-veterans-affairs/platform-release-tools-actions/slack-notify@main
continue-on-error: true
with:
payload: '{"attachments": [{"color": "#FF0800","blocks": [{"type": "section","text": {"type": "mrkdwn","text": "`main` branch CI in `vets-website` failed: <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|${{github.run_id}}>"}}]}]}'
channel_id: ${{ env.VETS_WEBSITE_CHANNEL_ID }}
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
1 change: 0 additions & 1 deletion .github/workflows/continuous-deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
repository_dispatch:
types: [cd-production-deploy]


jobs:
deploy:
name: Deploy
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
"@babel/runtime": "^7.15.4",
"@datadog/browser-logs": "^5.8.0",
"@datadog/browser-rum": "^4.49.0",
"@department-of-veterans-affairs/component-library": "^48.2.0",
"@department-of-veterans-affairs/component-library": "^48.3.0",
"@department-of-veterans-affairs/css-library": "^0.16.1",
"@department-of-veterans-affairs/react-jsonschema-form": "^1.2.5",
"@department-of-veterans-affairs/va-forms-system-core": "1.6.1",
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import PropTypes from 'prop-types';
import React from 'react';
import { useParams, Link } from 'react-router-dom';
import { Link, useLoaderData } from 'react-router-dom';

import { apiRequest } from '@department-of-veterans-affairs/platform-utilities/api';
import { formatDateShort } from 'platform/utilities/date/index';
import usePOARequests from '../hooks/usePOARequests';
import mockPOARequestsResponse from '../mocks/mockPOARequestsResponse.json';

const checkAuthorizations = (
isTreatmentDisclosureAuthorized,
Expand All @@ -21,10 +23,7 @@ const checkAuthorizations = (
};

const POARequestDetailsPage = () => {
const { poaRequests } = usePOARequests();
const { id } = useParams();

const poaRequest = poaRequests.find(r => r.id === Number(id))?.attributes;
const poaRequest = useLoaderData();

return (
<section className="poa-request-details">
Expand Down Expand Up @@ -166,7 +165,26 @@ const POARequestDetailsPage = () => {
</section>
);
};

POARequestDetailsPage.propTypes = {
usePOARequests: PropTypes.func.isRequired,
};

export default POARequestDetailsPage;

export async function poaRequestLoader({ params }) {
const { id } = params;

try {
const response = await apiRequest(`/power_of_attorney_requests/${id}`, {
apiVersion: 'accredited_representative_portal/v0',
});
return response.data;
} catch (error) {
// Return mock data if API fails (TODO: remove this before pilot and replace with commented throw below)
// throwing the error will cause the app to show the error message configured in routes.jsx
return mockPOARequestsResponse.data.find(r => r.id === Number(id))
?.attributes;
// throw error;
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
import React from 'react';
import { useLoaderData } from 'react-router-dom';

import { apiRequest } from '@department-of-veterans-affairs/platform-utilities/api';
import DigitalSubmissionAlert from '../components/DigitalSubmissionAlert/DigitalSubmissionAlert';
import POARequestsTableFetcher from '../components/POARequestsTableFetcher/POARequestsTableFetcher';
import usePOARequests from '../hooks/usePOARequests';
import POARequestsCard from '../components/POARequestsCard/POARequestsCard';
import mockPOARequestsResponse from '../mocks/mockPOARequestsResponse.json';

const POARequestsPage = () => {
const poaRequests = useLoaderData();

return (
<>
<h1 data-testid="poa-requests-heading">Power of attorney requests</h1>
<DigitalSubmissionAlert />
<div className="poa-requests-page-table-container">
<h2 data-testid="poa-requests-table-heading">Requests</h2>
<POARequestsTableFetcher usePOARequests={usePOARequests} />
{poaRequests.length === 0 ? (
<p data-testid="poa-requests-table-fetcher-no-poa-requests">
No POA requests found
</p>
) : (
<POARequestsCard poaRequests={poaRequests} />
)}
</div>
</>
);
};

export default POARequestsPage;

export async function poaRequestsLoader() {
try {
const response = await apiRequest('/power_of_attorney_requests', {
apiVersion: 'accredited_representative_portal/v0',
});
return response.data;
} catch (error) {
// Return mock data if API fails
// TODO: Remove mock data before pilot and uncomment throw statement
return mockPOARequestsResponse.data;
// throw error;
}
}

This file was deleted.

Loading

0 comments on commit 82d66fc

Please sign in to comment.