Skip to content

Commit

Permalink
Merge branch 'main' into alert-autofix-66
Browse files Browse the repository at this point in the history
  • Loading branch information
IGallupSoCo authored Jan 16, 2025
2 parents 1e1c67b + 68031f8 commit 8898f5e
Show file tree
Hide file tree
Showing 2,554 changed files with 89,214 additions and 63,875 deletions.
7 changes: 4 additions & 3 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ src/applications/proxy-rewrite @department-of-veterans-affairs/platform-design-s
src/applications/auth @department-of-veterans-affairs/octo-identity @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/login @department-of-veterans-affairs/octo-identity @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/sign-in-changes @department-of-veterans-affairs/octo-identity @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/static-pages/cta-widget @department-of-veterans-affairs/octo-identity @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/terms-of-use @department-of-veterans-affairs/octo-identity @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/verify @department-of-veterans-affairs/octo-identity @department-of-veterans-affairs/va-platform-cop-frontend
src/platform/site-wide/ebenefits/ @department-of-veterans-affairs/octo-identity @department-of-veterans-affairs/va-platform-cop-frontend
Expand Down Expand Up @@ -134,14 +135,13 @@ src/applications/find-forms @department-of-veterans-affairs/vfs-public-websites-
src/applications/discharge-wizard @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/income-limits @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/public-outreach-materials @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/search @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/1010-health-apps-frontend @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/search @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/static-pages/BTSSS-login @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/static-pages/cta-widget @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/static-pages/events @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/vfs-facilities-frontend @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/static-pages/homepage @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/static-pages/homepage-veteran-banner @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/static-pages/i18select @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/resources-and-support @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/1010-health-apps-frontend @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/resources-and-support @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/pact-act @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/va-platform-cop-frontend

# Public Websites - unauthed experience only
Expand Down Expand Up @@ -244,6 +244,7 @@ src/applications/static-pages/health-care-manage-benefits/schedule-view-va-appoi

# Benefits Accredited Representative Facing (ARF)
src/applications/accredited-representative-portal @department-of-veterans-affairs/benefits-accredited-rep-facing-engineers @department-of-veterans-affairs/va-platform-cop-frontend
src/applications/accreditation @department-of-veterans-affairs/benefits-accredited-rep-facing-engineers @department-of-veterans-affairs/va-platform-cop-frontend

# Accredited Representation Management (ARM)
src/applications/representative-appoint @department-of-veterans-affairs/accredited-representation-management @department-of-veterans-affairs/va-platform-cop-frontend
Expand Down
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 .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ jobs:
cypress-tests:
name: Cypress E2E Tests
runs-on: ubuntu-16-cores-latest
timeout-minutes: 60
timeout-minutes: 120
needs: [build, tests-prep, fetch-ecr-credentials]
if: |
needs.build.result == 'success' &&
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/e2e-stress-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:

testing-reports-prep:
name: Testing Reports Prep
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
continue-on-error: true
outputs:
app_list: ${{ env.APPLICATION_LIST }}
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:

fetch-e2e-allow-list:
name: Fetch E2E Test Stability Allow List
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
Expand Down Expand Up @@ -329,7 +329,7 @@ jobs:

update-e2e-allow-list:
name: Update E2E Test Stability Allow List
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs:
[
testing-reports-prep,
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/gh-env-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: GitHub Environment Cleanup

on:
schedule:
- cron: 0 0 * * 1-5

jobs:
deploy:
name: Clean Up Environments
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: Configure AWS credentials
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 va-vsp-bot token
uses: ./.github/workflows/inject-secrets
with:
ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
env_variable_name: VA_VSP_BOT_GITHUB_TOKEN


- name: Clean up Environments
if: ${{ always() }}
run: node script/github-actions/gh-env-cleanup.js
env:
GITHUB_TOKEN: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@
"test": {
"presets": ["@babel/env", "@babel/preset-react"],
"plugins": [
["babel-plugin-transform-import-ignore", { "patterns": [".scss", ".css", ".sass"] }],
["istanbul", { "exclude": ["**/tests/**/*", "**/mocks/**/*"] }],
"transform-class-properties",
"dynamic-import-node",
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"babel-plugin-lodash": "^3.2.8",
"babel-plugin-module-resolver": "^5.0.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-import-ignore": "^1.1.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"babel-polyfill": "^6.26.0",
"browserify-zlib": "^0.2.0",
Expand Down Expand Up @@ -261,8 +262,8 @@
"@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/css-library": "^0.16.1",
"@department-of-veterans-affairs/component-library": "^48.4.0",
"@department-of-veterans-affairs/css-library": "^0.17.0",
"@department-of-veterans-affairs/react-jsonschema-form": "^1.2.5",
"@department-of-veterans-affairs/va-forms-system-core": "1.6.1",
"@department-of-veterans-affairs/vagov-platform": "^0.0.1",
Expand Down Expand Up @@ -334,7 +335,7 @@
"url-search-params-polyfill": "^8.1.1",
"uswds": "1.6.10",
"vanilla-lazyload": "^16.1.0",
"vets-json-schema": "https://github.com/department-of-veterans-affairs/vets-json-schema.git#6732ef3d0c5804484f7e3aa580333ecad29eb085",
"vets-json-schema": "https://github.com/department-of-veterans-affairs/vets-json-schema.git#75b0a0dd78b479e230867e89989bf3e8262d850c",
"web-vitals": "^4.2.4"
},
"resolutions": {
Expand Down
85 changes: 85 additions & 0 deletions script/github-actions/gh-env-cleanup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/* eslint-disable no-console */
/* eslint-disable camelcase */
/* eslint-disable no-await-in-loop */
/* eslint-disable consistent-return */
const { Octokit } = require('@octokit/rest');

const delay = ms => new Promise(resolve => setTimeout(resolve, ms));

const octokit = new Octokit({
auth: process.env.GITHUB_TOKEN,
});

const fetchAllEnvironments = async (owner, repo) => {
let environments = [];
let page = 1;

try {
while (true) {
console.log(`Fetching page ${page}...`);

const { data } = await octokit.request(
'GET /repos/{owner}/{repo}/environments',
{
owner,
repo,
per_page: 100,
page,
},
);

environments = environments.concat(data.environments);

if (data.environments.length === 0) {
break;
}

page += 1;
}

return environments;
} catch (error) {
console.error('Error fetching environments:', error);
process.exit(1);
}
};

const filterOldEnvironments = (environments, days) => {
const cutoffDate = new Date(Date.now() - days * 24 * 60 * 60 * 1000);
return environments.filter(env => {
const createdAt = new Date(env.created_at);
return createdAt < cutoffDate && env.protection_rules.length === 0;
});
};

const deleteEnvironment = async (owner, repo, environment) => {
try {
await octokit.request(
'DELETE /repos/{owner}/{repo}/environments/{environment_name}',
{
owner,
repo,
environment_name: environment.name,
},
);
console.log(`Successfully deleted environment: ${environment.name}`);
} catch (error) {
console.error(`Error deleting environment ${environment.name}:`, error);
}
};

const OWNER = 'department-of-veterans-affairs';
const REPO = 'vets-website';
const DAYS = 90;

(async () => {
const environments = await fetchAllEnvironments(OWNER, REPO);
const oldEnvironments = await filterOldEnvironments(environments, DAYS);

console.log('Deleting ', oldEnvironments.length, ` envioronments`);

for (const environment of oldEnvironments) {
await deleteEnvironment(OWNER, REPO, environment);
await delay(2000);
}
})();
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 8898f5e

Please sign in to comment.