[Part - 1] : Use prebuilt static files on deploys - Add util to download static files - #6935
[Part - 1] : Use prebuilt static files on deploys - Add util to download static files#6935AmitPhulera wants to merge 8 commits into
Conversation
Also passes github token in the env var which would be used to fetch the artifacts later in the process
would be a no op for now would be later linked
| } | ||
|
|
||
|
|
||
| def main(argv=None): |
There was a problem hiding this comment.
Nit: the newspaper principal / vertical ordering would have us put this at the top of the file, rather than the bottom.
| @@ -0,0 +1,174 @@ | |||
| """Fetch the prebuilt REQUIRED_STATIC_FILES.zip GitHub Actions artifact. | |||
There was a problem hiding this comment.
The first thing that pops into my head reading through this is: could this module be written much more concisely with PyGithub instead of raw requests?
| def get_prebuilt_static_args(args): | ||
| """Ansible -e args enabling the prebuilt static artifact fetch, or []. | ||
|
|
||
| Verifies that Github token is present and sets the GITHUB_TOKEN env var. This just passes the arg to tell playbook to use the prebuilt static artifacts.The artifact itself is fetched later, by a playbook task on the control machine. |
There was a problem hiding this comment.
Probably worth having Claude do a pass on tightening up comments, to catch things like this formatting error.
| POLL_INTERVAL = 30 | ||
| REQUEST_TIMEOUT = 60 | ||
| PROGRESS_INTERVAL = 10 # seconds between download progress lines | ||
| RUNNING_STATUSES = ("queued", "in_progress", "pending", "waiting", "requested") |
There was a problem hiding this comment.
Are there too many statuses? What is the difference between in_progress, pending, and waiting?
There was a problem hiding this comment.
We talked about it offline, but to me this belongs in the next PR that actually makes use of it. I know you saw it as this PR setting up all of the boilerplate. Just wanted to make a note of this discussion.
https://dimagi.atlassian.net/browse/SAAS-20027
We already build static files on Github actions everytime something is pushed to
autostagingbranch on CommCare HQ repo.This PR moves a step in the direction of using prebuilt static files in deploys. Earlier we were considering it to be useful for third party hosters and were trying to figure out the artifacts public because currently you need a token with read access to commcare hq repo to download the artifacts.
@gherceg and I recently started talking about it again and we decided why not just test it internally with the actions workflow and using the same token that we pass to compile deploy summary to get the artifact. This is the first PR that tries to setup basic structure. In the followup PRs we would be using the utils introduced in this PR to be integrated into deploy playbooks.
Environments Affected
Would be testing on staging for now, but will be used for all Dimagi environments.
Review by commit 🐡
36df7be is the entire spec on how this entire feature is planned.
4c432fc is what is in this PR.
I am intentionally keeping them around until the feature is integrated, would remove them later.