Skip to content

Commit

Permalink
Merge branch 'master' into 91501-add-swagger-documentation-for-repres…
Browse files Browse the repository at this point in the history
…entationmanagementv0pdfgenerator2122acontroller
  • Loading branch information
opticbob authored Nov 18, 2024
2 parents 6facc58 + d4bd565 commit 07a9d85
Show file tree
Hide file tree
Showing 855 changed files with 34,426 additions and 12,338 deletions.
119 changes: 62 additions & 57 deletions .github/CODEOWNERS

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions .github/workflows/backend-pr-approver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Backend PR Approver
on:
workflow_run:
workflows:
- "Backend PR Labeler"
types: [completed]
jobs:
say-hi:
runs-on: ubuntu-latest
steps:
- name: Say Hi
run: |
echo "Hi"
206 changes: 206 additions & 0 deletions .github/workflows/backend-pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
name: Backend PR Labeler
on:
pull_request:
types: [opened, reopened, review_requested, review_request_removed, ready_for_review, converted_to_draft, labeled, unlabeled]
pull_request_review:
types: [submitted]
workflow_run:
workflows:
- "Code Checks"
types: [completed]
jobs:
get-pr-data:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
pr_number: ${{ steps.get_pr_data.outputs.pr_number }}
pr_draft: ${{ steps.get_pr_data.outputs.pr_draft }}
pr_labels: ${{ steps.get_pr_data.outputs.pr_labels }}
pr_requested_teams: ${{ steps.get_pr_data.outputs.pr_requested_teams }}
steps:
- name: Get pull_request data
id: get_pr_data
run: |
if ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_review'}}; then
echo "pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
echo "pr_draft=${{ github.event.pull_request.draft }}" >> $GITHUB_OUTPUT
echo "pr_labels=$(echo '${{ toJSON(github.event.pull_request.labels.*.name) }}' | jq -c '.')" >> $GITHUB_OUTPUT
echo "pr_requested_teams=$(echo '${{ toJSON(github.event.pull_request.requested_teams.*.name) }}' | jq -c '.')" >> $GITHUB_OUTPUT
elif ${{ github.event_name == 'workflow_run' }}; then
if ${{ github.event.workflow_run.event == 'push' }}; then
echo "Workflow was triggered by push to ${{ github.event.workflow_run.head_branch }}. Labeling not required."
exit 0
elif ${{ toJSON(github.event.workflow_run.pull_requests) != '[]' }}; then
PR_NUMBER="${{ github.event.workflow_run.pull_requests[0].number }}"
echo "pr_number=${PR_NUMBER}" >> $GITHUB_OUTPUT
# Fetch PR details from GitHub API
PR_INFO=$(gh api /repos/${{ github.repository }}/pulls/${PR_NUMBER} --jq '{
draft: .draft,
labels: [.labels[].name],
requested_teams: [.requested_teams[].slug]
}')
# Extract and store individual fields
echo "pr_draft=$(echo "$PR_INFO" | jq -r '.draft')" >> $GITHUB_OUTPUT
echo "pr_labels=$(echo "$PR_INFO" | jq -c '.labels')" >> $GITHUB_OUTPUT
echo "pr_requested_teams=$(echo "$PR_INFO" | jq -c '.requested_teams')" >> $GITHUB_OUTPUT
else
echo "Workflow run has no associated pull requests. Labeling not performed."
exit 0
fi
else
echo "event_name: ${{ github.event_name }}"
echo "Pull Request not successfully retrieved."
exit 1
fi
- name: Echo PR data
if: ${{ steps.get_pr_data.outputs.pr_number != '' }}
run: |
echo "pr_number: ${{ steps.get_pr_data.outputs.pr_number }}"
echo "pr_draft: ${{ steps.get_pr_data.outputs.pr_draft }}"
echo "pr_labels: ${{ steps.get_pr_data.outputs.pr_labels }}"
echo "pr_labels: ${{ fromJson(steps.get_pr_data.outputs.pr_labels)[0] }}"
echo "pr_requested_teams: ${{ steps.get_pr_data.outputs.pr_requested_teams }}"
echo "pr_requested_teams: ${{ fromJSON(steps.get_pr_data.outputs.pr_requested_teams)[0] }}"
check-pr-status:
runs-on: ubuntu-latest
needs: get-pr-data
if: ${{ needs.get-pr-data.outputs.pr_number != '' }}
env:
pr_labels: ${{ needs.get-pr-data.outputs.pr_labels }}
pr_requested_teams: ${{ needs.get-pr-data.outputs.pr_requested_teams }}
outputs:
test_status: ${{ steps.get_code_checks_conclusion.outputs.test_status }}
exempt: ${{ steps.check_exemption.outputs.exempt }}
failures_detected: ${{ steps.audit_pr_labels.outputs.failures_detected }}
steps:
- name: Print vars (DELETE ME)
run: |
echo "pr_labels=${{ needs.get-pr-data.outputs.pr_labels }}"
echo "pr_requested_teams=${{ needs.get-pr-data.outputs.pr_requested_teams }}"
- name: Get Code Checks result
if: github.event_name == 'workflow_run'
run: |
echo "test_status=${{ github.event.workflow_run.conclusion }}" >> $GITHUB_OUTPUT
echo "test_status: ${{ github.event.workflow_run.conclusion }}"
- name: Check for exemption
id: check_exemption
run: |
if ${{ contains(fromJSON(env.pr_requested_teams), 'backend-review-group') }}; then
echo "exempt=false" >> $GITHUB_OUTPUT
echo "PR requires backend approval."
else
echo "exempt=true" >> $GITHUB_OUTPUT
echo "PR is exempt from backend approval."
fi
- name: Check for failure labels
id: audit_pr_labels
run: |
if \
${{ contains(env.pr_labels, 'code-health-failure') }} || \
${{ contains(env.pr_labels, 'codeowners-addition-failure') }} || \
${{ contains(env.pr_labels, 'codeowners-delete-failure') }} || \
${{ contains(env.pr_labels, 'lint-failure') }} || \
${{ contains(env.pr_labels, 'test-failure') }} ; then
echo "failures_detected=true" >> $GITHUB_OUTPUT
echo "Failure labels detected."
else
echo "failures_detected=false" >> $GITHUB_OUTPUT
echo "No failure labels detected."
fi
check-approvals:
runs-on: ubuntu-latest
needs: [get-pr-data, check-pr-status]
if: ${{ needs.check-pr-status.outputs.exempt == 'false' && needs.check-pr-status.outputs.pr_draft == 'false' }}
env:
pr_number: ${{ needs.get-pr-data.outputs.pr_number }}
outputs:
approval_status: ${{ steps.verify_approval.outputs.approval_status }}
steps:
- name: Print vars (DELETE ME)
run: |
echo "pr_number=${{ env.pr_number }}"
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-access-key-id: ${{ secrets.aws_access_key_id }}
aws-secret-access-key: ${{ secrets.aws_secret_access_key }}
aws-region: "us-gov-west-1"

- name: Get bot token from Parameter Store
uses: marvinpinto/action-inject-ssm-secrets@latest
with:
ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
env_variable_name: VA_VSP_BOT_GITHUB_TOKEN

- name: Get PR Reviews
id: get_pr_reviews
uses: octokit/request-action@v2.x
with:
route: GET /repos/${{ github.repository }}/pulls/${{ env.pr_number }}/reviews
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get backend-review-group members
id: get_team_members
uses: octokit/request-action@v2.x
with:
route: GET /orgs/department-of-veterans-affairs/teams/backend-review-group/members
env:
GITHUB_TOKEN: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }}

# Confirm an approval exists from at least one BE team member
- name: Verify backend-review-group approval
id: verify_approval
run: |
BACKEND_REVIEWERS=$(cat <<'EOF' | jq -r '.[].login' | tr '\n' '|' | sed 's/|$//'
${{ steps.get_team_members.outputs.data }}
EOF
)
APPROVALS=$(cat <<'EOF' | jq -r '.[] | select(.state == "APPROVED") | .user.login' | grep -iE "$BACKEND_REVIEWERS" | wc -l
${{ steps.get_pr_reviews.outputs.data }}
EOF
)
echo "Number of backend-review-group approvals: $APPROVALS"
if [ "$APPROVALS" -eq 0 ]; then
echo "approval_status=required" >> $GITHUB_OUTPUT
echo "Backend-review-group approval required."
else
echo "approval_status=confirmed" >> $GITHUB_OUTPUT
echo "Backend-review-group approval confirmed."
fi
apply-labels:
runs-on: ubuntu-latest
needs: [get-pr-data, check-pr-status, check-approvals]
if: ${{ always() }}
env:
exempt: ${{ needs.check-pr-status.outputs.exempt }}
pr_number: ${{ needs.get-pr-data.outputs.pr_number }}
pr_draft: ${{ needs.get-pr-data.outputs.pr_draft }}
pr_labels: ${{ needs.get-pr-data.outputs.pr_labels }}
test_status: ${{ needs.check-pr-status.outputs.test_status }}
failures_detected: ${{ needs.check-pr-status.outputs.failures_detected }}
approval_status: ${{ needs.check-approvals.outputs.approval_status }}
steps:
- name: print vars (DELETE ME)
id: print-vars
run: |
echo ${{ env.exempt }}
echo ${{ env.pr_number }}
echo ${{ env.pr_draft }}
echo ${{ env.pr_labels }}
echo ${{ env.test_status }}
echo ${{ env.failures_detected }}
echo ${{ env.approval_status }}
2 changes: 0 additions & 2 deletions .github/workflows/be_review_prs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: Require backend-review-group approval
on:
pull_request:
types: [opened, reopened, review_requested, synchronize, ready_for_review]
pull_request_review:
types: [submitted]

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check_codeowners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Respond to PR if check CODEOWNERS exists for new files fails
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@e2c37e53a7d2227b61585343765f73a9ca57eda9 # v3.0.0
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
message: 'Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: ${{ env.offending_file }}'
GITHUB_TOKEN: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }}
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
- name: Respond to PR if check CODEOWNERS exists for deleted files fails
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@e2c37e53a7d2227b61585343765f73a9ca57eda9 # v3.0.0
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
message: 'Error: A file (or its parent directories) was deleted but its reference still exists in CODEOWNERS. Please update the .github/CODEOWNERS file and delete the entry for the Offending file: ${{ env.offending_file }}'
GITHUB_TOKEN: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
env:
BUNDLE_ENTERPRISE__CONTRIBSYS__COM: ${{ secrets.BUNDLE_ENTERPRISE__CONTRIBSYS__COM }}
permissions: write-all
runs-on: ubuntu-16-cores-latest
runs-on: ubuntu-32-cores-latest
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
permissions: write-all
runs-on: ubuntu-16-cores-latest
runs-on: ubuntu-32-cores-latest
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -131,13 +131,13 @@ jobs:
max_attempts: 3
command: |
docker compose -f docker-compose.test.yml run web bash \
-c "CI=true RAILS_ENV=test DISABLE_BOOTSNAP=true bundle exec parallel_test -n 13 -e 'bin/rails db:reset'"
-c "CI=true RAILS_ENV=test DISABLE_BOOTSNAP=true bundle exec parallel_test -n 24 -e 'bin/rails db:reset'"
- name: Run Specs
timeout-minutes: 20
run: |
docker compose -f docker-compose.test.yml run web bash \
-c "CI=true DISABLE_BOOTSNAP=true bundle exec parallel_rspec spec/ modules/ -n 13 -o '--color --tty'"
-c "CI=true DISABLE_BOOTSNAP=true bundle exec parallel_rspec spec/ modules/ -n 24 -o '--color --tty'"
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
Expand Down
38 changes: 32 additions & 6 deletions .github/workflows/deploy_delay_notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest

outputs:
development_summary: ${{ steps.check-dev-status.outputs.dev_summary }}
dev_summary: ${{ steps.check-dev-status.outputs.dev_summary }}
staging_summary: ${{ steps.check-staging-status.outputs.staging_summary }}

steps:
Expand Down Expand Up @@ -40,6 +40,7 @@ jobs:
echo "staging_deployed_sha=${deployed_sha}" >> $GITHUB_ENV
- name: Check deployment status for development
if: ${{ env.latest_sha != '' && env.dev_deployed_sha != '' }}
id: check-dev-status
run: |
latest_sha=${{ env.latest_sha }}
Expand All @@ -66,7 +67,7 @@ jobs:
fi
- name: Check deployment status for staging
if: always()
if: ${{ always() && env.latest_sha != '' && env.staging_deployed_sha != '' }}
id: check-staging-status
run: |
latest_sha=${{ env.latest_sha }}
Expand Down Expand Up @@ -94,6 +95,9 @@ jobs:
notify-on-failure:
runs-on: ubuntu-latest
needs: [check-deployment]
env:
dev_summary: ${{ needs.check-deployment.outputs.dev_summary }}
staging_summary: ${{ needs.check-deployment.outputs.staging_summary }}
if: ${{ failure() }}
steps:
- name: Configure AWS Credentials
Expand Down Expand Up @@ -128,21 +132,43 @@ jobs:
env_variable_name: SLACK_BOT_TOKEN

- name: Notify for deployment failure
if: ${{ env.latest_sha != '' }}
if: ${{ env.dev_summary != '' || env.staging_summary != '' }}
uses: ./.github/actions/vsp-github-actions/slack-socket
with:
slack_app_token: ${{ env.SLACK_APP_TOKEN }}
slack_bot_token: ${{ env.SLACK_BOT_TOKEN }}
message: "Vets API Deployment Delay:"
blocks: "[{\"type\": \"divider\"}, {\"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \":scared_and_sweating_smiley: GitHub Action Runner Workflow failed! :scared_and_sweating_smiley:\n <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} Run #${{ github.run_number }}>\n\n*Development Summary:*\n${{ needs.check-deployment.outputs.development_summary }}\n\n*Staging Summary:*\n${{ needs.check-deployment.outputs.staging_summary }}\"}}, {\"type\": \"divider\"}]"
blocks: |
[
{ "type": "divider" },
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":scared_and_sweating_smiley: GitHub Action Runner Workflow failed! :scared_and_sweating_smiley:\n <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} Run #${{ github.run_number }}>\n\n *Development Summary:*\n${{ env.dev_summary }}\n\n *Staging Summary:*\n${{ env.staging_summary }}"
}
},
{ "type": "divider" }
]
channel_id: "C039HRTHXDH"

- name: Notify for other failure
if: ${{ env.latest_sha == '' }}
if: ${{ env.dev_summary == '' && env.staging_summary == '' }}
uses: ./.github/actions/vsp-github-actions/slack-socket
with:
slack_app_token: ${{ env.SLACK_APP_TOKEN }}
slack_bot_token: ${{ env.SLACK_BOT_TOKEN }}
message: "Vets API Deployment Delay:"
blocks: "[{\"type\": \"divider\"}, {\"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \":scared_and_sweating_smiley: GitHub Action Runner Workflow failed! :scared_and_sweating_smiley:\n\n Unknown error occured. See logs:\n<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} Run #${{ github.run_number }}>\"}}, {\"type\": \"divider\"}]"
blocks: |
[
{ "type": "divider" },
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":scared_and_sweating_smiley: GitHub Action Runner Workflow failed! :scared_and_sweating_smiley:\n\n Unknown error occured. See logs:\n <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} Run #${{ github.run_number }}>"
}
},
{ "type": "divider" }
]
channel_id: "C039HRTHXDH"
1 change: 1 addition & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ Lint/MissingSuper:
- 'lib/search_typeahead/service.rb'
- 'lib/token_validation/v2/client.rb'
- 'lib/va_profile/address_validation/service.rb'
- 'lib/va_profile/v3/address_validation/service.rb'
- 'lib/va_profile/service.rb'
- 'lib/vbs/requests/list_statements.rb'
- 'lib/vic/id_card_attribute_error.rb'
Expand Down
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ path 'modules' do
gem 'apps_api'
gem 'ask_va_api'
gem 'avs'
gem 'banners'
gem 'burials'
gem 'check_in'
gem 'claims_api'
Expand Down Expand Up @@ -63,7 +64,7 @@ gem 'connect_vbms', git: 'https://github.com/adhocteam/connect_vbms', tag: 'v2.1
gem 'csv'
gem 'date_validator'
gem 'ddtrace'
gem 'dogstatsd-ruby', '5.6.2'
gem 'dogstatsd-ruby', '5.6.3'
gem 'dry-struct'
gem 'dry-types'
gem 'ethon', '>=0.13.0'
Expand Down
Loading

0 comments on commit 07a9d85

Please sign in to comment.