Skip to content

feat: add sys-git.create-sync state#120

Open
3nprob wants to merge 4 commits intoben-grande:mainfrom
3nprob:feat-git-sync
Open

feat: add sys-git.create-sync state#120
3nprob wants to merge 4 commits intoben-grande:mainfrom
3nprob:feat-git-sync

Conversation

@3nprob
Copy link
Copy Markdown

@3nprob 3nprob commented Mar 20, 2025

Contribution checklist

Before contributing, I, the opener of this request:

  • Agree to use the same license of each modified file;
  • Have followed the contribution guidelines;
  • Have tested it locally;
    • You're looking at it!
  • Have committed locally and not through a git hosting service such as
    GitHub Web; and
  • Have reviewed and updated any documentation if relevant.

Lacking to check any of the above can result in the rejection of the
contribution without no further comment.

What does this PR aims to accomplish

With a similar philosophy as the splittMutt approach in mail, this introduces separate role and qube(s) for push/pull operation with remote repos, to be done separately from either sys-git itself or dev etc.

What does this PR change

Add new states sys-git.create-sync and sys-git.install-sync.

- {{ slsdotpath }}.clone

{# TODO: make this properly read configuration from pillar instead of inlined in code #}
{# % set syncs = [
Copy link
Copy Markdown
Author

@3nprob 3nprob Mar 20, 2025

Choose a reason for hiding this comment

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

This is a new pattern to the qusal repo and a simple solution to the "allowing user-configured instantiation of multiple appvm instances per state" question. I have locally been refactoring some of the other modules to use the same structure in order to declaratively define my appvms in code and it works all right in general.

Alternatives considered:

  • Declare them in the topfile
    • This would be the nicest IMO. While we can specify minions in topfile, there is not any interface to pass values/vars via it AFAIK. Therefore it would involve also complementing with values from pillars/grains.
  • Keep the general foreach in create.sls the same as here but populate syncs entirely from pillar
    • This seems ideal. While I have been making use of the dotfiles pillar, I was not successful in having the configuration here picked up. Not sure if complex values simply silently fail or it's a configuration issue with my local environment.
  • Runtime switching on grains
    • Not a fan of this approach

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Please discuss about it on #74, it makes sense to do such thing at a larger scale that impacts all formulas and therefore needs more thought. Would be better if it worked with pillars.

Would make sense to remove this file until #74 is completed to not have inconsistencies such as only this state handling pillars and others not, so this PR can be merged.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Removed create-sync.sls, create-sync.top and updated readme accordingly.

@3nprob 3nprob marked this pull request as ready for review March 20, 2025 04:40
Copy link
Copy Markdown
Owner

@ben-grande ben-grande left a comment

Choose a reason for hiding this comment

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

Have you seen qusal.ConnectTCP? It is what I am using for proxying connections from dev (not netvm) to a git server/forge.

If I were to use sys-git-sync, it would not have a netvm and users would need to configure access via qusal.ConnectTCP to their forges.

Instead of fixing the errors showed by the review, please focus on argumentation of the value of git-sync. Things I see:

  1. No connectivity on the development environment (great), but now every operations requires to be repeated on both dev qube sys-git-sync, push, fetch etc (not great).
  2. Reviewing git patches are more difficult than reviewing pure text (mail).

- {{ slsdotpath }}.clone

{# TODO: make this properly read configuration from pillar instead of inlined in code #}
{# % set syncs = [
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Please discuss about it on #74, it makes sense to do such thing at a larger scale that impacts all formulas and therefore needs more thought. Would be better if it worked with pillars.

Would make sense to remove this file until #74 is completed to not have inconsistencies such as only this state handling pillars and others not, so this PR can be merged.

- qvm: {{ slsdotpath }}

{% load_yaml as defaults -%}
name: {{ slsdotpath }}-sync
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The tag git-sync seems to be missing.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hm, the template itself shouldn't have the tag should be applied to the AppVMs directly I think? If the tag is used in qubes-rpc policies it would typically be unintended to reference the template I think?


git remote add ghost https://github.com/ghost/qubes-doc
git fetch ghost master
# inspect changes
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Different than e-mails, git patches can be quite huge depending on the commit and how many of them exist. It works at a small scale (such as reading e-mails), but on a larger scale, requires checking the patch is the intended one or not.

# inspect changes

# optionally, resign commit with pgp if you have split-gpg2 set up
git commit -S --amend
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

If you give PGP signing access to git-sync which is networked, it lowers its security.

Copy link
Copy Markdown
Author

@3nprob 3nprob Jun 26, 2025

Choose a reason for hiding this comment

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

Arguable tradeoff. Anyway, dropped this instruction


git remote add ghost https://github.com/ghost/qubes-doc
git fetch ghost master
# inspect changes
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I prefer to not have inline comments in markdown except on rare occasions.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Broke up the block and removed inline markdown comment

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