-
Notifications
You must be signed in to change notification settings - Fork 2
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
DIG-1669: Automate incrementing schema version when schemas get updated #235
Conversation
- increase schema_version on update - remove SHA ref
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #235 +/- ##
===========================================
+ Coverage 96.72% 96.99% +0.27%
===========================================
Files 35 35
Lines 3569 3557 -12
===========================================
- Hits 3452 3450 -2
+ Misses 117 107 -10 ☔ View full report in Codecov by Sentry. |
The number in schema_version.txt is just a random number. It could be 1, but I put 440 because katsu version is 4.4.0. |
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.
I would like the schema version value to be meaningful in some way. Could it be the commit sha of schema.json or schema.yml? Once those have been updated, their shas should stay consistent if we're not overwriting them in a github action, right?
.github/workflows/update-schema.yaml
Outdated
- name: Install PyYAML | ||
run: pip install PyYAML | ||
|
||
- name: Convert schema.json to schema.yml | ||
run: python -c 'import json, yaml; json.load(open("chord_metadata_service/mohpackets/docs/schema.json")); print(yaml.dump(json.load(open("chord_metadata_service/mohpackets/docs/schema.json"))))' > chord_metadata_service/mohpackets/docs/schema.yml | ||
|
||
- name: Update schemas with SHA | ||
- name: Increment schema version |
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.
Is there a reason we can't use the SHA of the updated schema.yml (or schema.json, whichever) document as the schema version?
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.
The problem is the current branch SHA will get deleted once it merges. Sure I can put the SHA in, but if someone were to go back and find it, they won't be able to.
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.
unless we want to keep all the branchs PR around
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.
Not the branch SHA, the file sha. That stays around.
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.
For example, in this deleted branch https://github.com/CanDIG/htsget_app/blob/9d00ade5811bf48727b7b73516c30d06796d5f81/tests/test_htsget_server.py and in the stable branch it was merged into https://github.com/CanDIG/htsget_app/blob/stable/tests/test_htsget_server.py, the sha for test_htsget_server.py is 6429207.
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.
Sure, I can try that
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.
maybe that's not the file sha, I mean the commit sha.
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.
6429207 is the sha for the commit, whether it is in the deleted merged PR branch or in the stable branch it was merged into. So if a change was made to schema.json, which is triggering this schema version update, there should be a corresponding commit sha for that.
schema_version now uses commit version instead of auto-increasing number |
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.
You probably don't want to force the schema_version to an int in get_schema_version(); otherwise this looks good.
Co-authored-by: Daisie Huang <[email protected]>
What's new
How to test