Skip to content

Conversation

@lovisaberggren
Copy link
Collaborator

Proposed changes

Adding workflow to release IPA metrics to s3.

  • Uses staging creds and s3 bucket for now
  • Not included in release spec workflow, this workflow will be triggered manually to verify it works as expected

Follow up:

  • Add workflow to release-spec.yml run when we're confident it works as expected
  • Update failure-handler.yml to also consider ipa release run result status
  • Later on: When stable update to push to production s3 instead

Jira ticket: CLOUDP-290416

- name: Checkout
uses: actions/checkout@v4

- name: Get Previous Run Date and Status
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only run the release steps if the latest run was not today or if the last run ended in failure

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you clarify this decision? Adding a comment on the step would be beneficial to remember why we made this decision.

Why can't we run the workflow once a day automatically and file an issue on the repo in the event of a failure?

@lovisaberggren lovisaberggren marked this pull request as ready for review January 23, 2025 12:45
@lovisaberggren lovisaberggren requested a review from a team as a code owner January 23, 2025 12:45
- name: Run Metric Collection Job
if: ${{steps.get_previous_status.outputs.result == 'true' }}
working-directory: ./tools/spectral/ipa/metrics/scripts
run: node ./tools/spectral/ipa/metrics/scripts/runMetricCollection.js ../../../../../openapi-foas.json
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q1: Why don't we use the downloaded openapi-foas from the previous step?
Q2: If we set the working directory, do we need to give the full path for the script file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q1: It should use the downloaded foas, the downloaded one is named openapi-foas.yaml
Q2: Good catch, did a change and forgot to change the command, it should be node runMetricCollection.js ../../../../../openapi-foas.json, I'll update!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed it would be named something like openapi-foas-dev. Thanks for the info 👍

run: node runMetricCollection.js ../../../../../openapi-foas.json

- name: Dump Metric Collection Job Data to S3
if: ${{steps.get_previous_status.outputs.result == 'true' }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: we might use working-directory here as well


const lastRunDate = new Date(runs[1].created_at);
const today = new Date();
const lastRunWasToday =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: you can check if two dates are equal with checking if their toDateString() equal to each other
if(lastRunDate.toDateString() === today.toDateString())

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will also include hours, minutes and seconds, which may not be the same, so opted for only checking the day

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, it only outputs the day, month, and year (link)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nice, missed toDateString! I'll update

Copy link
Collaborator

@yelizhenden-mdb yelizhenden-mdb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Exciting! 🚀

@lovisaberggren lovisaberggren merged commit 1118fdc into main Jan 23, 2025
13 checks passed
@lovisaberggren lovisaberggren deleted the CLOUDP-290416 branch January 23, 2025 14:36
@@ -0,0 +1,81 @@
name: IPA Validation Metrics Release
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment at the top of this file explaining what the workflow is doing? What metrics release mean? where are they stored? By looking at the file is seems that it pushing something to s3 maybe but it is not really clear 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! I can add some comments to clarify

Comment on lines +5 to +10
# aws_access_key:
# required: true
# aws_secret_key:
# required: true
# aws_s3_bucket_prefix:
# required: true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you have these comments? Can we remove them?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These have been removed in this PR: https://github.com/mongodb/openapi/pull/388/files Where it's also included in the oas release workflow

Comment on lines +19 to +23
# inputs:
# env:
# description: 'Environment for the FOAS to use for IPA metrics collection'
# required: true
# type: string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- name: Checkout
uses: actions/checkout@v4

- name: Get Previous Run Date and Status
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you clarify this decision? Adding a comment on the step would be beneficial to remember why we made this decision.

Why can't we run the workflow once a day automatically and file an issue on the repo in the event of a failure?

Comment on lines +77 to +79
AWS_ACCESS_KEY_ID: ${{ secrets.IPA_S3_BUCKET_DW_STAGING_USERNAME }} # TODO: Change to passed secret
AWS_SECRET_ACCESS_KEY: ${{ secrets.IPA_S3_BUCKET_DW_STAGING_PASSWORD }} # TODO: Change to passed secret
S3_BUCKET_PREFIX: ${{ secrets.IPA_S3_BUCKET_DW_STAGING_PREFIX }} # TODO: Change to passed secret
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the remove the todo comments?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lovisaberggren
Copy link
Collaborator Author

@andreaangiolillo

Could you clarify this decision? Adding a comment on the step would be beneficial to remember why we made this decision.

This was a request on the scope, to add a check before uploading the IPA metrics so that:

  • If it already ran today, skip (the metrics don't need to be updated more than once a day)
  • If the last run failed, run the job

I can add some comments to clarify what it does

Why can't we run the workflow once a day automatically and file an issue on the repo in the event of a failure?

We wanted to run the workflow as part of the oas release, so that it's triggered only if there are changes detected (similarly to postman release), currently this is covered in the follow up PR which also includes IPA release in the failure-handler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants