Commit Graph

61 Commits

Author SHA1 Message Date
Qubasa
01f9bb358e clan-cli: Use machine object everywhere instead of name + flake 2025-05-09 13:13:14 +02:00
Qubasa
5f7b95ac73 clan-cli: remove useless run_no_stdout function 2025-05-08 12:30:16 +02:00
Qubasa
89decdaf7e clan-cli: Refactor the API to use the Flake object 2025-05-07 16:43:50 +00:00
hsjobeki
60a2246944 Merge pull request 'Feat(modules): display clan.service modules' (#3537) from hsjobeki/clan-core:module-list into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3537
2025-05-07 15:33:49 +00:00
Johannes Kirschbauer
3c7f08ebaf fix(tests/modules): list_modules returns moduleSets" 2025-05-07 16:46:13 +02:00
Jörg Thalheim
1037bd115b Revert "Merge pull request 'clan-cli: Refactor the API to use the Flake object' (#3531) from Qubasa/clan-core:replace_machine_name_with_machine_obj into main"
This reverts commit c09618b323, reversing
changes made to 45b2539455.
2025-05-07 15:24:57 +02:00
Mic92
c09618b323 Merge pull request 'clan-cli: Refactor the API to use the Flake object' (#3531) from Qubasa/clan-core:replace_machine_name_with_machine_obj into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3531
2025-05-07 13:21:13 +00:00
Qubasa
a6a69bb09b clan-cli: Refactor the API to use the Flake object 2025-05-07 13:12:48 +02:00
DavHau
18e75c9954 GUI: initialize support for vars prompts
... for now only when updating a machine (not when installing)

Whenever the user clicks on the update button in the machine view, and only if user input is needed for some missing vars, the user will be forwarded to a vars page.
2025-05-07 18:06:35 +07:00
Qubasa
b90812ecce clan-cli: add test_create in clan_lib test folder 2025-05-05 22:16:02 +02:00
Jörg Thalheim
9af16037a2 Revert "Merge pull request 'Fix deploying with sudo + password' (#3470) from target-host into main"
This reverts commit fbc0f9cde5, reversing
changes made to b47c25c620.
2025-05-04 13:37:39 +02:00
Jörg Thalheim
f640beaec5 tests_secrets_cli: improve assertion message for pgp key 2025-05-04 10:51:49 +02:00
Jörg Thalheim
39880f9434 fix upload when sudo prompts are needed 2025-05-04 10:51:49 +02:00
Jörg Thalheim
2f32e5bde2 configure ControlMaster and ControlPath for SSH connections
This should speed up deployments by not having to reconnect to the server on each command
2025-05-04 09:48:37 +02:00
Jörg Thalheim
f86c874ac8 facts/sops: no longer upload age key
The vars backend already does this for us.
This avoids duplicated work.
2025-05-04 09:29:29 +02:00
Mic92
08a5ad0848 Merge pull request 'clanCore/vars/sops: only copy required secrets to store' (#3457) from vdbe/clan-core:clanCore/vars/sops/only-copy-used into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3457
2025-05-04 06:41:37 +00:00
vdbe
f3e32ce827 clanCore/vars/sops: only copy required secrets to store
Create a store path per in repo secret/var to be copied, this prevents
unused secrets from being leaked.

For example the `root-password` generator contains both the hashed and
unhashed password but only the hash is used.
2025-05-04 08:08:58 +02:00
DavHau
71cdbc989c GUI/vars: add endpoints for getting prompts and generating vars 2025-05-03 14:44:51 +07:00
Brian McGee
651b277bb9 feat: configure age plugins for SOPS in buildClan 2025-04-29 16:02:32 +10:00
Brian McGee
e281b689df fix: multiple user keys in secrets
We were not loading all the user keys, only the first one.
2025-04-29 15:47:54 +10:00
Brian McGee
1bfe318865 feat: support age plugins
Extends how we parse the contents of `SOPS_AGE_KEY` / `SOPS_AGE_KEY_FILE` / `keys.txt`, allowing a user to prepend a comment before any `AGE-PLUGIN-` secret key entry to indicate its corresponding public key.

For example:

```
AGE-PLUGIN-FIDO2-HMAC-xxxxxxxxxxxxx
```

The comment can use any prefix (e.g. `# public key: age1xxxx`, `# recipient: age1xxx`) as we are looking directly for `age1xxxx` within the line.

This change is necessary to support `age` plugins as there is no unified mechanism to recover the public key from a plugin's secret key.

If a plugin secret key does not have a preceding public key comment, an error will be thrown when attempting to set a secret.
2025-04-29 15:47:54 +10:00
Johannes Kirschbauer
f6628ec1a9 Refactor(clan_lib): move clan_cli.api into clan_lib.api 2025-04-26 19:51:35 +02:00
Luis Hebendanz
107170804b Merge pull request 'clan-cli: Expose private_key to Machine class, in the future we should merge Machine and Host class' (#3407) from Qubasa/clan-core:vpb-patches2 into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3407
2025-04-25 12:26:00 +00:00
Qubasa
f1a7f2aa69 clan-cli: Expose private_key to Machine class, in the future we should merge Machine and Host class 2025-04-25 13:38:03 +02:00
lassulus
d93e58218d Refactor select with new maybe selector
This is a great refactor of the select functionality in the flake class.
This now uses the same parser as the nix code, but runs it in python for
nice stacktraces.

Also we now have a maybe selector which can be used by prepending the
selector with a ?

Tests have been expanded to make sure the code is more stable and easier
to understand
2025-04-25 16:26:45 +10:00
Johannes Kirschbauer
9b96f87160 Chore(clan/clan_uri): Remove ClanURI class from clan_cli 2025-04-23 16:53:11 +02:00
Jörg Thalheim
d730f73ace temporary disabling the VM test until we have vars fixed
We are currently missing injecting public vars back into the vm.
To unblock the CI, we disable the test for a bit.
2025-04-23 11:26:05 +02:00
hsjobeki
841ad6f48e Merge pull request 'vars-fix-overeager-chache-invalidation' (#3385) from hsjobeki/clan-core:vars-fix-overeager-chache-invalidation into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3385
2025-04-22 18:28:27 +00:00
Johannes Kirschbauer
1a3346274e Tests/fix: forbid dynamic invalidation
We cannot support dynamic hashInvalidation.
This means the invalidation can change *after* or *before* a 'vars generate'
But not during the generation itself. This causes heavy performance overhead.
Additionally this introduces a fixed-point-iteration (compare: fixed-point-iteration vs. fixed-point-function)
This iteration takes ~ 1min for two bare-bones machine with 1 generator (see: checks/data-mesher)
2025-04-22 20:19:15 +02:00
Jörg Thalheim
26d635a283 drop test_secrets_password_store
we are phasing out facts and the only fact we had left for testing, got
now dropped. We still have a sops facts test, which we might also drop
soon.
2025-04-22 18:20:35 +02:00
Jörg Thalheim
c00ca85bc7 drop unused machine_get_fact 2025-04-22 18:20:35 +02:00
Jörg Thalheim
cbde58e1d8 zerotier: migrate from facts to vars 2025-04-22 18:20:35 +02:00
Michael Hoang
3480912d8d cli: fix unnecessary sudo when unspecified user defaults to root 2025-04-22 23:39:46 +10:00
Jörg Thalheim
723d72255c Reapply "remove nix_shell_legacy"
This reverts commit c5001f19fc.
2025-04-21 13:23:50 +02:00
Johannes Kirschbauer
8efdfc6da1 chore(select/cache): rename 'prefetch' to 'invalidate_cache' 2025-04-20 13:34:52 +02:00
Johannes Kirschbauer
c5001f19fc Revert "remove nix_shell_legacy"
This reverts commit f3512b853a.
2025-04-18 14:49:54 +02:00
Johannes Kirschbauer
17fb2fc53d test(cli/select): add simple caching test 2025-04-18 14:06:59 +02:00
Jörg Thalheim
f3512b853a remove nix_shell_legacy 2025-04-16 21:03:58 +02:00
Jörg Thalheim
837789010e rename nix_shell_legacy to nix_shell and run_cmd to nix_shell
Than it's more obvious that we need to migrate.
2025-04-16 18:27:01 +00:00
Jörg Thalheim
0b4e896af3 migrate clan history to clan-vm-manager
this functionality is not really useful or used in clan-vm-manager and
therefore should live in the clan-vm-manager.

Not porting the test for now because we probably get rid of the clan-vm-manager soon in favour of the UI.
2025-04-16 14:51:37 +02:00
lassulus
62deb1f89b Merge pull request 'fast-vars-gen' (#3216) from fast-vars-gen into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3216
2025-04-15 07:11:06 +00:00
Jörg Thalheim
833798f650 test_vars_deployment: skip on macOS for now
we can not run vms on macOS at the moment.
2025-04-14 15:47:55 +00:00
lassulus
2df82ae61f clan_cli test_vars: start refactoring to use caching 2025-04-14 14:28:59 +02:00
Qubasa
b6753211e9 clan-cli: Fix failing tests. Add a big FIXME for clan.select 2025-04-11 23:36:02 +02:00
Qubasa
3bd766e0a0 clan-cli: Fix single file upload in upload.py, add test for edge case 2025-04-11 19:08:13 +02:00
Qubasa
5a266ecdde clan-cli: Fixup more failing tests because of quoting issues 2025-04-10 14:33:54 +02:00
Qubasa
3fbc661ed9 clan-cli: Change shellcheck to shellcheck-minimal 2025-04-10 01:54:00 +02:00
RTUnreal
37a627f8bc pkgs/clan-cli: fix test which are using vars shellcheck 2025-04-09 19:44:00 +02:00
Johannes Kirschbauer
61d1cf32ab chore(clan/pytest): discover all test files in the tree 2025-04-09 18:54:57 +02:00
Johannes Kirschbauer
872aa8e5b6 fix(clan/machines): move machineClass attribute selector and add a unit test for class detection 2025-04-09 18:29:43 +02:00