Skip to content

automate and improve change-tracking in deployers#869

Merged
hpk42 merged 1 commit into
mainfrom
hpk/refactor-deployers
May 6, 2026
Merged

automate and improve change-tracking in deployers#869
hpk42 merged 1 commit into
mainfrom
hpk/refactor-deployers

Conversation

@hpk42
Copy link
Copy Markdown
Contributor

@hpk42 hpk42 commented Feb 23, 2026

Automate change tracking for added/remove files and systemd services. This removes a lot of boilerplate from the deployers and makes them more readable and less error-prone.

@hpk42 hpk42 temporarily deployed to staging-ipv4.testrun.org February 23, 2026 03:23 — with GitHub Actions Inactive
@hpk42 hpk42 temporarily deployed to staging2.testrun.org February 23, 2026 03:23 — with GitHub Actions Inactive
@hpk42 hpk42 changed the title WIP: refactor deployers to use put_file/put_template helpers WIP: reorganize TLS deployment and refactor deployers to use new helpers Feb 23, 2026
@hpk42 hpk42 force-pushed the hpk/refactor-deployers branch from 7831333 to c891c27 Compare February 23, 2026 12:27
@hpk42 hpk42 temporarily deployed to staging2.testrun.org February 23, 2026 12:27 — with GitHub Actions Inactive
@hpk42 hpk42 force-pushed the hpk/refactor-deployers branch from c891c27 to 2e69a25 Compare February 23, 2026 14:00
@hpk42 hpk42 temporarily deployed to staging2.testrun.org February 23, 2026 14:00 — with GitHub Actions Inactive
@hpk42 hpk42 temporarily deployed to staging-ipv4.testrun.org February 23, 2026 14:00 — with GitHub Actions Inactive
@hpk42 hpk42 force-pushed the hpk/tls-external branch 3 times, most recently from 3f05a9a to cf7e9fd Compare February 24, 2026 07:54
Base automatically changed from hpk/tls-external to main February 24, 2026 08:44
@hpk42 hpk42 force-pushed the main branch 2 times, most recently from 92a52b9 to e21f2a0 Compare February 24, 2026 08:46
@hpk42 hpk42 force-pushed the hpk/refactor-deployers branch from 2e69a25 to 36e8133 Compare February 24, 2026 10:57
@hpk42 hpk42 temporarily deployed to staging-ipv4.testrun.org February 24, 2026 10:57 — with GitHub Actions Inactive
@hpk42 hpk42 temporarily deployed to staging2.testrun.org February 24, 2026 10:57 — with GitHub Actions Inactive
@hpk42 hpk42 force-pushed the hpk/refactor-deployers branch from 36e8133 to 4302126 Compare March 6, 2026 10:14
@hpk42 hpk42 force-pushed the hpk/refactor-deployers branch 4 times, most recently from fc8c8e3 to 486fb47 Compare April 28, 2026 17:02
@hpk42 hpk42 changed the title WIP: reorganize TLS deployment and refactor deployers to use new helpers WIP: reorganize TLS deployment and automate change-tracking in deployers Apr 28, 2026
@hpk42 hpk42 force-pushed the hpk/refactor-deployers branch from 486fb47 to d911e85 Compare April 28, 2026 17:16
@hpk42 hpk42 force-pushed the hpk/refactor-deployers branch from d911e85 to dac6526 Compare April 28, 2026 18:07
@hpk42 hpk42 changed the title WIP: reorganize TLS deployment and automate change-tracking in deployers WIP: automate and improve change-tracking in deployers Apr 28, 2026
@hpk42 hpk42 force-pushed the hpk/refactor-deployers branch from dac6526 to 72871d7 Compare April 28, 2026 19:13
@hpk42 hpk42 changed the title WIP: automate and improve change-tracking in deployers automate and improve change-tracking in deployers Apr 28, 2026
@hpk42 hpk42 force-pushed the hpk/refactor-deployers branch 5 times, most recently from 2fae992 to dfa0315 Compare April 30, 2026 14:30
@hpk42 hpk42 marked this pull request as ready for review April 30, 2026 14:45
@hpk42 hpk42 force-pushed the hpk/refactor-deployers branch 2 times, most recently from 1008981 to 76f00da Compare April 30, 2026 15:52
Copy link
Copy Markdown
Contributor

@j4n j4n left a comment

Choose a reason for hiding this comment

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

Looks good to me, a few minor suggestions.

Tested deploying, re-deploying, and redeploy with modified system units, all good.

It makes me wish to have a pyinfra_helpers.py we could use in other repos as well, with just the wrapper functions :)

return self.put_template(src, dest, **kwargs)
return self.put_file(src, dest)

def put_file(self, src, dest, mode="644"):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
def put_file(self, src, dest, mode="644"):
def put_file(self, src, dest, mode="644", reason=None):

I think it would be valuable to preserve the ability to explain changes for put_file, put_template, remove_file, and embed it in braces into the name parameter.

return self.put_template(src, dest, **kwargs)
return self.put_file(src, dest)

def put_file(self, src, dest, mode="644"):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also, this takes mode as an argument, but template doesnt, but takes owner - maybe this should be symmetrical to be less confusing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The new API is meant to only consists of things that map the previous usage, nothing more. If some other argument is needed, it is easy enough to add when it is actually needed.

dest = f"/etc/systemd/system/{dest_name}"
if src.endswith(".j2"):
return self.put_template(src, dest, **kwargs)
return self.put_file(src, dest)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe we should pass kwargs to the non-template-case, to honor dest_name for example.

@hpk42 hpk42 force-pushed the hpk/refactor-deployers branch from 76f00da to a1d5e3d Compare May 6, 2026 17:16
@hpk42
Copy link
Copy Markdown
Contributor Author

hpk42 commented May 6, 2026

a more general API or pyinfra_helpers.py is a separate concern (which i am not sure about how useful it is).

@hpk42 hpk42 merged commit a1f64eb into main May 6, 2026
6 checks passed
@hpk42 hpk42 deleted the hpk/refactor-deployers branch May 6, 2026 18:02
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.

2 participants