-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add a table to keep product channel versions and APIs to update them #1465
Conversation
4b3649d
to
933ff85
Compare
To grant shipitscript scopes to call the API to update versions we'd need a patch in ci-configuration: diff --git a/clients.yml b/clients.yml
--- a/clients.yml
+++ b/clients.yml
@@ -862,6 +862,8 @@ project/releng/scriptworker/v2/shipit/de
- project:releng:services/shipit_api/add_release/devedition
- project:releng:services/shipit_api/add_release/fennec
- project:releng:services/shipit_api/add_release/firefox
+ - project:releng:services/shipit_api/update_product_channel_version/firefox
- project:releng:services/shipit_api/dev/add_release/devedition
- project:releng:services/shipit_api/dev/add_release/firefox
- project:releng:services/shipit_api/dev/schedule_phase/devedition/ship_devedition
@@ -897,6 +899,8 @@ project/releng/scriptworker/v2/shipit/pr
- project:releng:services/shipit_api/add_release/devedition
- project:releng:services/shipit_api/add_release/fennec
- project:releng:services/shipit_api/add_release/firefox
+ - project:releng:services/shipit_api/update_product_channel_version/firefox
- project:releng:services/shipit_api/dev/add_release/devedition
- project:releng:services/shipit_api/dev/add_release/firefox
- project:releng:services/shipit_api/dev/schedule_phase/devedition/ship_devedition
@@ -918,6 +922,8 @@ project/releng/scriptworker/v2/shipit/pr
- project:releng:services/shipit_api/add_release/devedition
- project:releng:services/shipit_api/add_release/fennec
- project:releng:services/shipit_api/add_release/firefox
+ - project:releng:services/shipit_api/update_product_channel_version/firefox
- project:releng:services/shipit_api/production/add_release/devedition
- project:releng:services/shipit_api/production/add_release/firefox
- project:releng:services/shipit_api/production/schedule_phase/devedition/ship_devedition |
2a7d431
to
d9e1baa
Compare
48e2b2a
to
1b8909e
Compare
This needs to be followed by a commit 7fef0f6 to use the Firefox Nightly version stored in the database when rebuilding product details. The reason this has to land first is that I need to seed the initial Firefox Nightly version in the database. Otherwise product details will fail because the new table is empty. |
@@ -99,7 +99,8 @@ | |||
AUTH0_AUTH_SCOPES = assign_ldap_groups_to_scopes() | |||
|
|||
# other scopes | |||
AUTH0_AUTH_SCOPES.update({"rebuild_product_details": LDAP_GROUPS["firefox-signoff"], "update_release_status": []}) | |||
AUTH0_AUTH_SCOPES.update({"rebuild_product_details": LDAP_GROUPS["firefox-signoff"], "update_release_status": [], "create_product_channel_version/firefox": []}) |
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.
Another follow-up: We will need to grant releng scopes to seed the initial Thunderbird version once the Thunderbird bits are implemented.
AUTH0_AUTH_SCOPES.update({"rebuild_product_details": LDAP_GROUPS["firefox-signoff"], "update_release_status": [], "create_product_channel_version/firefox": []}) | |
AUTH0_AUTH_SCOPES.update( | |
{ | |
"rebuild_product_details": LDAP_GROUPS["firefox-signoff"], | |
"update_release_status": [], | |
"create_product_channel_version/firefox": [], | |
"create_product_channel_version/thunderbird": [], | |
} | |
) |
I ran a staging Nightly to try out this APIs in dev. |
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.
LGTM - just a few nits/questions, but nothing blocking this from merging
def get_product_channel_version(product, channel): | ||
version = Version.query.filter_by(product_name=product, product_channel=channel).first() | ||
if version: | ||
return version.current_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.
nit: All other functions here seem to return a tuple with (data, exitcode) should we follow the same pattern here?
required_permission = f"{SCOPE_PREFIX}/update_product_channel_version/{product}" | ||
if not current_user.has_permissions(required_permission): | ||
user_permissions = ", ".join(current_user.get_permissions()) | ||
abort(401, f"required permission: {required_permission}, user permissions: {user_permissions}") |
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.
nit: What's the difference between aborting and returning an error?
Also, seems like (data, exitcode) should be the pattern used?
required_permission = f"{SCOPE_PREFIX}/create_product_channel_version/{product}" | ||
if not current_user.has_permissions(required_permission): | ||
user_permissions = ", ".join(current_user.get_permissions()) | ||
abort(401, f"required permission: {required_permission}, user permissions: {user_permissions}") |
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.
same as above
user_permissions = ", ".join(current_user.get_permissions()) | ||
abort(401, f"required permission: {required_permission}, user permissions: {user_permissions}") | ||
existing_version = Version.query.filter_by(product_name=product, product_channel=channel).first() | ||
if existing_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.
nit: could improve readability here:
if Version.query.filter_by(product_name=product, product_channel=channel).first():
return {"error": f"A {product} {channel} version already exists."}, 409
# code here without else
Thanks, I will address on a follow-up |
This is an API that lets us store the current versions of FIREFOX_NIGHTLY, instead of hard-coding it, so we can update this data using an API from a
shipitscript
task. This is part of the solution to #1462