-
Notifications
You must be signed in to change notification settings - Fork 14
CLOUDP-298521: Decouple IPA Metrics Collection Job from FOAS Release GH Workflow #401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
8eb4be9
8dc3505
e0f30db
7b96f33
d62d16d
902f3f3
ef5446f
a14c9ca
6ac0539
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,56 +2,20 @@ | |
| # (number of adoptions, violations and exceptions) and upload the data to an S3 bucket. | ||
| name: IPA Validation Metrics Release | ||
| on: | ||
| workflow_call: | ||
| secrets: # all secrets are passed explicitly in this workflow | ||
| aws_access_key: | ||
| required: true | ||
| aws_secret_key: | ||
| required: true | ||
| aws_s3_bucket_prefix: | ||
| required: true | ||
| api_bot_pat: | ||
| required: true | ||
| inputs: | ||
| env: | ||
| description: 'Environment for the FOAS to use for IPA metrics collection' | ||
| required: true | ||
| type: string | ||
| schedule: | ||
| - cron: '0 22 * * *' # Runs daily at 22:00 UTC (10 PM UTC) | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| issues: write | ||
| env: | ||
| NODE_VERSION: '20.x' | ||
| WORKING_DIR: ./tools/spectral/ipa/metrics/scripts | ||
| RELEASE_ENV: 'dev' | ||
yelizhenden-mdb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| jobs: | ||
| # Checks the last workflow run, and decides whether the IPA release metrics should be uploaded or | ||
| # skipped. The release-IPA-metrics job only runs if the last release was not today and did not fail. | ||
| pre-IPA-metrics-release-checks: | ||
| name: IPA Metrics Release Pre-Checks | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| should_run_release: ${{ steps.get_previous_status.outputs.result }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Get Previous Run Date and Status | ||
| id: get_previous_status | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| github-token: ${{ secrets.api_bot_pat }} | ||
| script: | | ||
| const { default: getShouldRunMetricsRelease } = await import('${{ github.workspace }}/tools/spectral/ipa/metrics/scripts/getShouldRunMetricsRelease.js') | ||
yelizhenden-mdb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const shouldRunRelease = await getShouldRunMetricsRelease({github, context}).catch((error) => { | ||
| console.error(error.message); | ||
| process.exit(1) | ||
| }) | ||
| return shouldRunRelease | ||
|
|
||
| # Generates and uploads the IPA validation metrics to S3 | ||
| release-IPA-metrics: | ||
| name: Release IPA Validation Metrics | ||
| needs: [pre-IPA-metrics-release-checks] | ||
| if: ${{ needs.pre-IPA-metrics-release-checks.outputs.should_run_release == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
yelizhenden-mdb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
@@ -60,7 +24,7 @@ jobs: | |
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20.x' | ||
| node-version: $NODE_VERSION | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI: It is possible to reference local variables this way (https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#defining-environment-variables-for-a-single-workflow) |
||
| cache: 'npm' | ||
|
|
||
| - name: Install npm dependencies | ||
|
|
@@ -69,18 +33,28 @@ jobs: | |
| - name: Download openapi-foas | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: openapi-foas-${{ inputs.env }} | ||
| github-token: ${{ secrets.api_bot_pat }} | ||
| run-id: ${{ github.run_id }} | ||
| name: openapi-foas-$RELEASE_ENV | ||
| github-token: ${{ secrets.API_BOT_PAT }} | ||
yelizhenden-mdb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - name: Run Metric Collection Job | ||
| working-directory: ./tools/spectral/ipa/metrics/scripts | ||
| working-directory: $WORKING_DIR | ||
| run: node runMetricCollection.js ../../../../../openapi-foas.json | ||
|
|
||
| - name: Dump Metric Collection Job Data to S3 | ||
| env: | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_key }} | ||
| S3_BUCKET_PREFIX: ${{ secrets.aws_s3_bucket_prefix }} | ||
| working-directory: ./tools/spectral/ipa/metrics/scripts | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.IPA_S3_BUCKET_DW_STAGING_USERNAME }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.IPA_S3_BUCKET_DW_STAGING_PASSWORD }} | ||
| S3_BUCKET_PREFIX: ${{ secrets.IPA_S3_BUCKET_DW_STAGING_PREFIX }} | ||
| working-directory: $WORKING_DIR | ||
| run: node dataDump.js | ||
|
|
||
| failure-handler: | ||
| name: Failure Handler | ||
| needs: [ release-IPA-metrics ] | ||
| if: ${{ failure() }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| uses: ./.github/workflows/failure-handler.yml | ||
| with: | ||
| env: $RELEASE_ENV | ||
| release_name: "OpenAPI Spec" | ||
yelizhenden-mdb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| secrets: | ||
| jira_api_token: ${{ secrets.JIRA_API_TOKEN }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the reasons to run it outside working hours? Keep in mind that you will get a notification if the action fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Changed it to 11:00 AM. Do we have any standards around it?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related: Perhaps we should only run mon-fri as well? The OASes don't get updated during the weekend either AFAIK
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it is up to the team. Ideally, it should be working hours so that we can action on failure
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but the metric collection job is not related to OAS updates anymore. And, DPE team asked us to send the data every day if possible. I checked with them about skipping weekend, but they need the data to be sent every day