-
Notifications
You must be signed in to change notification settings - Fork 689
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 Weblate screenshot uploader tool #5450
Conversation
ca83f8d
to
a49f06c
Compare
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.
This looks fine to me. I think we can probably even handle updates without rewriting in Python.
Uploads all page layout test results via Weblate's API, replacing existing screenshots as appropriate by matching filenames against canonicalized titles.
a49f06c
to
b464adf
Compare
The script is now rewritten in Python, and also handles the updating of existing screenshots. Looking forward to review & perhaps running in prod soon. :) |
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.
This works perfectly. I made a couple of suggestions but am approving without requesting the changes. If you want to make them, I'm happy to rereview.
- Ensure unrestricted access to the Weblate sandbox (infra team).
- Manually delete all screenshots in the sandbox.
- Obtain a sandbox API token and export it to an environment variable
WEBLATE_TOKEN
- Export the sandbox URL to
SANDBOX_URL
- Generate the screenshots in English via
LOCALES=en_US make translation-test
- Run the tool via
securedrop/upload-screenshots.py --token $WEBLATE_TOKEN --baseURL $SANDBOX_URL
- Observe that a total of 55 screenshots are newly created by checking the count via
/api/screenshots/
(the API has a convenient web UI you can use for this) - Delete some screenshots, and modify another screenshot in a way that you'll be able to later recognize.
- Run the tool again.
- Observe that the screenshots you deleted are re-uploaded, and that the screenshot you modified was modified.
15ef8cb
to
eccfba2
Compare
9964ce0
to
fd004de
Compare
Uploads all page layout test results via Weblate's API, updating existing screenshots as appropriate.
Status
Ready for review. Towards #3959 (resolves it once we complete a single run in production).
Description of Changes
This is done as a standalone Python script, with the upload portion written as a
WeblateUploader
class that is as generic as possible, in case it is useful for others solving this problem in other contexts.Includes documentation for SecureDrop maintainers, and built-in help.
Test plan
WEBLATE_API_TOKEN
WEBLATE_BASE_URL
LOCALES=en_US make translation-test
securedrop/upload-screenshots.py
/api/screenshots/
(the API has a convenient web UI you can use for this)