Skip to content

IPA Validation Metrics Release #325

IPA Validation Metrics Release

IPA Validation Metrics Release #325

# This workflow will generate metrics about the IPA validation on the current OAS
# (number of adoptions, violations and exceptions) and upload the data to an S3 bucket.
name: IPA Validation Metrics Release
on:
schedule:
- cron: '0 11 * * *' # Runs daily at 11:00 UTC (11 AM UTC)
workflow_dispatch:
permissions:
issues: write
contents: write
id-token: write
jobs:
# Generates and uploads the IPA validation metrics to S3
release-IPA-metrics:
name: Release IPA Validation Metrics
runs-on: ubuntu-latest
steps:
- name: Checkout repository (scripts)
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
with:
sparse-checkout: |
tools/spectral/ipa
package.json
package-lock.json
.github/scripts
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '20.x'
cache: 'npm'
- name: Install npm dependencies
run: npm install
- name: Fetch OAS file from Dev Branch
run: curl -O "https://raw.githubusercontent.com/mongodb/openapi/refs/heads/dev/openapi/.raw/v2.json"
working-directory: ${{ github.workspace }}
- name: Run Metric Collection Job
id: metric-collection
working-directory: tools/spectral/ipa/metrics/scripts
run: |
node runMetricCollection.js "${{ github.workspace }}/v2.json"
- name: aws configure
uses: aws-actions/configure-aws-credentials@v5
with:
role-to-assume: ${{ vars.IPA_METRIC_COLLECTION_AWS_S3_ROLE_TO_ASSUME_PROD }}
aws-region: ${{ vars.AWS_DEFAULT_REGION }}
- name: Dump Metric Collection Job Data to S3
env:
AWS_REGION: ${{ vars.AWS_DEFAULT_REGION }}
S3_BUCKET_PREFIX: ${{ secrets.IPA_S3_BUCKET_DW_PROD_PREFIX }}
working-directory: tools/spectral/ipa/metrics/scripts
run: node dataDump.js
# Enable this step in scope of CLOUDP-339852
# - name: Handle Warning Violations
# if: ${{ steps.metric-collection.outputs.warning_count > 0 }}
# env:
# WARNING_COUNT: ${{ steps.metric-collection.outputs.warning_count }}
# TEAM_ID: ${{ vars.JIRA_TEAM_ID_APIX_PLATFORM }}
# JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
# SLACK_BEARER_TOKEN: ${{ secrets.SLACK_BEARER_TOKEN }}
# SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID_APIX_PLATFORM_DEV }}
# SLACK_ONCALL_USER: ${{ secrets.SLACK_APIX_PLATFORM_ONCALL_USER }}
# run: .github/scripts/handle_warning_violations.sh
failure-handler:
name: Failure Handler
needs: [ release-IPA-metrics ]
if: ${{ failure() }}
uses: ./.github/workflows/failure-handler.yml
with:
env: 'dev'
release_name: "IPA Metrics"
team_id: ${{ vars.JIRA_TEAM_ID_APIX_PLATFORM }}
secrets:
jira_api_token: ${{ secrets.JIRA_API_TOKEN }}