Compare commits

138 Commits

Author SHA1 Message Date
6a464d6eb8 fix(deps): update all dependencies
Some checks failed
renovate/artifacts Artifact file update failure
2026-01-16 04:19:26 +00:00
b2f92b55e5 fix(deps): update rust crate tracing to v0.1.44 2025-12-19 01:21:55 +00:00
c701d7fa6b fix(deps): update tokio-tracing monorepo 2025-11-29 01:20:46 +00:00
80d8e5c0a3 fix(deps): update rust crate tracing-subscriber to v0.3.20 2025-11-13 02:43:32 +01:00
6b72240871 fix(deps): update rust crate serde to v1.0.228 2025-11-13 01:43:28 +00:00
15298f1f96 feat: update 2025-05-25 16:14:36 +02:00
b86fec2a58 fix(deps): update rust crate serde to v1.0.218
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-02-21 01:30:01 +00:00
687792706b fix(deps): update rust crate serde to v1.0.217
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-12-28 01:27:22 +00:00
1c29770ce2 fix(deps): update rust crate serde to v1.0.216
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-12-11 05:23:24 +00:00
c1e1215f3c fix(deps): update rust crate tracing-subscriber to v0.3.19
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-30 01:40:42 +00:00
e94513c24f fix(deps): update rust crate tracing to v0.1.41
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-28 01:26:04 +00:00
6aa90d22ea feat: fix additional properties
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-11-16 16:58:24 +01:00
8fe00b22c5 fix(deps): update rust crate serde to v1.0.215
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-12 01:21:03 +00:00
78262a138d fix(deps): update rust crate serde to v1.0.214
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-29 01:25:57 +00:00
bcebe4bce4 fix(deps): update rust crate serde to v1.0.213
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-23 00:26:20 +00:00
1f8a5d52c4 fix(deps): update rust crate futures-util to v0.3.31
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-06 00:22:52 +00:00
9207ef8f81 fix(deps): update rust crate serde to v1.0.210
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-09-07 00:20:13 +00:00
7df629290a fix(deps): update rust crate serde to v1.0.209
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-08-24 03:46:41 +00:00
54829a7fe4 chore(test): test commit
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-29 19:44:39 +02:00
0ebe88a470 feat: allow arrays
Some checks failed
continuous-integration/drone/push Build encountered an error
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-05-27 22:59:11 +02:00
67af5e7aa6 fix(deps): update rust crate serde to v1.0.203
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build encountered an error
2024-05-25 18:35:36 +00:00
bf7a7db868 feat: I dunno why
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-05-04 20:13:38 +02:00
1d1ac49d0b feat: prefer first variable
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-03-09 21:08:16 +01:00
8520bcb5b0 fix(deps): update rust crate git2 to 0.18.2
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-02-07 04:29:42 +00:00
7b136b1331 feat: enable helm via. kustomize
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-02-06 21:35:27 +01:00
d0d591dd4f fix(deps): update rust crate tempfile to 3.10.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-02-05 20:31:33 +00:00
e09e28e8d0 feat: reverse folders
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-02-03 20:11:54 +01:00
3a09c68378 feat: reverse
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-02-03 20:06:17 +01:00
8f889663b2 fix(deps): update rust crate tokio to 1.36.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-02-02 12:38:27 +00:00
6d3bdda04d fix(deps): update rust crate dagger-sdk to 0.9.8
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-02-01 22:02:11 +00:00
1720f29149 fix(deps): update rust crate eyre to 0.6.12
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-31 17:20:32 +00:00
dc2a4977d6 fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-29 04:14:23 +00:00
52c7f77751 feat: narrow error codes
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-01-28 21:36:26 +01:00
ede55b975b feat: without remove dir all assertion
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-01-28 16:54:25 +01:00
85cc1d46db feat: make sure dir is there as well
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-01-28 16:42:34 +01:00
cc7aaf14eb fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-26 22:27:07 +00:00
1bacfdfb29 fix(deps): update rust crate libz-sys to 1.1.15
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-26 14:46:06 +00:00
9820d2c3ab fix(deps): update rust crate rlua to 0.19.8
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-21 11:06:24 +00:00
5fae1fc403 fix(deps): update rust crate openssl to 0.10.63
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing
2024-01-20 00:10:57 +00:00
b9f7ff0a6f fix(deps): update rust crate clap to 4.4.18
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-16 20:43:06 +00:00
440245c332 fix(deps): update rust crate clap to 4.4.17
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-15 17:10:52 +00:00
a89af69c15 fix(deps): update rust crate clap to 4.4.16
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-12 03:16:36 +00:00
b93f96053e fix(deps): update rust crate clap to 4.4.15
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-11 17:07:16 +00:00
347d6171a5 fix(deps): update rust crate dagger-sdk to 0.3.3
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-09 21:06:32 +00:00
e7d90ffcc5 fix(deps): update rust crate libz-sys to 1.1.14
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-09 08:43:27 +00:00
9c607e8ab1 fix(deps): update rust crate clap to 4.4.14
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-08 17:04:44 +00:00
cf6a4b9fcd fix(deps): update rust crate libz-sys to 1.1.13
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-08 09:38:31 +00:00
a05699d24e fix(deps): update rust crate serde to 1.0.195
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-06 02:56:11 +00:00
ae9fdf7e7e fix(deps): update rust crate clap to 4.4.13
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-04 19:32:03 +00:00
8c3e546b27 fix(deps): update rust crate serde_json to 1.0.111
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-04 07:57:50 +00:00
248f294000 fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-02 07:39:44 +00:00
65f4271957 fix(deps): update rust crate anyhow to 1.0.79
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-02 04:56:02 +00:00
eb980308c6 fix(deps): update rust crate serde_json to 1.0.109
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-01 01:31:19 +00:00
51e5e1a4ce fix(deps): update rust crate anyhow to 1.0.78
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-12-30 23:16:27 +00:00
00e45053f7 fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-12-28 18:23:54 +00:00
dace148e52 fix(deps): update rust crate anyhow to 1.0.77
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-12-26 23:43:19 +00:00
04774a69bf fix(deps): update rust crate openssl to 0.10.62
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-12-22 13:22:05 +00:00
c489660211 fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-12-21 20:59:41 +00:00
2e6e6fd328 fix(deps): update rust crate tokio to 1.35.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-12-19 18:19:37 +00:00
84df1fe4df fix(deps): update rust crate eyre to 0.6.11
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-12-13 22:11:11 +00:00
30c58b9eb2 fix(deps): update rust crate tokio to 1.35.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-12-08 23:21:48 +00:00
c2502dbf00 fix(deps): update rust crate eyre to 0.6.10
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-12-08 07:01:40 +00:00
bec95c9519 fix(deps): update rust crate openssl to 0.10.61
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-12-05 01:44:10 +00:00
02b1a627f0 fix(deps): update rust crate clap to 4.4.11
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-12-04 18:38:49 +00:00
4b84f27d67 fix(deps): update rust crate clap to 4.4.10
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-11-28 03:58:14 +00:00
a3bb366d07 fix(deps): update rust crate clap to 4.4.9
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-11-27 18:20:10 +00:00
c479cadf4d fix(deps): update rust crate openssl to 0.10.60
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-11-23 02:37:06 +00:00
74bd83aaec fix(deps): update rust crate serde to 1.0.193
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-11-21 02:27:47 +00:00
a707d31277 fix(deps): update rust crate eyre to 0.6.9
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-11-17 17:38:40 +00:00
8cfdebdaee fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-11-13 17:38:32 +00:00
f721e45f8f fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-11-09 20:10:17 +00:00
db4b41c032 fix(deps): update rust crate openssl to 0.10.59
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-11-03 14:50:30 +00:00
4945ecca40 fix(deps): update rust crate openssl to 0.10.58
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-11-01 21:34:10 +00:00
a6560a10cb fix(deps): update rust crate serde_json to 1.0.108
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-10-30 16:02:21 +00:00
e2feef1c27 feat: with multiple args
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-10-29 00:13:45 +02:00
1b9c9188d4 fix(deps): update rust crate tempfile to 3.8.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-10-26 22:57:15 +00:00
a9ca8cdc18 fix(deps): update rust crate serde_yaml to 0.9.27
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-10-26 05:49:14 +00:00
0431dd03bf fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-10-26 03:51:38 +00:00
e5eabf6901 fix(deps): update rust crate clap to 4.4.7
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-10-24 18:55:42 +00:00
a336025a0c fix(deps): update rust crate dagger-sdk to 0.3.2
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-10-21 09:17:54 +00:00
e471452ed3 fix(deps): update rust crate tracing to 0.1.40
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-10-19 01:37:43 +00:00
05ea0d8ed8 fix(deps): update rust crate tracing to 0.1.39
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-10-13 23:10:35 +00:00
c42ad69eef fix(deps): update rust crate serde to 1.0.189
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-10-13 03:08:00 +00:00
614e2bf442 fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-10-09 10:09:53 +00:00
23d9ca8d11 fix(deps): update rust crate clap to 4.4.5
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-25 21:06:22 +00:00
05d8209f15 fix(deps): update rust crate git2 to 0.18.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-20 21:28:20 +00:00
8de0a15922 fix(deps): update rust crate clap to 4.4.4
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-18 16:04:16 +00:00
e20fbc56b4 fix(deps): update rust crate serde_json to 1.0.107
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-13 23:24:03 +00:00
aa1f6c3a16 fix(deps): update rust crate clap to 4.4.3
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-12 18:48:48 +00:00
e944203e80 fix(deps): update rust crate serde_json to 1.0.106
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-09 19:48:15 +00:00
3d4e6b6fcd fix(deps): update rust crate dagger-sdk to 0.3.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-06 21:26:33 +00:00
35d54ab30f fix(deps): update rust crate walkdir to 2.4.0
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build was killed
2023-09-05 14:40:02 +00:00
941a8f600f fix(deps): update rust crate tera to 1.19.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-03 16:31:01 +00:00
32d5fb6f97 fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-31 18:58:51 +00:00
f97fe5c832 fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-28 17:27:13 +00:00
8580813bbc fix(deps): update rust crate serde to 1.0.188
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-26 02:47:25 +00:00
65a995c9ee fix(deps): update rust crate serde to 1.0.187
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-25 18:00:45 +00:00
31c77c7581 fix(deps): update rust crate clap to 4.4.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-24 16:36:52 +00:00
dff0e85f7d fix(deps): update rust crate serde to 1.0.186
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-24 00:52:24 +00:00
ff74c55829 fix(deps): update rust crate clap to 4.3.24
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-23 14:54:02 +00:00
e6cd1c16b6 fix(deps): update rust crate serde to 1.0.185
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-21 04:48:27 +00:00
6b7f915c12 fix(deps): update rust crate tempfile to 3.8.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-18 23:00:57 +00:00
c8e4f4b66d fix(deps): update rust crate clap to 4.3.23
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-18 21:56:41 +00:00
0aa7195415 fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-17 14:35:33 +00:00
1da2ded83e fix(deps): update rust crate dagger-sdk to 0.3.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-16 19:38:31 +00:00
60b234c0d7 fix(deps): update rust crate serde_json to 1.0.105
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-15 22:24:33 +00:00
cace45ee5b fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-15 16:10:40 +00:00
bc2999fb92 chore: add force to install
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-08-12 21:43:21 +02:00
26ef1cb0cd chore: full rename
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-08-12 21:42:13 +02:00
2cd9509fcb feat: rename cuddle_cli -> cuddle
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-08-12 21:41:07 +02:00
53b7513ceb fix(deps): update rust crate log to 0.4.20
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-12 11:30:03 +00:00
71965cb07c fix(deps): update rust crate tokio to 1.30.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-09 16:01:56 +00:00
dd94ee2e8e fix(deps): update rust crate clap to 4.3.21
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-08 02:22:57 +00:00
3bf7e837e5 fix(deps): update rust crate clap to 4.3.20
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-08 01:34:38 +00:00
39505938a5 fix(deps): update rust crate serde to 1.0.183
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-07 04:18:13 +00:00
724a364984 fix(deps): update rust crate tempfile to 3.7.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-06 22:09:19 +00:00
840694967d fix(deps): update rust crate openssl to 0.10.56
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-06 13:44:49 +00:00
b32643ff7a fix(deps): update rust crate serde to 1.0.182
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-06 05:49:51 +00:00
41d337d003 fix(deps): update rust crate serde to 1.0.181
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-04 00:51:28 +00:00
fd01de7ede feat: with rlua searcher
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-08-02 12:49:25 +02:00
44e8fe8918 chore: set docs
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-08-02 12:35:53 +02:00
b7747dec06 feat: add license and publisable
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-08-02 12:35:36 +02:00
5e9dc88a1b docs: add readme
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-08-02 12:14:21 +02:00
ec1fdf267f feat: withname and path as proper variables
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-08-02 11:40:17 +02:00
c11baae1ba fix(deps): update rust crate serde to 1.0.180
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-07-31 18:52:07 +00:00
f396a36b37 fix(deps): update rust crate serde to 1.0.179
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-07-31 00:50:21 +00:00
8f155373f3 fix(deps): update rust crate serde to 1.0.178
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-07-28 23:52:57 +00:00
27b4e73a48 fix(deps): update rust crate serde to 1.0.177
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-07-27 18:33:39 +00:00
b58597e25d fix(deps): update all dependencies
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-07-27 14:07:01 +00:00
ae74427ca8 feat: remove cat
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-07-27 15:57:13 +02:00
4bd4648a94 feat: clean up drone
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-07-27 15:53:45 +02:00
26c1c083de feat: with extra context
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-07-27 15:50:58 +02:00
3a9f00b1e5 feat: with key checking wip
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-07-27 15:41:17 +02:00
02ec96e93c feat: revert to ed25519
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-07-27 15:37:31 +02:00
3fae1b2b06 feat: trying with rsa key instead
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-07-27 15:35:00 +02:00
c2cfee11b2 feat: with capital R
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-07-27 15:26:56 +02:00
c7fdd4fe17 feat: with updated permissions
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-07-27 15:26:26 +02:00
7e008bea09 feat: with inline eval
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-07-27 15:25:39 +02:00
32 changed files with 2156 additions and 1031 deletions

View File

@@ -14,8 +14,6 @@ steps:
commands:
- mkdir -p $HOME/.ssh/
- echo "$SSH_KEY" | base64 -d > $HOME/.ssh/id_ed25519
- ls $HOME/.ssh/
- cat $HOME/.ssh/id_ed25519
- name: build
image: kasperhermansen/cuddle:latest
@@ -26,14 +24,12 @@ steps:
- name: dockersock
path: /var/run
commands:
- eval `ssh-agent`
- chmod -R 600 ~/.ssh
- ssh-add
- cuddle x build_cuddle_image
environment:
DOCKER_BUILDKIT: 1
DOCKER_USERNAME:
from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
CUDDLE_SECRETS_PROVIDER: 1password
CUDDLE_ONE_PASSWORD_DOT_ENV: ".env.ci"
CUDDLE_SSH_AGENT: "true"

1904
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,3 @@
[workspace]
members = ["cuddle_cli", "examples/base", "ci"]
members = ["cuddle", "examples/base", "ci"]
resolver = "2"

7
LICENSE Normal file
View File

@@ -0,0 +1,7 @@
Copyright 2023 Kasper J. Hermansen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

71
README.md Normal file
View File

@@ -0,0 +1,71 @@
# Cuddle - Configuration and Script Manager
Cuddle CLI is a Rust command-line interface application designed to manage
configuration variables and scripts across projects. It simplifies sharing of
code and workflows, making development and collaboration smoother and more
efficient. This project is published on crates.io as `cuddle`.
## Table of Contents
1. [Installation](#installation)
2. [Usage](#usage)
3. [Commands](#commands)
4. [Configuration](#configuration)
5. [Contributing](#contributing)
6. [License](#license)
## Installation
Make sure you have Rust and Cargo installed. You can install Rust and Cargo from
[https://rustup.rs/](https://rustup.rs/).
To install Cuddle CLI, run:
```sh
cargo install cuddle
```
## Usage
After successful installation, you can run the CLI using the `cuddle` command:
```sh
cuddle [command] [options]
```
## Commands
Detailed documentation of the commands and options can be found in our
[official documentation (tbd)](LINK_TO_DOCUMENTATION).
## Configuration
You can manage your configurations in a file called `cuddle.yaml`. For details
on how to format this file, check our
[Configuration Guide (tbd)](LINK_TO_CONFIGURATION_GUIDE).
## Contributing
Contributions are what make the open-source community such an amazing place to
learn, inspire, and create. Any contributions you make are **greatly
appreciated**.
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
Please read our [Contributing Guide](LINK_TO_CONTRIBUTING_GUIDE) for more
information.
## License
Distributed under the MIT License. See `LICENSE` for more information.
## Contact
You can reach out to us at our
[official contact page (tbd)](LINK_TO_CONTACT_PAGE). Please ensure to follow our
[Code of Conduct (tbd)](LINK_TO_CONDUCT_PAGE) when interacting with our
community.

View File

@@ -6,6 +6,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dagger-sdk = "0.2.22"
eyre = "0.6.8"
tokio = { version = "1.28.2", features = ["full"] }
dagger-sdk = "0.9.8"
eyre = "0.6.12"
tokio = { version = "1.36.0", features = ["full"] }

View File

@@ -14,7 +14,7 @@ async fn main() -> eyre::Result<()> {
HostDirectoryOptsBuilder::default()
.include(vec![
"ci/",
"cuddle_cli/",
"cuddle/",
"examples",
"Cargo.lock",
"Cargo.toml",
@@ -79,14 +79,14 @@ async fn dind_image(
"libz-dev",
])
.with_workdir("/app/cuddle/")
.with_directory(".", src.id().await?)
.with_directory(".", src)
.with_exec(vec![
"cargo",
"install",
"--target",
&format!("{architecture}-unknown-linux-musl"),
"--path",
"cuddle_cli",
"cuddle",
"--profile=release",
]);
@@ -99,7 +99,7 @@ async fn dind_image(
.from("docker:dind")
.with_directory(
"/usr/local/cargo/bin/",
rust_bin.directory("/usr/local/cargo/bin/").id().await?,
rust_bin.directory("/usr/local/cargo/bin/"),
);
let path_env = final_image.env_variable("PATH").await?;

51
cuddle/Cargo.toml Normal file
View File

@@ -0,0 +1,51 @@
[package]
name = "cuddle"
description = "cuddle is a shuttle inspired script and configuration management tool. It enables sharing of workflows on developers workstations and ci"
repository = "https://git.front.kjuulh.io/kjuulh/cuddle"
readme = "../README.md"
license-file = "../LICENSE"
publish = true
version = "0.2.0"
edition = "2021"
[[bin]]
name = "cuddle"
path = "src/main.rs"
[dependencies]
anyhow = { version = "1.0.79", features = ["backtrace"] }
serde = { version = "1.0.196", features = ["derive"] }
serde_yaml = "0.9.31"
walkdir = "2.4.0"
git2 = { version = "0.20.0", default-features = false, features = [
"vendored-libgit2",
"vendored-openssl",
"ssh",
] }
clap = { version = "4.4.18", features = ["env", "string"] }
envconfig = "0.11.0"
dirs = "6.0.0"
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["json", "env-filter"] }
log = { version = "0.4.20", features = ["std", "kv_unstable"] }
tera = "1.19.1"
openssl = { version = "0.10.63", features = ["vendored"] }
libz-sys = { version = "1.1.15", default-features = false, features = [
"libc",
"static",
] }
inquire = { version = "0.9.0", features = ["console"] }
tempfile = { version = "3.10.0" }
serde_json = "1.0.113"
rlua = "0.20.0"
rlua-searcher = "0.1.0"
dotenvy = { version = "0.15.7" }
blake3 = "1.5.0"
tokio = { version = "1.36.0", features = ["full"] }
futures-util = "0.3.30"
fs_extra = "1.3.0"
[dependencies.reqwest]
version = "0.13"
default-features = false
features = ["rustls-tls", "json"]

View File

@@ -78,7 +78,7 @@ impl CuddleAction {
log::trace!("preparing to run action");
return match ShellAction::new(
match ShellAction::new(
self.name.clone(),
format!(
"{}/scripts/{}.sh",
@@ -98,7 +98,7 @@ impl CuddleAction {
log::error!("{}", e);
Err(e)
}
};
}
}
CuddleScript::Dagger(_d) => Err(anyhow::anyhow!("not implemented yet!")),
CuddleScript::Lua(l) => {
@@ -183,6 +183,184 @@ impl CuddleAction {
Ok(())
}
CuddleScript::Rust(script) => Ok(()),
}
}
}
pub mod rust_action {
use std::{path::PathBuf, time::Duration};
use anyhow::Context;
use futures_util::StreamExt;
use reqwest::Method;
use tokio::{fs::File, io::AsyncWriteExt};
use crate::model::{CuddleRustScript, CuddleRustUpstream, CuddleVariable};
pub struct RustActionConfig {
pub config_dir: PathBuf,
pub cache_dir: PathBuf,
}
impl Default for RustActionConfig {
fn default() -> Self {
let config = dirs::config_dir().expect("to be able to find a valid .config dir");
let cache = dirs::cache_dir().expect("to be able to find a valid .cache dir");
Self {
config_dir: config,
cache_dir: cache,
}
}
}
pub struct RustAction {
pub config: RustActionConfig,
pub plan: String,
pub binary_name: String,
}
impl RustAction {
pub fn new(plan: String, binary_name: String) -> Self {
Self {
plan,
binary_name,
config: RustActionConfig::default(),
}
}
pub async fn execute(
&self,
script: CuddleRustScript,
variables: impl IntoIterator<Item = CuddleVariable>,
) -> anyhow::Result<()> {
let commit_sha = self
.get_commit_sha()
.await
.context("failed to find a valid commit sha on the inferred path: .cuddle/plan")?;
let binary_hash = self.calculate_hash(commit_sha)?;
// Get cached binary
// let binary = match self.get_binary(&binary_hash).await? {
// Some(binary) => binary,
// None => self.fetch_binary(&script, &binary_hash).await?,
// };
// Execute binary
Ok(())
}
async fn get_binary(
&self,
binary_hash: impl Into<String>,
) -> anyhow::Result<Option<RustBinary>> {
let binary_path = self.get_cached_binary_path(binary_hash);
if !binary_path.exists() {
return Ok(None);
}
Ok(Some(RustBinary {}))
}
fn get_cached_binary_path(&self, binary_hash: impl Into<String>) -> PathBuf {
let cached_binary_name = self.get_cached_binary_name(binary_hash);
let binary_path = self
.config
.cache_dir
.join("binaries")
.join(cached_binary_name);
binary_path
}
#[inline]
fn get_cached_binary_name(&self, binary_hash: impl Into<String>) -> String {
format!("{}-{}", binary_hash.into(), self.binary_name)
}
async fn get_commit_sha(&self) -> anyhow::Result<String> {
let repo = git2::Repository::open(".cuddle/plan")?;
let head = repo.head()?;
let commit = head.peel_to_commit()?;
let commit_sha = commit.id();
Ok(commit_sha.to_string())
}
// async fn fetch_binary(
// &self,
// script: &CuddleRustScript,
// binary_hash: impl Into<String>,
// ) -> anyhow::Result<RustBinary> {
//let upstream = &script.upstream;
//TODO: we should interpret some template variables in the upstream string. Ignore for now though
// match UpstreamRustBinary::from(upstream) {
// UpstreamRustBinary::HttpBased { url } => {
// let client = reqwest::ClientBuilder::new()
// .user_agent(concat!(
// env!("CARGO_PKG_NAME"),
// "/",
// env!("CARGO_PKG_VERSION")
// ))
// .connect_timeout(Duration::from_secs(5))
// .build()?;
// let resp = client.request(Method::GET, url).send().await?;
// let mut stream = resp.bytes_stream();
// let mut file = File::create(self.get_cached_binary_name(binary_hash)).await?;
// while let Some(item) = stream.next().await {
// let chunk = item?;
// file.write_all(&chunk).await?;
// }
// // Make sure the entire file is written before we execute it
// file.flush().await?;
// todo!()
// }
// }
// }
fn calculate_hash(&self, commit_sha: impl Into<Vec<u8>>) -> anyhow::Result<String> {
let mut contents: Vec<u8> = Vec::new();
contents.append(&mut self.plan.clone().into_bytes());
contents.append(&mut commit_sha.into());
let hash = blake3::hash(&contents);
let hex = hash.to_hex();
Ok(hex.to_string())
}
}
pub struct RustBinary {}
pub enum UpstreamRustBinary {
HttpBased { url: String },
}
impl From<CuddleRustUpstream> for UpstreamRustBinary {
fn from(value: CuddleRustUpstream) -> Self {
match value {
CuddleRustUpstream::Gitea { url } => Self::HttpBased { url },
}
}
}
impl From<&CuddleRustUpstream> for UpstreamRustBinary {
fn from(value: &CuddleRustUpstream) -> Self {
match value {
CuddleRustUpstream::Gitea { url } => Self::HttpBased { url: url.clone() },
}
}
}
}

View File

@@ -31,7 +31,7 @@ impl ShellAction {
let mut process = Command::new(&path)
.current_dir(current_dir)
.envs(variables.iter().map(|v| {
.envs(variables.iter().rev().map(|v| {
log::trace!("{:?}", v);
(v.name.to_uppercase(), v.value.clone())

View File

@@ -15,7 +15,10 @@ use crate::{
util::git::GitCommit,
};
use self::subcommands::render_template::RenderTemplateCommand;
use self::subcommands::{
render::RenderCommand, render_kustomize::RenderKustomizeCommand,
render_template::RenderTemplateCommand,
};
#[derive(Debug, Clone)]
pub struct CuddleCli {
@@ -73,9 +76,8 @@ impl CuddleCli {
if let Ok(context_iter) = self.context.clone().unwrap().lock() {
for ctx in context_iter.iter() {
if let Some(variables) = ctx.plan.vars.clone() {
for (name, var) in variables {
self.variables.push(CuddleVariable::new(name, var))
}
let mut variables: Vec<CuddleVariable> = variables.into();
self.variables.append(&mut variables);
}
if let CuddleTreeType::Root = ctx.node_type {
@@ -83,7 +85,7 @@ impl CuddleCli {
temp_path.push(".cuddle/tmp");
self.variables.push(CuddleVariable::new(
"tmp".into(),
"tmp",
temp_path.clone().to_string_lossy().to_string(),
));
@@ -93,10 +95,9 @@ impl CuddleCli {
}
match GitCommit::new() {
Ok(commit) => self.variables.push(CuddleVariable::new(
"commit_sha".into(),
commit.commit_sha.clone(),
)),
Ok(commit) => self
.variables
.push(CuddleVariable::new("commit_sha", commit.commit_sha.clone())),
Err(e) => {
log::debug!("{}", e);
}
@@ -126,6 +127,7 @@ impl CuddleCli {
name,
l.description.clone(),
)),
CuddleScript::Rust(_) => todo!(),
}
}
}
@@ -136,7 +138,7 @@ impl CuddleCli {
}
fn process_templates(self) -> anyhow::Result<Self> {
if let None = self.tmp_dir {
if self.tmp_dir.is_none() {
log::debug!("cannot process template as bare bones cli");
return Ok(self);
}
@@ -147,11 +149,9 @@ impl CuddleCli {
.clone()
.ok_or(anyhow::anyhow!("tmp_dir does not exist aborting"))?;
match self.config.get_fetch_policy()? {
CuddleFetchPolicy::Always => {
if tmp_dir.exists() && tmp_dir.ends_with("tmp") {
CuddleFetchPolicy::Always if tmp_dir.exists() && tmp_dir.ends_with("tmp") => {
std::fs::remove_dir_all(tmp_dir.clone())?;
}
}
_ => {}
}
std::fs::create_dir_all(tmp_dir.clone())?;
@@ -169,12 +169,30 @@ impl CuddleCli {
continue;
}
for file in std::fs::read_dir(template_path)?.into_iter() {
for file in std::fs::read_dir(&template_path)? {
let f = file?;
let mut dest_file = tmp_dir.clone();
dest_file.push(f.file_name());
dest_file.push(f.path().strip_prefix(&template_path)?.parent().unwrap());
std::fs::copy(f.path(), dest_file)?;
tracing::trace!(
"moving from: {} to {}",
f.path().display(),
dest_file.display()
);
if f.path().is_dir() {
std::fs::create_dir_all(&dest_file)?;
}
fs_extra::copy_items(
&[f.path()],
&dest_file,
&fs_extra::dir::CopyOptions {
overwrite: true,
skip_exist: false,
..Default::default()
},
)?;
}
}
}
@@ -194,6 +212,8 @@ impl CuddleCli {
root_cmd = subcommands::x::build_command(root_cmd, self.clone());
root_cmd = subcommands::render_template::build_command(root_cmd);
root_cmd = subcommands::render_kustomize::build_command(root_cmd);
root_cmd = subcommands::render::build_command(root_cmd);
root_cmd = subcommands::init::build_command(root_cmd, self.clone());
self.command = Some(root_cmd);
@@ -223,11 +243,20 @@ impl CuddleCli {
let res = match matches.subcommand() {
Some(("x", exe_submatch)) => subcommands::x::execute_x(exe_submatch, self.clone()),
Some(("render", sub_matches)) => {
RenderCommand::execute(sub_matches, self.clone())?;
Ok(())
}
Some(("render_template", sub_matches)) => {
RenderTemplateCommand::from_matches(sub_matches, self.clone())
.and_then(|cmd| cmd.execute())?;
Ok(())
}
Some(("render-kustomize", sub_matches)) => {
RenderKustomizeCommand::from_matches(sub_matches, self.clone())
.and_then(|cmd| cmd.execute())?;
Ok(())
}
Some(("init", sub_matches)) => {
subcommands::init::execute_init(sub_matches, self.clone())
}

View File

@@ -0,0 +1,169 @@
use std::{collections::HashMap, path::PathBuf};
use anyhow::Context;
use clap::{Arg, ArgAction, ArgMatches, Command};
use serde_json::from_value;
use tera::Function;
use crate::{cli::CuddleCli, model::CuddleVariable};
pub fn build_command(root_cmd: Command) -> Command {
root_cmd.subcommand(
Command::new("folder")
.about("renders a template folder")
.args(&[
Arg::new("source")
.long("source")
.required(true)
.value_parser(clap::value_parser!(PathBuf)),
Arg::new("destination")
.long("destination")
.required(true)
.value_parser(clap::value_parser!(PathBuf)),
Arg::new("extra-var")
.long("extra-var")
.action(ArgAction::Append)
.required(false),
]),
)
}
pub struct FolderCommand {
variables: Vec<CuddleVariable>,
source: PathBuf,
destination: PathBuf,
}
impl FolderCommand {
pub fn from_matches(matches: &ArgMatches, cli: CuddleCli) -> anyhow::Result<Self> {
let source = matches
.get_one::<PathBuf>("source")
.expect("source")
.clone();
let destination = matches
.get_one::<PathBuf>("destination")
.expect("destination")
.clone();
let mut extra_vars: Vec<CuddleVariable> =
if let Some(extra_vars) = matches.get_many::<String>("extra-var") {
let mut vars = Vec::with_capacity(extra_vars.len());
for var in extra_vars.into_iter() {
let parts: Vec<&str> = var.split('=').collect();
if parts.len() != 2 {
return Err(anyhow::anyhow!("extra-var: is not set correctly: {}", var));
}
vars.push(CuddleVariable::new(parts[0], parts[1]));
}
vars
} else {
vec![]
};
extra_vars.append(&mut cli.variables.clone());
Ok(Self {
variables: extra_vars,
source,
destination,
})
}
pub fn execute(self) -> anyhow::Result<()> {
let _ = std::fs::remove_dir_all(&self.destination);
std::fs::create_dir_all(&self.destination).context("failed to create directory")?;
// Prepare context
let mut context = tera::Context::new();
for var in self.variables.iter().rev() {
context.insert(var.name.to_lowercase().replace([' ', '-'], "_"), &var.value)
}
let mut tera = tera::Tera::default();
tera.register_function("filter_by_prefix", filter_by_prefix(self.variables.clone()));
for entry in walkdir::WalkDir::new(&self.source) {
let entry = entry.context("entry was not found")?;
let entry_path = entry.path();
let rel_path = self
.destination
.join(entry_path.strip_prefix(&self.source)?);
if entry_path.is_file() {
// Load source template
let source = std::fs::read_to_string(entry_path)
.context("failed to read entry into memory")?;
let output = tera.render_str(&source, &context)?;
if let Some(parent) = rel_path.parent() {
std::fs::create_dir_all(parent).context("failed to create parent dir")?;
}
// Put template in final destination
std::fs::write(&rel_path, output).context(format!(
"failed to write to destination: {}",
&rel_path.display()
))?;
log::info!("finished writing template to: {}", &rel_path.display());
}
}
Ok(())
}
}
fn filter_by_prefix(variables: Vec<CuddleVariable>) -> impl Function {
Box::new(
move |args: &HashMap<String, tera::Value>| -> tera::Result<tera::Value> {
for var in &variables {
tracing::info!("variable: {} - {}", var.name, var.value);
}
let prefix = match args.get("prefix") {
Some(value) => match from_value::<Vec<String>>(value.clone()) {
Ok(prefix) => prefix,
Err(e) => {
tracing::error!("prefix was not a string: {}", e);
return Err("prefix was not a string".into());
}
},
None => return Err("prefix is required".into()),
};
let prefix = prefix.join("_");
let vars = variables
.iter()
.filter_map(|v| {
if v.name.starts_with(&prefix) {
Some(CuddleVariable::new(
v.name.trim_start_matches(&prefix).trim_start_matches('_'),
v.value.clone(),
))
} else {
None
}
})
.collect::<Vec<CuddleVariable>>();
let mut structure: HashMap<String, String> = HashMap::new();
for var in vars {
if !structure.contains_key(&var.name) {
tracing::info!("found: {} - {}", &var.name, &var.value);
structure.insert(var.name, var.value);
}
}
Ok(serde_json::to_value(structure).unwrap())
},
)
}
fn filter_by_name(args: &HashMap<String, tera::Value>) -> tera::Result<tera::Value> {
Ok(tera::Value::Null)
}

View File

@@ -3,6 +3,7 @@ use std::fs::{create_dir_all, read, read_dir};
use std::io::Write;
use std::path::PathBuf;
use anyhow::Context;
use clap::{ArgMatches, Command};
use walkdir::WalkDir;
@@ -20,8 +21,8 @@ pub fn build_command(root_cmd: Command, _cli: CuddleCli) -> Command {
let execute_cmd = Command::new("init")
.about("init bootstraps a repository from a template")
.arg(repo_url)
.arg(clap::Arg::new("name"))
.arg(clap::Arg::new("path"))
.arg(clap::Arg::new("name").long("name"))
.arg(clap::Arg::new("path").long("path"))
.arg(clap::Arg::new("value").short('v').long("value"));
root_cmd.subcommand(execute_cmd)
@@ -128,7 +129,7 @@ pub fn execute_init(exe_submatch: &ArgMatches, _cli: CuddleCli) -> anyhow::Resul
if dir.count() != 0 {
for entry in read_dir(&path)? {
let entry = entry?;
if entry.file_name() == ".git" {
if entry.file_name() == ".git" || entry.file_name() == ".jj" {
continue;
} else {
anyhow::bail!("Directory {} is not empty", &path);
@@ -178,8 +179,16 @@ pub fn execute_init(exe_submatch: &ArgMatches, _cli: CuddleCli) -> anyhow::Resul
}
tracing::info!("writing to: {}", new_path.display());
let new_content =
replace_with_variables(&std::fs::read_to_string(entry_path)?, &template)?;
let old_content = match std::fs::read_to_string(entry_path) {
Ok(e) => e,
Err(e) => {
tracing::debug!("found invalid file possibly with invalid utf8: {}", e);
std::fs::copy(entry_path, new_path).context("failed to write file")?;
continue;
}
};
let new_content = replace_with_variables(&old_content, &template)?;
std::fs::write(new_path, new_content.as_bytes())?;
}

View File

@@ -0,0 +1,91 @@
use std::{io::Write, path::PathBuf};
use anyhow::Context;
use clap::{Arg, ArgMatches, Command};
use crate::cli::CuddleCli;
pub fn build_command(root_cmd: Command) -> Command {
root_cmd.subcommand(
Command::new("kustomize")
.about("renders a kustomize folder")
.args(&[
Arg::new("kustomize-folder")
.long("kustomize-folder")
.value_parser(clap::value_parser!(PathBuf))
.required(true),
Arg::new("destination")
.long("destination")
.required(true)
.value_parser(clap::value_parser!(PathBuf)),
]),
)
}
pub struct KustomizeCommand {
kustomize_folder: PathBuf,
destination: PathBuf,
}
impl KustomizeCommand {
pub fn from_matches(matches: &ArgMatches, _cli: CuddleCli) -> anyhow::Result<Self> {
let kustomize_folder = matches
.get_one::<PathBuf>("kustomize-folder")
.expect("kustomize-folder")
.clone();
let destination = matches
.get_one::<PathBuf>("destination")
.expect("destination")
.clone();
Ok(Self {
kustomize_folder,
destination,
})
}
pub fn execute(self) -> anyhow::Result<()> {
let mut cmd = std::process::Command::new("kubectl");
let _ = std::fs::remove_dir_all(&self.destination);
std::fs::create_dir_all(&self.destination)?;
let cmd = cmd
.arg("kustomize")
.arg("--enable-helm")
.arg(self.kustomize_folder);
let output = cmd.output().context("failed to run kubectl kustomize")?;
if !output.status.success() {
anyhow::bail!(
"failed to run kustomize: {}",
output.status.code().expect("to find exit code")
)
}
let mut cmd = std::process::Command::new("kubectl-slice");
let cmd = cmd
.arg("-o")
.arg(self.destination)
.stdin(std::process::Stdio::piped());
let mut child = cmd.spawn().context("failed to run kubectl-slice")?;
if let Some(mut stdin) = child.stdin.take() {
stdin.write_all(&output.stdout)?;
}
let output = child
.wait_with_output()
.context("failed to run kubectl-slice")?;
if !output.status.success() {
anyhow::bail!(
"failed to run kustomize: {}",
output.status.code().expect("to find exit code")
)
}
Ok(())
}
}

View File

@@ -0,0 +1,7 @@
pub mod folder;
pub mod init;
pub mod kustomize;
pub mod render;
pub mod render_kustomize;
pub mod render_template;
pub mod x;

View File

@@ -0,0 +1,34 @@
use anyhow::Context;
use clap::{ArgMatches, Command};
use crate::cli::CuddleCli;
use super::{folder::FolderCommand, kustomize::KustomizeCommand};
pub fn build_command(root_cmd: Command) -> Command {
let cmd = Command::new("render").about("accesses different render commands");
let cmd = super::kustomize::build_command(cmd);
let cmd = super::folder::build_command(cmd);
root_cmd.subcommand(cmd)
}
pub struct RenderCommand {}
impl RenderCommand {
pub fn execute(matches: &ArgMatches, cli: CuddleCli) -> anyhow::Result<()> {
match matches.subcommand() {
Some(("kustomize", sub_matches)) => {
KustomizeCommand::from_matches(sub_matches, cli)?.execute()?;
}
Some(("folder", sub_matches)) => {
FolderCommand::from_matches(sub_matches, cli)?
.execute()
.context("failed to render folder")?;
}
_ => anyhow::bail!("failed to find match for render"),
}
Ok(())
}
}

View File

@@ -0,0 +1,70 @@
use std::path::PathBuf;
use clap::{Arg, ArgMatches, Command};
use crate::cli::CuddleCli;
pub fn build_command(root_cmd: Command) -> Command {
root_cmd.subcommand(
Command::new("render-kustomize")
.about("renders a kustomize folder")
.args(&[
Arg::new("kustomize-folder")
.long("kustomize-folder")
.value_parser(clap::value_parser!(PathBuf))
.required(true),
Arg::new("destination")
.long("destination")
.required(true)
.value_parser(clap::value_parser!(PathBuf)),
]),
)
}
pub struct RenderKustomizeCommand {
kustomize_folder: PathBuf,
destination: PathBuf,
}
impl RenderKustomizeCommand {
pub fn from_matches(matches: &ArgMatches, _cli: CuddleCli) -> anyhow::Result<Self> {
let kustomize_folder = matches
.get_one::<PathBuf>("kustomize-folder")
.expect("kustomize-folder")
.clone();
let destination = matches
.get_one::<PathBuf>("destination")
.expect("destination")
.clone();
Ok(Self {
kustomize_folder,
destination,
})
}
pub fn execute(self) -> anyhow::Result<()> {
let mut cmd = std::process::Command::new("kubectl");
std::fs::create_dir_all(&self.destination)?;
let cmd = cmd
.arg("kustomize")
.arg(self.kustomize_folder)
.arg(format!("--output={}", self.destination.display()));
let mut process = cmd.spawn()?;
let exit = process.wait()?;
if !exit.success() {
anyhow::bail!(
"failed to run kustomize: {}",
exit.code().expect("to find exit code")
)
}
Ok(())
}
}

View File

@@ -1,9 +1,13 @@
use std::{path::PathBuf, str::FromStr};
use anyhow::Context;
use clap::{Arg, ArgMatches, Command};
use crate::{cli::CuddleCli, model::CuddleVariable};
const DESTINATION: &str = "destination is the output path of the template once done, but default .tmpl is stripped and the normal file extension is used. this can be overwritten if a file path is entered instead. I.e. (/some/file/name.txt)";
const TEMPLATE_FILE: &str = "template-file is the input file path of the .tmpl file (or inferred) that you would like to render";
pub fn build_command(root_cmd: Command) -> Command {
root_cmd.subcommand(
Command::new("render_template")
@@ -14,19 +18,21 @@ pub fn build_command(root_cmd: Command) -> Command {
.short('t')
.long("template-file")
.required(true)
.action(clap::ArgAction::Set).long_help("template-file is the input file path of the .tmpl file (or inferred) that you would like to render"),
.action(clap::ArgAction::Set)
.long_help(TEMPLATE_FILE),
Arg::new("destination")
.alias("dest")
.short('d')
.long("destination")
.required(true)
.action(clap::ArgAction::Set)
.long_help("destination is the output path of the template once done, but default .tmpl is stripped and the normal file extension is used. this can be overwritten if a file path is entered instead. I.e. (/some/file/name.txt)"),
.long_help(DESTINATION),
Arg::new("extra-var")
.long("extra-var")
.required(false)
.action(clap::ArgAction::Set),
]))
.action(clap::ArgAction::Append),
]),
)
}
pub struct RenderTemplateCommand {
@@ -46,18 +52,19 @@ impl RenderTemplateCommand {
.get_one::<String>("destination")
.ok_or(anyhow::anyhow!("destination was not found"))
.and_then(get_path_buf_and_check_dir_exists)
.and_then(RenderTemplateCommand::transform_extension)?;
.and_then(RenderTemplateCommand::transform_extension)
.context("failed to access dest directory")?;
let mut extra_vars: Vec<CuddleVariable> =
if let Some(extra_vars) = matches.get_many::<String>("extra-var") {
let mut vars = Vec::with_capacity(extra_vars.len());
for var in extra_vars.into_iter() {
let parts: Vec<&str> = var.split("=").collect();
let parts: Vec<&str> = var.split('=').collect();
if parts.len() != 2 {
return Err(anyhow::anyhow!("extra-var: is not set correctly: {}", var));
}
vars.push(CuddleVariable::new(parts[0].into(), parts[1].into()));
vars.push(CuddleVariable::new(parts[0], parts[1]));
}
vars
} else {
@@ -77,10 +84,7 @@ impl RenderTemplateCommand {
// Prepare context
let mut context = tera::Context::new();
for var in self.variables {
context.insert(
var.name.to_lowercase().replace(" ", "_").replace("-", "_"),
&var.value,
)
context.insert(var.name.to_lowercase().replace([' ', '-'], "_"), &var.value)
}
// Load source template
@@ -88,8 +92,15 @@ impl RenderTemplateCommand {
let output = tera::Tera::one_off(source.as_str(), &context, false)?;
if let Some(parent) = self.destination.parent() {
std::fs::create_dir_all(parent)?;
}
// Put template in final destination
std::fs::write(&self.destination, output)?;
std::fs::write(&self.destination, output).context(format!(
"failed to write to destination: {}",
&self.destination.display(),
))?;
log::info!(
"finished writing template to: {}",
@@ -118,8 +129,8 @@ impl RenderTemplateCommand {
}
}
fn get_path_buf_and_check_exists(raw_path: &String) -> anyhow::Result<PathBuf> {
match PathBuf::from_str(&raw_path) {
fn get_path_buf_and_check_exists(raw_path: impl Into<String>) -> anyhow::Result<PathBuf> {
match PathBuf::from_str(&raw_path.into()) {
Ok(pb) => {
if pb.exists() {
Ok(pb)
@@ -134,17 +145,9 @@ fn get_path_buf_and_check_exists(raw_path: &String) -> anyhow::Result<PathBuf> {
}
}
fn get_path_buf_and_check_dir_exists(raw_path: &String) -> anyhow::Result<PathBuf> {
match PathBuf::from_str(&raw_path) {
Ok(pb) => {
if pb.is_dir() && pb.exists() {
Ok(pb)
} else if pb.is_file() {
Ok(pb)
} else {
Ok(pb)
}
}
fn get_path_buf_and_check_dir_exists(raw_path: impl Into<String>) -> anyhow::Result<PathBuf> {
match PathBuf::from_str(&raw_path.into()) {
Ok(pb) => Ok(pb),
Err(e) => Err(anyhow::anyhow!(e)),
}
}

View File

@@ -61,6 +61,7 @@ pub fn build_scripts(cli: CuddleCli) -> Vec<Command> {
}
crate::model::CuddleScript::Dagger(_) => todo!(),
crate::model::CuddleScript::Lua(l) => {}
crate::model::CuddleScript::Rust(_) => todo!(),
}
cmds.push(cmd)

View File

@@ -1,7 +1,6 @@
use std::{
env::{self, current_dir},
ffi::OsStr,
io::Write,
path::{Path, PathBuf},
sync::{Arc, Mutex},
};
@@ -45,7 +44,7 @@ pub fn extract_cuddle(
// Load main cuddle file.
let cuddle_yaml = find_root_cuddle()?;
if let None = cuddle_yaml {
if cuddle_yaml.is_none() {
return Ok(None);
}
let cuddle_yaml = cuddle_yaml.unwrap();
@@ -121,7 +120,7 @@ fn pull_parent_cuddle_into_local(
) -> anyhow::Result<()> {
let mut rc = RemoteCallbacks::new();
rc.credentials(|_url, username_from_url, _allowed_types| {
if "true".to_string() == std::env::var("CUDDLE_SSH_AGENT").ok().unwrap_or("".into()) {
if *"true" == std::env::var("CUDDLE_SSH_AGENT").ok().unwrap_or("".into()) {
git2::Cred::ssh_key_from_agent(username_from_url.unwrap())
} else {
git2::Cred::ssh_key(
@@ -133,6 +132,8 @@ fn pull_parent_cuddle_into_local(
}
});
rc.certificate_check(|_cert, _something| Ok(git2::CertificateCheckStatus::CertificateOk));
let mut fo = FetchOptions::new();
fo.remote_callbacks(rc);
@@ -152,7 +153,7 @@ fn recurse_parent(
context: Arc<Mutex<Vec<CuddleContext>>>,
) -> anyhow::Result<Option<()>> {
let cuddle_contents = find_cuddle(path.clone())?;
if let None = cuddle_contents {
if cuddle_contents.is_none() {
return Ok(None);
}
let cuddle_plan = serde_yaml::from_str::<CuddlePlan>(&cuddle_contents.unwrap())?;
@@ -169,14 +170,12 @@ fn recurse_parent(
}
match cuddle_plan.base {
CuddleBase::Bool(true) => {
return Err(anyhow::anyhow!(
CuddleBase::Bool(true) => Err(anyhow::anyhow!(
"plan cannot be enabled without specifying a plan"
))
}
)),
CuddleBase::Bool(false) => {
log::debug!("plan is root: finishing up");
return Ok(Some(()));
Ok(Some(()))
}
CuddleBase::String(parent_plan) => {
let destination_path = create_cuddle(path.clone())?;
@@ -186,7 +185,7 @@ fn recurse_parent(
if !cuddle_dest.exists() {
pull_parent_cuddle_into_local(parent_plan, cuddle_dest.clone())?;
}
return recurse_parent(cuddle_dest, context.clone());
recurse_parent(cuddle_dest, context.clone())
}
}
}

View File

@@ -11,7 +11,7 @@ mod util;
fn main() -> anyhow::Result<()> {
init_logging()?;
let _ = dotenv::dotenv();
let _ = dotenvy::dotenv();
let config = CuddleConfig::from_env()?;

238
cuddle/src/model.rs Normal file
View File

@@ -0,0 +1,238 @@
use std::collections::HashMap;
use serde::Deserialize;
#[derive(Debug, Clone, PartialEq, Deserialize)]
#[serde(untagged)]
pub enum CuddleBase {
Bool(bool),
String(String),
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct CuddleShellScriptArgEnv {
pub key: String,
pub description: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct CuddleShellScriptArgFlag {
pub name: String,
pub description: Option<String>,
pub required: Option<bool>,
pub default_value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
#[serde(tag = "type")]
pub enum CuddleShellScriptArg {
#[serde(alias = "env")]
Env(CuddleShellScriptArgEnv),
#[serde(alias = "flag")]
Flag(CuddleShellScriptArgFlag),
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct CuddleShellScript {
pub description: Option<String>,
pub args: Option<HashMap<String, CuddleShellScriptArg>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct CuddleDaggerScript {
pub description: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct CuddleLuaScript {
pub description: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub enum CuddleRustUpstream {
#[serde(alias = "gitea")]
Gitea { url: String },
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct CuddleRustScript {
pub description: Option<String>,
pub upstream: CuddleRustUpstream,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
#[serde(tag = "type")]
pub enum CuddleScript {
#[serde(alias = "shell")]
Shell(CuddleShellScript),
#[serde(alias = "dagger")]
Dagger(CuddleDaggerScript),
#[serde(alias = "lua")]
Lua(CuddleLuaScript),
#[serde(alias = "rust")]
Rust(CuddleRustScript),
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct CuddlePlan {
pub base: CuddleBase,
pub vars: Option<CuddlePlanVariables>,
pub scripts: Option<HashMap<String, CuddleScript>>,
}
#[derive(Deserialize, Debug, Clone, PartialEq)]
pub struct CuddlePlanVariables(HashMap<String, CuddlePlanVar>);
impl From<CuddlePlanVariables> for Vec<CuddleVariable> {
fn from(value: CuddlePlanVariables) -> Self {
let variables: CuddleVariables = value.0.into();
let mut vars = variables.0;
vars.sort_by(|a, b| a.name.partial_cmp(&b.name).unwrap());
vars
}
}
#[derive(Deserialize, Debug, Clone, PartialEq)]
#[serde(untagged)]
pub enum CuddlePlanVar {
Str(String),
Nested(HashMap<String, CuddlePlanVar>),
Array(Vec<CuddlePlanVar>),
}
#[derive(Clone, Debug, PartialEq)]
struct CuddleVariables(Vec<CuddleVariable>);
impl From<HashMap<String, CuddlePlanVar>> for CuddleVariables {
fn from(value: HashMap<String, CuddlePlanVar>) -> Self {
let mut variables = Vec::new();
for (k, v) in value {
match v {
CuddlePlanVar::Str(value) => variables.push(CuddleVariable::new(k, value)),
CuddlePlanVar::Nested(nested) => {
let nested_variables: CuddleVariables = nested.into();
let mut combined_variables: Vec<_> = nested_variables
.0
.into_iter()
.map(|v| CuddleVariable::new(format!("{}_{}", k, v.name), v.value))
.collect();
variables.append(&mut combined_variables);
}
CuddlePlanVar::Array(_) => {}
}
}
CuddleVariables(variables)
}
}
#[derive(Debug, Clone, PartialEq, Deserialize, serde::Serialize)]
#[allow(dead_code)]
pub struct CuddleVariable {
pub name: String,
pub value: String,
}
impl CuddleVariable {
pub fn new(name: impl Into<String>, value: impl Into<String>) -> Self {
Self {
name: name.into(),
value: value.into(),
}
}
}
impl From<HashMap<String, CuddlePlanVar>> for CuddlePlanVar {
fn from(value: HashMap<String, CuddlePlanVar>) -> Self {
CuddlePlanVar::Nested(value)
}
}
impl From<HashMap<&str, CuddlePlanVar>> for CuddlePlanVar {
fn from(value: HashMap<&str, CuddlePlanVar>) -> Self {
CuddlePlanVar::Nested(value.into_iter().map(|(k, v)| (k.to_string(), v)).collect())
}
}
impl From<String> for CuddlePlanVar {
fn from(value: String) -> Self {
CuddlePlanVar::Str(value)
}
}
impl From<&str> for CuddlePlanVar {
fn from(value: &str) -> Self {
CuddlePlanVar::Str(value.to_string())
}
}
#[cfg(test)]
mod test {
use std::collections::HashMap;
use super::{CuddlePlanVariables, CuddleVariable};
#[test]
pub fn parse_cuddle_variables() {
let cuddle = r#"
someKey: someValue
someNestedKey:
someNestedNestedKey:
someKey: key
someKey: key
"#;
let cuddle_var: CuddlePlanVariables = serde_yaml::from_str(cuddle).unwrap();
let mut expected = HashMap::new();
expected.insert("someKey", "someValue".into());
let mut nested_key = HashMap::new();
nested_key.insert("someKey", "key".into());
let mut nested_nested_key = HashMap::new();
nested_nested_key.insert("someKey", "key".into());
nested_key.insert("someNestedNestedKey", nested_nested_key.into());
expected.insert("someNestedKey", nested_key.into());
assert_eq!(
CuddlePlanVariables(
expected
.into_iter()
.map(|(k, v)| (k.to_string(), v))
.collect()
),
cuddle_var
);
}
#[test]
pub fn to_cuddle_variables() {
let cuddle = r#"
someKey: someValue
someNestedKey:
someNestedNestedKey:
someKey: key
someKey: key
"#;
let cuddle_var: CuddlePlanVariables = serde_yaml::from_str(cuddle).unwrap();
let variables: Vec<CuddleVariable> = cuddle_var.into();
let mut expected: Vec<CuddleVariable> = vec![
CuddleVariable::new("someKey", "someValue"),
CuddleVariable::new("someNestedKey_someKey", "key"),
CuddleVariable::new("someNestedKey_someNestedNestedKey_someKey", "key"),
];
expected.sort_by(|a, b| a.name.partial_cmp(&b.name).unwrap());
assert_eq!(expected, variables);
}
}

View File

@@ -1,40 +0,0 @@
[package]
name = "cuddle_cli"
version = "0.1.0"
edition = "2021"
[[bin]]
name = "cuddle"
path = "src/main.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = { version = "1.0.60", features = ["backtrace"] }
serde = { version = "1.0.143", features = ["derive"] }
serde_yaml = "0.9.4"
walkdir = "2.3.2"
git2 = { version = "0.17.2", default-features = false, features = [
"vendored-libgit2",
"vendored-openssl",
"ssh",
] }
clap = { version = "4.3.4", features = ["env", "string"] }
envconfig = "0.10.0"
dirs = "5.0.1"
tracing = "0.1.36"
tracing-subscriber = { version = "0.3.15", features = ["json", "env-filter"] }
log = { version = "0.4.17", features = ["std", "kv_unstable"] }
tera = "1.17.0"
openssl = { version = "0.10.54", features = ["vendored"] }
libz-sys = { version = "1.1.9", default-features = false, features = [
"libc",
"static",
] }
inquire = { version = "0.6.2", features = ["console"] }
tempfile = { version = "3.6.0" }
serde_json = "1.0.97"
rlua = "0.19.5"
rlua-searcher = { git = "https://git.front.kjuulh.io/kjuulh/rlua-searcher.git", rev = "2b29a9d0e86ec7f91b31dd844a58168969b7b74b" }
dotenv = { version = "0.15.0", features = ["clap"] }

View File

@@ -1,3 +0,0 @@
pub mod init;
pub mod render_template;
pub mod x;

View File

@@ -1,79 +0,0 @@
use std::collections::HashMap;
use serde::Deserialize;
#[derive(Debug, Clone, PartialEq, Deserialize)]
#[serde(untagged)]
pub enum CuddleBase {
Bool(bool),
String(String),
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct CuddleShellScriptArgEnv {
pub key: String,
pub description: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct CuddleShellScriptArgFlag {
pub name: String,
pub description: Option<String>,
pub required: Option<bool>,
pub default_value: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
#[serde(tag = "type")]
pub enum CuddleShellScriptArg {
#[serde(alias = "env")]
Env(CuddleShellScriptArgEnv),
#[serde(alias = "flag")]
Flag(CuddleShellScriptArgFlag),
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct CuddleShellScript {
pub description: Option<String>,
pub args: Option<HashMap<String, CuddleShellScriptArg>>,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct CuddleDaggerScript {
pub description: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct CuddleLuaScript {
pub description: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
#[serde(tag = "type")]
pub enum CuddleScript {
#[serde(alias = "shell")]
Shell(CuddleShellScript),
#[serde(alias = "dagger")]
Dagger(CuddleDaggerScript),
#[serde(alias = "lua")]
Lua(CuddleLuaScript),
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
pub struct CuddlePlan {
pub base: CuddleBase,
pub vars: Option<HashMap<String, String>>,
pub scripts: Option<HashMap<String, CuddleScript>>,
}
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct CuddleVariable {
pub name: String,
pub value: String,
}
impl CuddleVariable {
pub fn new(name: String, value: String) -> Self {
Self { name, value }
}
}

View File

@@ -1,6 +1,6 @@
#!/bin/bash
CUDDLE_FETCH_POLICY=never cuddle_cli render_template \
CUDDLE_FETCH_POLICY=never cuddle render_template \
--template-file "$TMP/input.txt.tmpl" \
--destination "$TMP/input.txt" \
--extra-var "extravar=someextravar"

View File

@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"additionalProperties": true,
"properties": {
"base": {
"title": "Base url from which to base current cuddle plan on",
@@ -27,6 +27,9 @@
},
{
"type": "object"
},
{
"type": "array"
}
]
}

View File

@@ -1,5 +1,5 @@
#!/bin/bash
cargo install --path cuddle_cli/
cargo install --path cuddle/ --force
cuddle --version

View File

@@ -16,11 +16,20 @@ WORKDIR /app/cuddle/
COPY . .
RUN cargo install --target x86_64-unknown-linux-musl --path cuddle_cli
RUN cargo install --target x86_64-unknown-linux-musl --path cuddle
FROM docker:dind
RUN apk add bash git
RUN apk add bash git kubectl
ENV SLICE_VERSION=v1.2.7
RUN wget -O kubectl-slice_linux_x86_64.tar.gz \
"https://github.com/patrickdappollonio/kubectl-slice/releases/download/$SLICE_VERSION/kubectl-slice_linux_x86_64.tar.gz" && \
tar -xf kubectl-slice_linux_x86_64.tar.gz && \
chmod +x ./kubectl-slice && \
mv ./kubectl-slice /usr/local/bin/kubectl-slice && \
rm kubectl-slice_linux_x86_64.tar.gz
RUN eval `ssh-agent`
COPY --from=1password/op:2 /usr/local/bin/op /usr/local/bin/op