Skip to content

[Part - 1] : Use prebuilt static files on deploys - Add util to download static files - #6935

Open
AmitPhulera wants to merge 8 commits into
masterfrom
ap/prebuilt-static-slice-1
Open

[Part - 1] : Use prebuilt static files on deploys - Add util to download static files#6935
AmitPhulera wants to merge 8 commits into
masterfrom
ap/prebuilt-static-slice-1

Conversation

@AmitPhulera

@AmitPhulera AmitPhulera commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

https://dimagi.atlassian.net/browse/SAAS-20027

We already build static files on Github actions everytime something is pushed to autostaging branch 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.

@AmitPhulera
AmitPhulera requested review from dannyroberts, gherceg and millerdev and removed request for gherceg July 13, 2026 08:36

@dannyroberts dannyroberts left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Had a couple thoughts, so will wait to see what you think before reviewing further. Overall, I like the direction!

}


def main(argv=None):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are there too many statuses? What is the difference between in_progress, pending, and waiting?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

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.

3 participants