Skip to content

Commit

Permalink
Merge branch 'master' into API-replace-bgs-ext-flash-updater
Browse files Browse the repository at this point in the history
merges master
  • Loading branch information
stiehlrod committed Nov 14, 2024
2 parents b5855f1 + ab28b3e commit eb92488
Show file tree
Hide file tree
Showing 167 changed files with 3,435 additions and 2,167 deletions.
7 changes: 2 additions & 5 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ app/controllers/concerns/sign_in @department-of-veterans-affairs/octo-identity
app/controllers/concerns/third_party_transaction_logging.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/concerns/traceable.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/concerns/vet360 @department-of-veterans-affairs/vfs-authenticated-experience-backend @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/facilities_controller.rb @department-of-veterans-affairs/vfs-facilities-frontend @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/flipper_controller.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/gids_controller.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/v0/income_and_assets_claims_controller.rb @department-of-veterans-affairs/pension-and-burials @department-of-veterans-affairs/backend-review-group
Expand Down Expand Up @@ -130,6 +129,7 @@ app/controllers/v0/prescription_preferences_controller.rb @department-of-veteran
app/controllers/v0/prescriptions_controller.rb @department-of-veterans-affairs/vfs-mhv-medications @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/v0/profile @department-of-veterans-affairs/vfs-authenticated-experience-backend @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/v0/profile/contacts_controller.rb @department-of-veterans-affairs/vfs-authenticated-experience-backend @department-of-veterans-affairs/vfs-mhv-integration @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/v0/profile/vet_verification_statuses_controller.rb @department-of-veterans-affairs/va-iir @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/v0/rated_disabilities_controller.rb @department-of-veterans-affairs/benefits-management-tools-be @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/v0/rated_disabilities_discrepancies_controller.rb @department-of-veterans-affairs/benefits-management-tools-be @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/v0/search_click_tracking_controller.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
Expand All @@ -154,7 +154,6 @@ app/controllers/v0/virtual_agent_token_nlu_controller.rb @department-of-veterans
app/controllers/v0/virtual_agent/virtual_agent_appeal_controller.rb @department-of-veterans-affairs/vfs-virtual-agent-chatbot @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/v0/virtual_agent/virtual_agent_claim_status_controller.rb @department-of-veterans-affairs/vfs-virtual-agent-chatbot @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/v0/veteran_onboardings_controller.rb @department-of-veterans-affairs/backend-review-group @department-of-veterans-affairs/va-iir
app/controllers/v1/facilities @department-of-veterans-affairs/vfs-facilities-frontend @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/v1/gids @department-of-veterans-affairs/govcio-vfep-codereviewers @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/controllers/v1/higher_level_reviews_controller.rb @department-of-veterans-affairs/benefits-decision-reviews-be @department-of-veterans-affairs/backend-review-group
app/controllers/v1/higher_level_reviews @department-of-veterans-affairs/benefits-decision-reviews-be @department-of-veterans-affairs/backend-review-group
Expand Down Expand Up @@ -579,13 +578,11 @@ app/swagger/swagger/schemas/vet360/states.rb @department-of-veterans-affairs/vfs
app/swagger/swagger/schemas/vet360/telephone.rb @department-of-veterans-affairs/vfs-authenticated-experience-backend @department-of-veterans-affairs/backend-review-group
app/swagger/swagger/schemas/vet360/zipcodes.rb @department-of-veterans-affairs/vfs-authenticated-experience-backend @department-of-veterans-affairs/backend-review-group
app/swagger/swagger/schemas/virtual_agent_webchat_token.rb @department-of-veterans-affairs/vfs-virtual-agent-chatbot @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/swagger/swagger/v1/requests/facilities.rb @department-of-veterans-affairs/vfs-facilities-frontend @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/swagger/swagger/v1/requests/income_limits.rb @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/swagger/swagger/v1/requests/ivc_champva_forms.rb @department-of-veterans-affairs/champva-engineering @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/swagger/swagger/v1/requests/appeals/appeals.rb @department-of-veterans-affairs/backend-review-group @department-of-veterans-affairs/benefits-decision-reviews-be
app/swagger/swagger/v1/schemas/appeals @department-of-veterans-affairs/backend-review-group
app/swagger/swagger/v1/schemas/appeals/decision_review_evidence.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group @department-of-veterans-affairs/benefits-decision-reviews-be
app/swagger/swagger/v1/schemas/facilities.rb @department-of-veterans-affairs/vfs-facilities-frontend @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/swagger/swagger/v1/schemas/income_limits.rb @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/uploaders/async_processing.rb @department-of-veterans-affairs/vfs-authenticated-experience-backend @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/uploaders/claim_documentation @department-of-veterans-affairs/benefits-non-disability @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
Expand Down Expand Up @@ -1617,6 +1614,7 @@ spec/models/schema_contract @department-of-veterans-affairs/va-api-engineers @de
spec/models/saml_request_tracker_spec.rb @department-of-veterans-affairs/octo-identity
spec/models/saved_claim @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/models/saved_claim/income_and_assets_spec.rb @department-of-veterans-affairs/pension-and-burials @department-of-veterans-affairs/backend-review-group
spec/models/saved_claim_spec.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/models/secondary_appeal_form_spec.rb @department-of-veterans-affairs/benefits-decision-reviews-be @department-of-veterans-affairs/backend-review-group
spec/models/session_spec.rb @department-of-veterans-affairs/octo-identity @department-of-veterans-affairs/octo-identity
spec/models/sign_in @department-of-veterans-affairs/octo-identity
Expand Down Expand Up @@ -1728,7 +1726,6 @@ spec/requests/v0/disability_compensation_form_spec.rb @department-of-veterans-af
spec/requests/v1/higher_level_reviews @department-of-veterans-affairs/benefits-decision-reviews-be @department-of-veterans-affairs/backend-review-group
spec/requests/v1/notice_of_disagreements @department-of-veterans-affairs/benefits-decision-reviews-be @department-of-veterans-affairs/backend-review-group
spec/requests/v1/supplemental_claims @department-of-veterans-affairs/benefits-decision-reviews-be @department-of-veterans-affairs/backend-review-group
spec/requests/v1/facilities @department-of-veterans-affairs/vfs-facilities-frontend @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/requests/v1/apidoc @department-of-veterans-affairs/backend-review-group
spec/requests/v1/higher_level_reviews_spec.rb @department-of-veterans-affairs/benefits-decision-reviews-be @department-of-veterans-affairs/backend-review-group
spec/requests/v1/notice_of_disagreements_spec.rb @department-of-veterans-affairs/backend-review-group @department-of-veterans-affairs/benefits-decision-reviews-be
Expand Down
166 changes: 142 additions & 24 deletions .github/workflows/backend-pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,55 @@ on:
- "Code Checks"
types: [completed]
jobs:
check-pr-status:
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 }}
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: Get pull_request data
id: get_pr_data
run: |
if ${{ github.event_name == 'pull_request'}}; then
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 == 'pull_request_review' }}; then
echo "pr_number=${{ github.event.pull_request_review.pull_request.number }}" >> $GITHUB_OUTPUT
echo "pr_draft=${{ github.event.pull_request_review.pull_request.draft }}" >> $GITHUB_OUTPUT
echo "pr_labels=$(echo '${{ toJSON(github.event.pull_request_review.pull_request.labels.*.name) }}' | jq -c '.')" >> $GITHUB_OUTPUT
echo "pr_requested_teams=$(echo '${{ toJSON(github.event.pull_request_review.pull_request.requested_teams.*.name) }}' | jq -c '.')" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "workflow_run" ]] && [[ "${{ toJSON(github.event.workflow_run.pull_requests) }}" != "[]" ]]; then
echo "pr_number=${{ github.event.workflow_run.pull_requests[0].number }}" >> $GITHUB_OUTPUT
echo "pr_draft=${{ github.event.workflow_run.pull_requests[0].draft }}" >> $GITHUB_OUTPUT
echo "pr_labels=$(echo '${{ toJSON(github.event.workflow_run.pull_requests[0].labels.*.name) }}' | jq -c '.')" >> $GITHUB_OUTPUT
echo "pr_requested_teams=$(echo '${{ toJSON(github.event.workflow_run.pull_requests[0].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 }}"
Expand All @@ -52,6 +66,23 @@ jobs:
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: |
Expand All @@ -61,7 +92,7 @@ jobs:
- name: Check for exemption
id: check_exemption
run: |
if ${{ contains(fromJSON(steps.get_pr_data.outputs.pr_requested_teams), 'backend-review-group') }}; then
if ${{ contains(fromJSON(env.pr_requested_teams), 'backend-review-group') }}; then
echo "exempt=false" >> $GITHUB_OUTPUT
echo "PR requires backend approval."
else
Expand All @@ -71,18 +102,105 @@ jobs:
- name: Check for failure labels
id: audit_pr_labels
env:
labels: ${{ steps.get_pr_data.outputs.pr_labels }}
run: |
if \
${{ contains(env.labels, 'code-health-failure') }} ||\
${{ contains(env.labels, 'codeowners-addition-failure') }} ||\
${{ contains(env.labels, 'codeowners-delete-failure') }} ||\
${{ contains(env.labels, 'lint-failure') }} ||\
${{ contains(env.labels, 'test-failure') }} ; then
${{ 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
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/[email protected]
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/[email protected]
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/[email protected]
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: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,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 eb92488

Please sign in to comment.