Compare commits

..

504 Commits
0.1.0 ... dev

Author SHA1 Message Date
Jef Roosens 3b24ad0f2c
fix(web): don't log new metric for every query param 2023-02-19 16:38:53 +01:00
Jef Roosens 69cc2404db Merge pull request 'update to V 0.3.3' (#347) from Chewing_Bever/vieter:v-0.3.3 into dev
Reviewed-on: vieter-v/vieter#347
2023-02-19 16:03:02 +01:00
Jef Roosens f423dcf26b
chore: updated PKGBUILDs 2023-02-19 15:54:31 +01:00
Jef Roosens beae2cebd2
fix(ci): lock slate version 2023-02-16 13:33:00 +01:00
Jef Roosens a3a83a94ae chore(ci): update CI to new Vlang version 2023-02-15 20:50:55 +01:00
Jef Roosens 455f3b5f41 fix: compile with selected V version 2023-02-15 20:07:07 +01:00
Jef Roosens 4dc82515f4 chore: stop shadowing import names with variables 2023-02-15 16:24:07 +01:00
Jef Roosens bff817ccd9
fix: add temporary fix to compile with V 0.3.3 2023-02-08 11:30:38 +01:00
Jef Roosens 8a08423907
chore(ci): update V images 2023-02-08 11:15:41 +01:00
Jef Roosens b9598ca046
chore: rewrite docstrings with generics 2023-02-08 11:11:28 +01:00
Jef Roosens 91a976c634
chore: rename db module to avoid conflict with vlib 2023-02-08 11:09:18 +01:00
Jef Roosens b3a119f221
chore: ran v fmt for v 0.3.3 changes 2023-02-08 11:00:17 +01:00
Jef Roosens e10b450abd
fix: metrics no longer bloat memory 2023-01-28 17:35:01 +01:00
Jef Roosens 8f32888dff
fix: i'm too lazy to test these 2023-01-28 15:27:47 +01:00
Jef Roosens da370f42fd
fix: update md5sums in pkgbuild 2023-01-28 15:22:04 +01:00
Jef Roosens 0d6ca8d3e4 Merge pull request 'Cron implementation in C' (#341) from Chewing_Bever/vieter:c-cron into dev
Reviewed-on: vieter-v/vieter#341
2023-01-28 15:19:39 +01:00
Jef Roosens 434c4eb558
chore: updated changelog 2023-01-28 14:53:43 +01:00
Jef Roosens 3b320ac7c3
fix: accidentally changed submodule commit 2023-01-28 14:39:12 +01:00
Jef Roosens 8d14d5c3fd
chore: update PKGBUILD to use git submodule 2023-01-28 14:36:46 +01:00
Jef Roosens 6ca53ce534 chore: use libvieter dev branch instead 2023-01-28 13:18:44 +01:00
Jef Roosens ba89110eab chore: some fixes 2023-01-28 13:18:44 +01:00
Jef Roosens ad19bc660a chore: switch to alpine 3.17 ci image 2023-01-28 13:18:44 +01:00
Jef Roosens beb90d5756 refactor: link libvieter; remove cron code & daemon
This giant commit removes the old cron daemon & parser, replacing the
latter with a C implementation that will now be maintained in a separate
C library that gets developed independently. This commit lays the
groundwork for implementing features of Vieter in C where possible.
2023-01-28 13:16:36 +01:00
Jef Roosens bfd28d6f70 Merge pull request 'Fix for configured log level being ignored.' (#339) from GreekStapler/vieter:fix/logging_level into dev
Reviewed-on: vieter-v/vieter#339
2023-01-08 09:27:12 +01:00
GreekStapler 8432f5915d Fix for configured log level being ignored. 2023-01-07 21:09:55 +00:00
Jef Roosens 5176266ca1
refactor: work with new docker lib 2023-01-05 17:05:57 +01:00
Jef Roosens b5ff50066b Merge pull request 'Search targets using API' (#332) from Chewing_Bever/vieter:search-targets into dev
Reviewed-on: vieter-v/vieter#332
2023-01-04 14:50:49 +01:00
Jef Roosens 398e2bd9eb
chore: update docs; final read 2023-01-04 14:37:41 +01:00
Jef Roosens 39a026fdb3
feat: add filtering of targets by arch 2023-01-04 14:13:26 +01:00
Jef Roosens b0fe6b7384
chore: ran formatter 2023-01-04 14:13:26 +01:00
Jef Roosens c9edb55abc
feat(db): implemented iterator over targets 2023-01-04 14:13:25 +01:00
Jef Roosens f8f611f5c5
feat(api): add search query to targets 2023-01-04 14:12:34 +01:00
Jef Roosens 60d5fb77e0
feat(metrics): add prefix; use base unit for time 2023-01-04 09:19:02 +01:00
Jef Roosens 849bf54979 Merge pull request 'Add Prometheus metrics endpoint' (#325) from Chewing_Bever/vieter:metrics into dev
Reviewed-on: vieter-v/vieter#325
2023-01-03 21:51:16 +01:00
Jef Roosens 4ed4ef4a27
chore: generate man pages using debug build 2023-01-03 09:29:55 +01:00
Jef Roosens 4ca2521937 feat(server): ability to disable metrics 2022-12-29 22:00:43 +01:00
Jef Roosens c0f58ddc77 feat(server): add metric collection 2022-12-29 21:53:47 +01:00
Jef Roosens 8a0214babe Merge pull request 'Release 0.5.0' (#330) from release-0.5.0 into main
Reviewed-on: vieter-v/vieter#330
2022-12-29 20:17:51 +01:00
Jef Roosens 1c70bce9e4
chore: bump versions to 0.5.0 2022-12-29 15:49:59 +01:00
Jef Roosens 6738f8de67 Merge pull request 'Some final stuff before 0.5.0' (#323) from Chewing_Bever/vieter:final-stuff into dev
Reviewed-on: vieter-v/vieter#323
2022-12-28 22:42:34 +01:00
Jef Roosens 4635127ba2
docs: removed an outdated page 2022-12-28 22:15:48 +01:00
Jef Roosens bb4406404d
chore: use new conf features 2022-12-28 22:02:02 +01:00
Jef Roosens cac74db086
feat(console): add commands for removing repos, arch-repos, packages 2022-12-28 21:56:02 +01:00
Jef Roosens b7af051103
feat(client): support removing repos, arch-repos & packages 2022-12-28 21:24:30 +01:00
Jef Roosens 641cf22669
feat(cli): add flag to filter logs by exit codes 2022-12-23 08:18:49 +01:00
Jef Roosens 3342eedfa4
chore: compile with -skip-unused 2022-12-22 23:18:01 +01:00
Jef Roosens dc517c23c5 Merge pull request 'Release 0.5.0: release candidate 2' (#320) from release-0.5.0-rc.2 into main
Reviewed-on: vieter-v/vieter#320
2022-12-22 00:15:57 +01:00
Jef Roosens be3762835d
chore: bump versions to 0.5.0-rc.2 2022-12-21 23:45:42 +01:00
Jef Roosens ab6da78738
feat(cli): use posx-style long options 2022-12-21 23:42:15 +01:00
Jef Roosens 2c93316688
fix: log removal daemon now properly cleans all old logs 2022-12-19 12:43:46 +01:00
Jef Roosens 0a3e883f4d Merge pull request 'Removal of logs' (#318) from Chewing_Bever/vieter:logs-removal into dev
Reviewed-on: vieter-v/vieter#318
2022-12-19 12:15:39 +01:00
Jef Roosens ab81eebd87
refactor: some small changes before PR 2022-12-19 11:58:35 +01:00
Jef Roosens b66d1161ed
docs: update docs some more 2022-12-19 11:24:22 +01:00
Jef Roosens 26796f2228
feat(server): use cron schedule for log removal instead 2022-12-19 09:49:03 +01:00
Jef Roosens 09c61143b0
docs: updated the docs 2022-12-19 09:48:56 +01:00
Jef Roosens a9ad3088bb
feat(server): add log removal daemon 2022-12-17 17:11:19 +01:00
Jef Roosens af409011e6
feat: add api & cli command to remove log 2022-12-17 16:24:01 +01:00
Jef Roosens 8b72a9fc0f Merge pull request 'Release 0.5.0: release candidate 1' (#316) from release-0.5.0-rc.1 into main
Reviewed-on: vieter-v/vieter#316
2022-12-17 14:13:05 +01:00
Jef Roosens f9bb4b81de
chore: bump versions 2022-12-17 14:00:51 +01:00
Jef Roosens 300c5490a6 Merge pull request 'Correctly calculate agent sleep time' (#310) from Chewing_Bever/vieter:more-fixes into dev
Reviewed-on: vieter-v/vieter#310
2022-12-16 22:13:41 +01:00
Jef Roosens b067f9c589 refactor: streamline agent loop code 2022-12-16 22:06:26 +01:00
Jef Roosens 1797c0f560 fix(agent): correctly calculate sleep time 2022-12-16 21:47:02 +01:00
Jef Roosens 946d9acd59 Merge pull request 'Actually use path variable' (#307) from Chewing_Bever/vieter:fix-path-build into dev
Reviewed-on: vieter-v/vieter#307
2022-12-16 20:46:16 +01:00
Jef Roosens 402fef475a fix: actually use path setting when building 2022-12-16 20:38:26 +01:00
Jef Roosens 894323ddcb Merge pull request 'Address some small problems' (#306) from Chewing_Bever/vieter:image-fixes into dev
Reviewed-on: vieter-v/vieter#306
2022-12-16 19:54:44 +01:00
Jef Roosens fe3e6e2bab chore: some final revisions before pr merge 2022-12-16 18:55:44 +01:00
Jef Roosens af4c9e1d00
chore: updated changelog 2022-12-16 16:35:40 +01:00
Jef Roosens 0604de26c4
feat(agent): ensure images exist when starting build 2022-12-16 16:27:24 +01:00
Jef Roosens 489931eaa8
fix: don't buffer stdout even if not a terminal 2022-12-16 11:37:51 +01:00
Jef Roosens 1ce7b9d571
feat: add option to specify subdirectory in repo to use 2022-12-16 11:21:28 +01:00
Jef Roosens a48358fd75 fix: don't run prepare step twice in builds 2022-12-15 23:47:41 +01:00
Jef Roosens dbbe5c1e51
fix(agent): remove infinite loop and account for externally removed
images
2022-12-15 12:09:43 +01:00
Jef Roosens b634775ca3
refactor(server): clean up server responses a bit 2022-12-15 10:46:58 +01:00
Jef Roosens 0727d0fd25
refactor(client): streamline code & improve error propagation 2022-12-15 10:01:45 +01:00
Jef Roosens 0bd5158608
feat(client): handle empty and non-successful responses 2022-12-15 09:46:48 +01:00
Jef Roosens bfe1aafcf1 Merge pull request 'Polling-based agent-server architecture' (#301) from Chewing_Bever/vieter:agent-server-polling into dev
Reviewed-on: vieter-v/vieter#301
2022-12-14 17:34:48 +01:00
Jef Roosens 60cb91c18c
chore: final read before merging 2022-12-14 17:23:51 +01:00
Jef Roosens 51df1874f5
agent: some better logging 2022-12-14 16:33:50 +01:00
Jef Roosens d7a04c6ebf
chore: please the great lint 2022-12-14 16:03:57 +01:00
Jef Roosens 2cc3e8404e
feat: queue one-time builds from CLI 2022-12-13 23:31:47 +01:00
Jef Roosens 6a208dbe6c
feat: allow queueing one-time builds 2022-12-13 21:22:22 +01:00
Jef Roosens f6c5e7c246
feat: add option to force-build package 2022-12-13 19:59:18 +01:00
Jef Roosens 8a2f720bdf
docs(agent): added agent configuration docs 2022-12-13 19:33:21 +01:00
Jef Roosens d3151863ee
refactor(build): remove some code duplication from queue 2022-12-13 18:24:21 +01:00
Jef Roosens 03f2240ff6
chore: please the linter 2022-12-13 17:51:42 +01:00
Jef Roosens 5cbfc0ebcb
feat(agent): clean up code a bit; add frequent polling when active 2022-12-13 17:42:49 +01:00
Jef Roosens 6342789921
feat(server): update job queue when adding, removing or updating targets 2022-12-13 13:58:51 +01:00
Jef Roosens e742d3de6d
fix(db): return correct id when adding targets 2022-12-13 13:46:07 +01:00
Jef Roosens b6168a3060
fix(build): change tests to use BuildConfig instead 2022-12-13 12:38:39 +01:00
Jef Roosens 882a9a60a9
feat(build): allowed invalidating entries in build queue 2022-12-13 08:58:27 +01:00
Jef Roosens 3611123f45
feat(agent): initial working version 2022-12-13 08:37:30 +01:00
Jef Roosens 6f23d690a7
feat(agent): partially wrote daemon code 2022-12-13 08:37:30 +01:00
Jef Roosens 7ef8d4b846
feat(agent): wrote ImageManager 2022-12-13 08:37:30 +01:00
Jef Roosens 5bab1f77f0
feat(agent): begin reforming for new api 2022-12-13 08:37:30 +01:00
Jef Roosens 0a5c4295e0
feat(server): properly reschedule jobs after polling 2022-12-13 08:37:29 +01:00
Jef Roosens c57de4d8ee
feat(server): initialize job queue on start; api endpoint for polling
jobs
2022-12-13 08:37:29 +01:00
Jef Roosens 9a49d96e20
feat(build): start of server-side job queue 2022-12-13 08:37:29 +01:00
Jef Roosens 6281ef7607
feat: start of agent code 2022-12-06 13:50:25 +01:00
Jef Roosens 9e11237ff9 Merge pull request 'refactoring for fun' (#275) from Chewing_Bever/vieter:refactor-zen into dev
Reviewed-on: vieter-v/vieter#275
2022-11-19 17:12:34 +01:00
Jef Roosens 71c77e90bc
refactor(cron): expression parser now uses bitfields (closes #148) 2022-11-19 17:03:45 +01:00
Jef Roosens 54f40b7638
chore(repo): added readme 2022-11-19 17:01:40 +01:00
Jef Roosens 9493796160
refactor(package): split module into two files 2022-11-19 17:01:40 +01:00
Jef Roosens 3636dd92db Merge pull request 'Some small bug fixes' (#296) from Chewing_Bever/vieter:289-fix into dev
Reviewed-on: vieter-v/vieter#296
2022-11-07 21:56:43 +01:00
Jef Roosens 17e58c91ed chore: updated changelog; ran formatter 2022-11-07 21:40:59 +01:00
Jef Roosens fc4dc30f74 fix(api): always return JSON response on success (fixes #276) 2022-11-07 21:35:49 +01:00
Jef Roosens 5542be0418 fix(api): set arch if not provided or empty (fixes #278) 2022-11-07 21:13:40 +01:00
Jef Roosens 9a552f5302 fix(server): remove NOT NULL constraint on branch (fixes #289) 2022-11-07 21:11:10 +01:00
Jef Roosens aff6dff06a Merge pull request 'Update to V 0.3.2' (#282) from Chewing_Bever/vieter:v-0.3.2 into dev
Reviewed-on: vieter-v/vieter#282
2022-11-02 18:59:48 +01:00
Jef Roosens 3095daed7d
chore: update dockerfile & changelog 2022-11-02 18:43:20 +01:00
Jef Roosens cc9dcb3058
fix(ci): install dependencies when linting 2022-11-02 18:30:59 +01:00
Jef Roosens 96a9798d3f
refactor: updated tests to new syntax 2022-11-01 22:30:48 +01:00
Jef Roosens 161341a108
fix: still use openssl 2022-11-01 22:07:14 +01:00
Jef Roosens a2fda0d4b7
refactor: compile without warnings 2022-11-01 21:59:18 +01:00
Jef Roosens 23632be7a4
refactor: use relocated module names 2022-11-01 21:43:25 +01:00
Jef Roosens 22fd6e395b
refactor: compile on V 0.3.2 2022-11-01 21:11:31 +01:00
Jef Roosens ed29102717
chore(ci): update to V 0.3.2 image 2022-11-01 20:54:06 +01:00
Jef Roosens ae29fe5ef8 Merge pull request 'Release 0.4.0' (#274) from release-0.4.0 into main
Reviewed-on: vieter-v/vieter#274
2022-10-01 17:16:27 +02:00
Jef Roosens 66928216e5
chore: bumped versions to 0.4.0 2022-10-01 17:04:56 +02:00
Jef Roosens 7ef7dcd725 Merge pull request 'Some small fixes' (#273) from Chewing_Bever/vieter:explicitely-empty-values into dev
Reviewed-on: vieter-v/vieter#273
2022-10-01 16:56:25 +02:00
Jef Roosens e9fdbc9426
chore: removed duplicate changelog entries [CI SKIP] 2022-10-01 16:54:33 +02:00
Jef Roosens 15c2d72743
docs: updated json response types for create routes [CI SKIP] 2022-10-01 16:53:16 +02:00
Jef Roosens f34eefd59b
fix(server): prevent `api` as a repository name 2022-10-01 16:38:38 +02:00
Jef Roosens ae98c3e717
feat(server): repo POST requests now return information 2022-10-01 16:38:38 +02:00
Jef Roosens 559ef3e505
feat: logs api now also returns id 2022-10-01 16:38:36 +02:00
Jef Roosens 847d77b2bc
chore(ci): refactor ci configs a bit 2022-10-01 16:38:10 +02:00
Jef Roosens 95d32e2d51
fix(server): prevent `api` as a repository name 2022-10-01 16:38:09 +02:00
Jef Roosens 575c04189d
fix(client): allow empty values as params 2022-10-01 16:37:52 +02:00
Jef Roosens 39e2d12827 Merge pull request 'improved API & CLI UX' (#271) from Chewing_Bever/vieter:api-client-ux into dev
Reviewed-on: vieter-v/vieter#271
2022-10-01 16:30:05 +02:00
Jef Roosens 851a446a95
chore: updated changelog [CI SKIP] 2022-10-01 16:21:49 +02:00
Jef Roosens fab8ca20b8
cli: targets add now supports raw flag 2022-10-01 16:05:27 +02:00
Jef Roosens 8a08788935
feat(console): tabled outputs now optionally return without decorations 2022-09-11 21:50:29 +02:00
Jef Roosens cf67b46df0
feat(server): less verbose repo DELETE responses 2022-09-11 21:28:37 +02:00
Jef Roosens b6cd2f0bc2
feat(server): repo POST requests now return information 2022-09-11 21:24:29 +02:00
Jef Roosens 210508f1ee
feat: logs api now also returns id 2022-09-11 20:50:23 +02:00
Jef Roosens 7b59277931
feat: adding target returns id of added entry 2022-09-05 10:13:50 +02:00
Jef Roosens 3e0a2584fa Merge pull request 'Rework of web framework' (#266) from Chewing_Bever/vieter:web-rework into dev
Reviewed-on: vieter-v/vieter#266
2022-09-04 22:29:41 +02:00
Jef Roosens 9dfdfbf724
chore: update README [CI SKIP] 2022-09-04 20:16:58 +02:00
Jef Roosens 272f14b264
refactor(server): migrated all routes to new auth system 2022-09-04 19:36:08 +02:00
Jef Roosens 4887af26d3
feat(web): added authentication as function attribute 2022-09-04 19:32:22 +02:00
Jef Roosens 9268ef0302
refactor(web): some small cleanup 2022-09-01 09:17:39 +02:00
Jef Roosens e23635a1d3
refactor: moved response module to web.response 2022-08-13 13:16:31 +02:00
Jef Roosens cc5df95a1a
feat(web): file() now supports HTTP byte range 2022-08-12 17:11:44 +02:00
Jef Roosens e7b45bf251
feat(web): file() now handles HEAD requests 2022-08-12 15:08:05 +02:00
Jef Roosens 3a73ea0632
refactor(web): simplified web framework in general 2022-08-12 14:39:42 +02:00
Jef Roosens 78b0918df7 Merge pull request 'Delete packages, arch-repos & repos' (#265) from Chewing_Bever/vieter:repo-delete-routes into dev
Reviewed-on: vieter-v/vieter#265
2022-08-11 19:53:20 +02:00
Jef Roosens 50918da672
docs: fixed some typos 2022-08-11 19:47:26 +02:00
Jef Roosens ba3b00572b
chore: updated changelog [CI SKIP] 2022-08-11 19:44:22 +02:00
Jef Roosens 68b7e5e71e
feat(server): added routes for removing arch-repo & repo 2022-08-11 19:29:40 +02:00
Jef Roosens 6283cbea9c
feat(repo): added function to remove arch-repo 2022-08-11 19:16:38 +02:00
Jef Roosens 49ddb312de
feat(server): added endpoint to remove package from arch-repo 2022-08-11 19:07:54 +02:00
Jef Roosens 8a2b121cc7 Merge pull request 'AUR tools' (#263) from Chewing_Bever/vieter:aur-tools into dev
Reviewed-on: vieter-v/vieter#263
2022-07-17 13:53:49 +02:00
Jef Roosens 0f6630b940
chore: updated PKGBUILDs to use vlang package 2022-07-17 13:38:46 +02:00
Jef Roosens 0d0fb323f2
chore: switched to vlang 0.3 Docker image 2022-07-03 14:11:29 +02:00
Jef Roosens 1a940f2f98
feat(cli): added "aur add" command 2022-06-24 20:30:09 +02:00
Jef Roosens 487b235727
feat(cli): add aur search command 2022-06-24 20:30:06 +02:00
Jef Roosens 1b7cabdd74 Merge pull request 'Update to newest V version' (#260) from Chewing_Bever/vieter:v-update into dev
Reviewed-on: vieter-v/vieter#260
2022-06-22 21:00:34 +02:00
Jef Roosens 6336d801d3
docs: mention AUR packages 2022-06-22 20:43:14 +02:00
Jef Roosens 25d87fb5e6
fix: make code compile with updated V version 2022-06-22 20:17:11 +02:00
Jef Roosens af4fbc4ccc Merge pull request 'Split docker, rename org & modules' (#259) from Chewing_Bever/vieter:split-docker into dev
Reviewed-on: vieter-v/vieter#259
2022-06-22 10:25:45 +02:00
Jef Roosens c8fc4c6a96
fix(ci): set VMODULES for tests 2022-06-22 09:59:44 +02:00
Jef Roosens 9dd9222a69
fix(ci): use extended hugo; install modules for tests 2022-06-22 09:44:25 +02:00
Jef Roosens a4c2508fe7
chore: removed unnecessary things from Makefile 2022-06-22 09:33:48 +02:00
Jef Roosens e58ac49680
chore: hopefully changed all URLs to new org 2022-06-22 09:31:09 +02:00
Jef Roosens 461f227169
refactor: use new module names 2022-06-22 09:31:08 +02:00
Jef Roosens d060366dcb
refactor: move docker code to external vdocker module 2022-06-22 09:31:08 +02:00
Jef Roosens 39eb03077e
docs: mention matrix room in README [CI SKIP] 2022-06-20 17:31:05 +02:00
Jef Roosens 1ac76ac452 Merge pull request 'fix(build): explicitely set PATH variable in build containers' (#257) from Chewing_Bever/vieter:better-path-var into dev
Reviewed-on: vieter/vieter#257
2022-06-17 20:31:06 +02:00
Jef Roosens 4200f5c8de
fix(build): explicitely set PATH variable in build containers 2022-06-17 20:19:15 +02:00
Jef Roosens 424b0651e9 Merge pull request 'Add direct PKGBUILD link as target option' (#254) from Chewing_Bever/vieter:direct-pkgbuild-target into dev
Reviewed-on: vieter/vieter#254
2022-06-17 16:44:52 +02:00
Jef Roosens 5e11a91f3d
refactor: renamed cron & build code to use "target" naming 2022-06-17 16:24:12 +02:00
Jef Roosens 449656eb97
docs: updated to new 'kind' field 2022-06-17 14:52:59 +02:00
Jef Roosens 8f91c1fde5
feat(build): added support for 'url' kind 2022-06-17 14:31:34 +02:00
Jef Roosens bd07964509
feat(api): prevent invalid kind values 2022-06-17 13:56:38 +02:00
Jef Roosens bb5643bb03
feat: added ability to specify kind of target 2022-06-17 13:45:21 +02:00
Jef Roosens 10ad8297fb Merge pull request 'Stop calculating MD5 hashes' (#247) from Chewing_Bever/vieter:no-md5 into dev
Reviewed-on: vieter/vieter#247
2022-06-16 22:51:46 +02:00
Jef Roosens a8d647cca3
fix(docs): use versioned endpoints in HTTP API docs 2022-06-16 22:38:42 +02:00
Jef Roosens 1b7c14e7dc
feat(server): no longer calculate md5 hashes for packages 2022-06-16 22:36:11 +02:00
Jef Roosens f81039d2bb Merge pull request 'Some breaking API changes' (#245) from Chewing_Bever/vieter:api-changes into dev
Reviewed-on: vieter/vieter#245
2022-06-16 18:17:53 +02:00
Jef Roosens 3d38df6d03
fix(client): use new "target" name for param 2022-06-16 18:10:25 +02:00
Jef Roosens cf94b64400
docs: forgot some renames 2022-06-16 17:57:29 +02:00
Jef Roosens fcdcf9c5ca
feat(server): add config option for server port 2022-06-16 16:56:58 +02:00
Jef Roosens 9727b86203
docs(api): updated to new "targets" naming 2022-06-16 16:56:58 +02:00
Jef Roosens 102a7f8899
refactor: renamed codebase to "targets" 2022-06-16 16:56:58 +02:00
Jef Roosens faec08f846
refactor(console): renamed stuff to 'targets' 2022-06-16 16:56:58 +02:00
Jef Roosens 4d581da7bf
refactor: renamed api routes & client code to 'targets' 2022-06-16 16:56:58 +02:00
Jef Roosens 6b79f7b5ed
feat(server): moved api routes under /v1 namespace 2022-06-16 16:56:55 +02:00
Jef Roosens 3a5ac5d32b Merge pull request 'fix: added VIETER_ prefix to vconf.load calls' (#248) from Chewing_Bever/vieter:fix into dev
Reviewed-on: vieter/vieter#248
2022-06-15 23:02:34 +02:00
Jef Roosens 339267e6b2
fix: added VIETER_ prefix to vconf.load calls 2022-06-15 22:54:27 +02:00
Jef Roosens 233dd20345
fix(ci): also install modules when building on dev 2022-06-15 19:59:48 +02:00
Jef Roosens ae04fe63a7 Merge pull request 'Migrated env module to own Git repository' (#244) from Chewing_Bever/vieter:split-env into dev
Reviewed-on: vieter/vieter#244
2022-06-15 19:57:43 +02:00
Jef Roosens 592241c743
chore: updated CI config & PKGBUILDs to new module split 2022-06-15 18:17:00 +02:00
Jef Roosens 44696fc11b
refactor: migrated env code to own external module 2022-06-15 13:20:29 +02:00
Jef Roosens 4866cfa635 Merge pull request 'Release 0.3.0' (#241) from release-0.3.0 into main
Reviewed-on: vieter/vieter#241
2022-06-13 21:47:36 +02:00
Jef Roosens 12805d713c
chore: bumped versions to 0.3.0 2022-06-13 21:32:35 +02:00
Jef Roosens 03df62bbc4 Merge pull request 'Release 0.3.0-rc.1' (#236) from release-0.3.0-rc.1 into main
Reviewed-on: vieter/vieter#236
2022-06-10 15:21:55 +02:00
Jef Roosens ec128539d2
chore: bumped version to 0.3.0-rc.1 2022-06-10 15:09:55 +02:00
Jef Roosens 9dc8db4d54 Merge pull request 'Some small fixes' (#234) from Chewing_Bever/vieter:fixes into dev
Reviewed-on: vieter/vieter#234
2022-06-10 14:55:13 +02:00
Jef Roosens 0855d9efd8
fix(console): removed unimplemented -arch flag 2022-06-10 08:40:28 +02:00
Jef Roosens f4b2109533
fix(ci): release checksum files should now use correct paths 2022-06-10 08:39:10 +02:00
Jef Roosens 440d1753da Merge pull request 'Rework of Documentation' (#233) from Chewing_Bever/vieter:docs-rework into dev
Reviewed-on: vieter/vieter#233
2022-06-09 22:56:07 +02:00
Jef Roosens ddccceb336
docs: removed another old file & read over some parts 2022-06-09 21:54:14 +02:00
Jef Roosens c15f4a482f
docs: added in-depth build explanation 2022-06-09 21:54:13 +02:00
Jef Roosens c341d7a024
docs: some changed; removed some old files 2022-06-09 21:54:13 +02:00
Jef Roosens a9ddfd8ec8
docs: too many changes to count 2022-06-09 21:54:13 +02:00
Jef Roosens 0ab39a334d
docs: started new builds usage page 2022-06-09 21:54:13 +02:00
Jef Roosens d7d77afe09
docs: wrote part of new usage section 2022-06-09 21:54:13 +02:00
Jef Roosens 4ecf6a11c4
docs: rewrote installation page 2022-06-09 21:54:13 +02:00
Jef Roosens 5df5850044 Merge pull request 'refactor: migrated to Response.body' (#229) from Chewing_Bever/vieter:dev into dev
Reviewed-on: vieter/vieter#229
2022-06-05 22:47:21 +02:00
Jef Roosens 95441bdea0
refactor: migrated to Response.body 2022-06-05 22:21:54 +02:00
Jef Roosens aea83c38ef Merge pull request 'Slate docs: build logs' (#224) from Chewing_Bever/vieter:slate-docs into dev
Reviewed-on: vieter/vieter#224
2022-06-04 14:49:56 +02:00
Jef Roosens fc6d3909d2
docs(slate): add build logs API documentation 2022-06-04 12:18:30 +02:00
Jef Roosens e734e658a0
fix(server): publish build log now uses epoch value for dates 2022-06-04 12:11:51 +02:00
Jef Roosens 7ad5830e9f
fix(ci): correct cd during docs build 2022-06-03 22:40:29 +02:00
Jef Roosens 7c2f892162 Merge pull request 'First part of Slate API docs' (#221) from Chewing_Bever/vieter:slate-docs into dev
Reviewed-on: vieter/vieter#221
2022-06-03 22:35:19 +02:00
Jef Roosens 4870edde51
docs(slate): add Git Repositories API docs 2022-06-03 22:20:18 +02:00
Jef Roosens a02b70e9a5
ci: added steps to build & deploy slate docs 2022-06-03 17:32:32 +02:00
Jef Roosens 1d034e670e
docs: started HTTP documentation using slate 2022-06-03 17:13:17 +02:00
Jef Roosens 2abbc11118
fix(arch): also blank LDFLAGS for debug build 2022-06-02 20:21:20 +02:00
Jef Roosens 0e8e7223ab
fix(arch): properly install man pages 2022-06-02 20:14:44 +02:00
Jef Roosens f9a6d585dd
fix(arch): use correct path for pvieter binary 2022-06-02 19:12:38 +02:00
Jef Roosens ae50e29597 Merge pull request 'Proper man pages' (#218) from Chewing_Bever/vieter:man-pages into dev
Reviewed-on: vieter/vieter#218
2022-06-02 18:57:01 +02:00
Jef Roosens e5582a2d54
ci: deploy man pages to website 2022-06-02 17:26:03 +02:00
Jef Roosens 329e819e15
feat(console): added command to generate man pages 2022-06-02 16:36:18 +02:00
Jef Roosens 06df2c21f0 Merge pull request 'Repo in build & other build improvements' (#186) from Chewing_Bever/vieter:repo-in-builds into dev
Reviewed-on: vieter/vieter#186
2022-06-01 20:49:47 +02:00
Jef Roosens 48e2ae7645
feat(build): show shell commands in build logs 2022-06-01 20:34:36 +02:00
Jef Roosens 9f753f9c93
feat(build): add target repo to builds; update system for every build 2022-06-01 17:08:18 +02:00
Jef Roosens ec92b16a73 Merge pull request 'Use local timezone with CLI' (#210) from Chewing_Bever/vieter:utc-only into dev
Reviewed-on: vieter/vieter#210
2022-05-31 12:55:16 +02:00
Jef Roosens aded6d438a
feat(cli): use correct timezones strings for log info; show build
duration
2022-05-31 12:46:39 +02:00
Jef Roosens edd71b41c2
feat(cli): interpet input dates & print dates as local timezone 2022-05-31 12:31:44 +02:00
Jef Roosens f0565c4168 Merge pull request 'Better API: BuildLog API & CLI' (#206) from Chewing_Bever/vieter:better-api into dev
Reviewed-on: vieter/vieter#206
2022-05-30 23:40:58 +02:00
Jef Roosens a4ffc2c0e3
feat(cli): added more advanced date flags for BuildLog CLI 2022-05-30 23:27:09 +02:00
Jef Roosens 401e0291e3
feat(cli): added some filter flags to GitRepo CLI 2022-05-29 21:59:21 +02:00
Jef Roosens a39c1aa5eb
feat(server): added proper filtering the BuildLog API 2022-05-29 20:15:54 +02:00
Jef Roosens 4f32dec5b5
feat(db): added function to convert sqlite output to struct 2022-05-29 20:15:54 +02:00
Jef Roosens 31e903ebeb
feat(server): partial implementation of BuildLog API filter 2022-05-29 20:15:54 +02:00
Jef Roosens 596da100b6 Merge pull request 'migrations' (#196) from Chewing_Bever/vieter:migrations into dev
Reviewed-on: vieter/vieter#196
2022-05-28 19:51:40 +02:00
Jef Roosens 0d5704ba15
feat(server): initial implementation of migrations 2022-05-28 19:49:49 +02:00
Jef Roosens cdb88e1620 Merge pull request 'Add vieter schedule command' (#201) from Chewing_Bever/vieter:schedule-cli into dev
Reviewed-on: vieter/vieter#201
2022-05-26 13:50:11 +02:00
Jef Roosens 768da5b790
refactor: added CronExpression.next_n function 2022-05-26 13:41:28 +02:00
Jef Roosens bd4bb9a9fb
feat: added cli command for previewing cron schedules 2022-05-26 09:15:49 +02:00
Jef Roosens c0b739035b Merge pull request 'fix(cron): retrieve all GitRepo's instead of first 25' (#198) from Chewing_Bever/vieter:cron-25-bug into dev
Reviewed-on: vieter/vieter#198
2022-05-25 09:36:08 +02:00
Jef Roosens 7f6e9e636c
fix(cron): retrieve all GitRepo's instead of first 25 2022-05-25 09:24:01 +02:00
Jef Roosens 96d0c2f1eb Merge pull request 'Better API & CLI: GitRepo' (#188) from Chewing_Bever/vieter:better-api into dev
Reviewed-on: vieter/vieter#188
2022-05-19 22:26:47 +02:00
Jef Roosens 0233b8559d
doc: added some missing docstrings 2022-05-19 22:14:41 +02:00
Jef Roosens 2fc25f1afe
refactor: moved BuildLog to models 2022-05-19 22:11:48 +02:00
Jef Roosens 6bd5b7cb48
refactor: separated GitRepo types into own module
feat: added more query params for GitRepo API
2022-05-19 22:11:48 +02:00
Jef Roosens 5e81dadce3
feat: partially added filters to GitRepo CLI 2022-05-19 22:11:35 +02:00
Jef Roosens 1e079143cd
feat(server): added better query params to GitRepo API 2022-05-18 16:05:42 +02:00
Jef Roosens 7627b28bcf Merge pull request 'Release 0.3.0-alpha.2' (#185) from release-0.3.0-alpha.2 into main
Reviewed-on: vieter/vieter#185
2022-05-18 07:56:03 +02:00
Jef Roosens 0de5ffb45d
chore: bumped versions 2022-05-16 17:34:51 +02:00
Jef Roosens 29e6d8d071 Merge pull request 'Add `vieter repos build` command; remove healthcheck' (#184) from Chewing_Bever/vieter:repos-build into dev
Reviewed-on: vieter/vieter#184
2022-05-16 17:29:28 +02:00
Jef Roosens 67c4d19921
chore: removed healthcheck & unused cron stuff from Dockerfile 2022-05-16 17:17:42 +02:00
Jef Roosens 73d2d4b08f
feat(console): replaced `vieter build` with `vieter repos build` 2022-05-16 17:12:37 +02:00
Jef Roosens 92f73ad364 Merge pull request 'Full Docker code refactor' (#183) from Chewing_Bever/vieter:docker-rework into dev
Reviewed-on: vieter/vieter#183
2022-05-16 15:44:35 +02:00
Jef Roosens 889d5a0884
refactor(docker): removed unused function 2022-05-16 15:39:23 +02:00
Jef Roosens 3c87e60293
refactor(docker): more tightly integrate streams 2022-05-16 15:36:21 +02:00
Jef Roosens 850cba6ab9
refactor(docker): use http.Method instead of strings 2022-05-16 15:02:57 +02:00
Jef Roosens d4c803c41c
doc(env): added missing docstring & README 2022-05-16 14:53:48 +02:00
Jef Roosens 055b168ff1
refactor(util): split into two files 2022-05-16 14:36:31 +02:00
Jef Roosens 1d3c7a1651
refactor(docker): renamed DockerDaemon to DockerConn 2022-05-16 14:09:21 +02:00
Jef Roosens 97cdaa18e1
refactor(docker): split stream separator code into own function 2022-05-16 13:03:44 +02:00
Jef Roosens ce67208fbd
refactor(docker): remove old code 2022-05-15 10:01:12 +02:00
Jef Roosens e041682fea
feat(docker): fully migrate build commands to new code 2022-05-15 09:56:23 +02:00
Jef Roosens 79fd9c1f87
fix(docker): read_response now handles chunked data 2022-05-15 09:23:35 +02:00
Jef Roosens 1811ebbe3f
doc: documented new Docker code 2022-05-15 09:23:35 +02:00
Jef Roosens f22ed29631
feat(docker): added StreamFormatReader 2022-05-15 09:23:35 +02:00
Jef Roosens 92cbea69d6
feat(docker): added ChunkedResponseReader implementation 2022-05-15 09:23:34 +02:00
Jef Roosens da46b8b4ae
feat(docker): error when HTTP requests fail 2022-05-15 09:23:34 +02:00
Jef Roosens 4c97489f8a
feat(docker): partially migrate to new code 2022-05-15 09:23:21 +02:00
Jef Roosens dd9958ea28
refactor: ran vfmt with new defaults
feat(docker): started work on new implementation
2022-05-15 09:23:21 +02:00
Jef Roosens 473c7ec06b
feat(docker): start of new socket implementation 2022-05-15 09:23:13 +02:00
Jef Roosens c01d849b9e Merge pull request 'feat(cli): lists are now properly formatted in an ascii table' (#181) from Chewing_Bever/vieter:pretty-cli into dev
Reviewed-on: vieter/vieter#181
2022-05-14 20:14:56 +02:00
Jef Roosens 5c5c2f87e0
feat(cli): lists are now properly formatted in an ascii table 2022-05-14 20:11:29 +02:00
Jef Roosens b91d7b3159 Merge pull request 'Apply new vfmt defaults' (#180) from Chewing_Bever/vieter:new-vfmt-defaults into dev
Reviewed-on: vieter/vieter#180
2022-05-14 20:09:03 +02:00
Jef Roosens 5f21e256ee
refactor: apply new vfmt defaults 2022-05-14 20:06:08 +02:00
Jef Roosens 53f5b68d08 Merge pull request 'Split Arch packages into git & release version' (#175) from Chewing_Bever/vieter:some-small-issues into dev
Reviewed-on: vieter/vieter#175
2022-05-11 22:03:01 +02:00
Jef Roosens 06bab98a88
chore: update README 2022-05-11 08:05:24 +02:00
Jef Roosens ad207bdb70
feat(ci): split Arch releases into vieter & vieter-git 2022-05-11 08:05:24 +02:00
Jef Roosens c018aad143
chore: updated CHANGELOG 2022-05-10 13:43:09 +02:00
LordMZTE 0bac221aee fix: don't pass --nodeps to initial build step (#173)
This fixes packages that require their dependencies in `pkgver` or
`prepare` failing to build.

Reviewed-on: vieter/vieter#173
Co-authored-by: LordMZTE <lord@mzte.de>
Co-committed-by: LordMZTE <lord@mzte.de>
2022-05-10 13:36:07 +02:00
Jef Roosens 78fc3afcd3
feat(ci): also publish dev images as specific commit hash 2022-05-09 15:16:30 +02:00
Jef Roosens cae44fb593 Merge pull request 'integrate build logs API into build command & cron' (#171) from Chewing_Bever/vieter:build-logs into dev
Reviewed-on: vieter/vieter#171
2022-05-09 15:08:59 +02:00
Jef Roosens 3821ed29fd
refactor(docker): simplified loop expression 2022-05-09 15:05:53 +02:00
Jef Roosens 5a5f7f8346
refactor(docker): use builtin parse_rfc3339 function 2022-05-09 14:58:20 +02:00
Jef Roosens ea4c4fce16
feat(cron): upload logs after build 2022-05-09 08:51:10 +02:00
Jef Roosens e79d18100f
chore: ran `make fmt` 2022-05-09 08:51:10 +02:00
Jef Roosens 4b172cb5d8
feat(cli): `vieter build` now builds a single repo & uploads build logs 2022-05-09 08:51:10 +02:00
Jef Roosens 27aa215eff
feat(docker): added function to retrieve container logs 2022-05-09 08:51:10 +02:00
Jef Roosens 7e5f0c5a53 Merge pull request 'Build logs API & CLI + refactoring' (#169) from Chewing_Bever/vieter:build-logs into dev
Reviewed-on: vieter/vieter#169
2022-05-07 23:55:56 +02:00
Jef Roosens 30cce4fa72
chore: updated changelog 2022-05-07 22:13:35 +02:00
Jef Roosens 5f7d7c4780
doc: added documentation to all functions 2022-05-07 22:06:17 +02:00
Jef Roosens 5b016df85d
feat(cli): added commands for interacting with build logs 2022-05-07 21:50:20 +02:00
Jef Roosens fa6603bd45
feat(client): added client code for logs API 2022-05-07 19:38:28 +02:00
Jef Roosens 407b226955
refactor: moved client code into own module 2022-05-07 16:10:27 +02:00
Jef Roosens f42d3fd8b0
fix(server): prevent adding logs to non-existent repo 2022-05-07 15:44:59 +02:00
Jef Roosens 139142fcec
feat(server): added endpoint for content of build log 2022-05-07 15:41:49 +02:00
Jef Roosens 393e641a76
feat(server): allow filtering of builds per repo 2022-05-07 15:31:01 +02:00
Jef Roosens 7e01dbafec
feat(server): added endpoints for listing & uploading build logs 2022-05-07 15:10:07 +02:00
Jef Roosens 58c1ecd25e
db: added BuildLog & required methods 2022-05-07 14:16:30 +02:00
Jef Roosens 230920576d Merge pull request 'Release 0.3.0-alpha.1' (#164) from release-0.3.0-alpha.1 into main
Reviewed-on: vieter/vieter#164
2022-05-06 20:12:51 +02:00
Jef Roosens 356a34ab01
chore: bumped versions 2022-05-06 20:04:48 +02:00
Jef Roosens 1156e896f7 Merge pull request 'cron: filter out repos with wrong architecture' (#163) from Chewing_Bever/vieter:cron-check-arch into dev
Reviewed-on: vieter/vieter#163
2022-05-06 09:00:53 +02:00
Jef Roosens a3b6680153
cron: filter out repos with wrong architecture 2022-05-06 08:31:59 +02:00
Jef Roosens 7fdbcdf3e7
ci(arch): also change URL of downloaded PKGBUILD 2022-05-05 23:38:12 +02:00
Jef Roosens d4306133e0 Merge pull request 'Fix PKGBUILD' (#161) from Chewing_Bever/vieter:pkgbuild-fixes into dev
Reviewed-on: vieter/vieter#161
2022-05-05 23:36:42 +02:00
Jef Roosens 1990ade089
ci: fixed some steps running when not required 2022-05-05 23:30:54 +02:00
Jef Roosens e008133981
ci(arch): changed PKGBUILD to new URL 2022-05-05 23:29:08 +02:00
Jef Roosens 1a076a7a8c Merge pull request 'Sqlite backend & simplifying of config variables' (#158) from Chewing_Bever/vieter:sqlite-backend into dev
Reviewed-on: vieter/vieter#158
2022-05-05 23:18:43 +02:00
Jef Roosens 8c5652c230
ci: made build upload failable; updated ci for use with PRs 2022-05-05 23:11:18 +02:00
Jef Roosens b6d5bd3228
doc: listed new config variables in docs 2022-05-03 20:13:28 +02:00
Jef Roosens 5781796e99
doc: added docstrings to all db/git functions 2022-05-03 20:02:05 +02:00
Jef Roosens 204144cee8
refactor: removed commented code & ran formatter 2022-05-03 19:50:14 +02:00
Jef Roosens c818273790
feat: simplified config down to pkg_dir & data_dir
BREAKING: downloads are now stored inside the root of pkg_dir, the log
file is always stored in the root of data_dir
2022-05-03 19:50:14 +02:00
Jef Roosens 7419144f97
feat: removed git.GitRepo type
feat(cli): updated to new GitRepo format
2022-05-03 19:50:14 +02:00
Jef Roosens 0a2488a4df
feat(server): migrated repo patch to sqlite 2022-05-03 19:50:14 +02:00
Jef Roosens 891a206116
feat(server): partially migrated repos API to sqlite 2022-05-03 19:50:14 +02:00
Jef Roosens 03318586ed
feat(cron): added debug log on build_repo failure 2022-05-02 07:50:44 +02:00
Jef Roosens c5161cac37
chore: updated changelog [CI SKIP] 2022-05-01 15:25:21 +02:00
Jef Roosens 5cde3d0235
fix(cli): allow empty schedule to clear it 2022-05-01 14:51:52 +02:00
Jef Roosens 0b050a81db Merge pull request 'Repo CLI Improvements' (#146) from better-repos-cli into dev
Reviewed-on: Chewing_Bever/vieter#146
2022-05-01 13:17:21 +02:00
Jef Roosens d313c5b786
feat(cli): added command to show detailed repo info 2022-05-01 13:06:57 +02:00
Jef Roosens 92b8f1fb93
feat(cli): added management of cron schedules 2022-05-01 12:52:05 +02:00
Jef Roosens b1ac39e234
feat: made arch param optional when adding Git repo 2022-05-01 12:44:54 +02:00
Jef Roosens d9d7272b44 Merge pull request 'Move over documentation' (#143) from docs-move into dev
Reviewed-on: Chewing_Bever/vieter#143
2022-05-01 12:17:39 +02:00
Jef Roosens 1f1aa381e1
ci: corrected docs deploy step & re-enabled deploy workflow 2022-05-01 12:14:13 +02:00
Jef Roosens e5d50f3a59
ci(docs): build & deploy docs in CI 2022-05-01 12:14:13 +02:00
Jef Roosens 1dd810a605
docs: migrated over Hugo documentation 2022-05-01 12:14:13 +02:00
Jef Roosens 325dcc27de
fix(cron): made Daemon.run infallible 2022-05-01 09:15:17 +02:00
Jef Roosens 37c27ae84b
fix(ci): add -DGC_THREADS flag to prod build 2022-04-30 23:02:54 +02:00
Jef Roosens 60598f719c
fix(ci): only download PKGBUILD instead of cloning entire repo 2022-04-30 22:22:12 +02:00
Jef Roosens 4a47c7bbdc Merge pull request 'implementation of cron daemon' (#134) from cron into dev
Reviewed-on: Chewing_Bever/vieter#134
2022-04-30 21:05:05 +02:00
Jef Roosens cfacf9ed0f
fix(cron): don't show error for empty cron schedule 2022-04-30 20:58:43 +02:00
Jef Roosens f9f440500e
docs: added comment string to each function 2022-04-30 20:22:03 +02:00
Jef Roosens fb65efdfbe
feat(cron): added removal of old builder images 2022-04-30 18:38:24 +02:00
Jef Roosens 369b4458c5
feat(cron): added automatic rebuilding of image; implemented builds 2022-04-30 18:10:33 +02:00
Jef Roosens 98c0e52b08
chore(ci): added missdoc -p check; merged lint commands 2022-04-30 16:41:12 +02:00
Jef Roosens caee56efd4
feat(cron): improve sleep calculation; prevent invalid rescheduling of
finished builds
2022-04-30 16:08:35 +02:00
Jef Roosens a1c308f29d
feature(daemon): added api renewal & calculated sleep time 2022-04-30 14:19:08 +02:00
Jef Roosens 11ac3c0470
docs: added docs command & notice in README 2022-04-30 14:19:08 +02:00
Jef Roosens 5287067ea7
chore(ci): run builds sequentially 2022-04-30 14:19:08 +02:00
Jef Roosens 6f9e1b5f3c
feat(cron): start of working loop 2022-04-30 11:58:49 +02:00
Jef Roosens 4d26797453
chore(ci): Updated PKGBUILD to use vieter-v package 2022-04-30 11:58:49 +02:00
Jef Roosens 7722d5a7e4
fix: replace byte with u8
BREAKING: the V compiler removed the byte type alias in favor of u8.
2022-04-30 11:58:49 +02:00
Jef Roosens 20707f6af1
chore(ci): change debug build used
chore(ci): removed skip-unused-static experimental build

chore: updated Makefile
2022-04-30 11:58:49 +02:00
Jef Roosens 92ca5b8024
Merge branch 'dev' into cron 2022-04-15 11:13:04 +02:00
Jef Roosens 20112b8693
Switched to official compiler instead of fork 2022-04-15 10:59:05 +02:00
Jef Roosens cf77037188
Some more experimental builds 2022-04-14 23:17:52 +02:00
Jef Roosens cd8fd78616
Added experimental builds to CI 2022-04-14 23:15:19 +02:00
Jef Roosens c8fc683384
Eh don't feel like writing scheduler rn 2022-04-14 21:20:10 +02:00
Jef Roosens c8af362a4a
Workaround for weird bug 2022-04-14 20:38:14 +02:00
Jef Roosens 78b477fb92
Removed deprecated err.msg & err.code 2022-04-13 22:20:05 +02:00
Jef Roosens f7e1aba30b
Attempt at writing renew_queue function; seems to just stop in the
middle
2022-04-13 16:12:22 +02:00
Jef Roosens ff57d73998
Start of daemon (not working) [CI SKIP] 2022-04-13 15:24:55 +02:00
Jef Roosens 132a7a8ba5
Added int support to env; fixed apparently broken defaults 2022-04-13 14:51:01 +02:00
Jef Roosens 9a56bd03a7
Prevents tests from running on dev or main 2022-04-12 21:56:08 +02:00
Jef Roosens 05b34d3ffd Merge pull request 'cron expression parser' (#127) from cron into dev
Reviewed-on: Chewing_Bever/vieter#127
2022-04-12 21:37:03 +02:00
Jef Roosens bd0c276fd8
Added 'WIP' notice for cron cli 2022-04-12 21:28:44 +02:00
Jef Roosens 5ce431aa4a
Added two more test dates; pleased v vet 2022-04-12 21:23:38 +02:00
Jef Roosens 1116fee3fc
Actually possibly kinda decent cron next func 2022-04-12 21:16:09 +02:00
Jef Roosens e6033f9ab4
Ran vfmt 2022-04-12 20:53:20 +02:00
Jef Roosens eb65bb8a69
These bugs are gonna take a while 2022-04-12 14:22:40 +02:00
Jef Roosens cb22c1c9d3
Merge branch 'dev' into cron 2022-04-12 11:37:39 +02:00
Jef Roosens 5c38071998
Merge branch 'dev' into cron 2022-04-12 11:30:01 +02:00
Jef Roosens 65d6aae701
Made sure unix value is calculated 2022-04-12 11:10:49 +02:00
Jef Roosens 2942793f40
Added support for x-y syntax 2022-04-12 10:35:29 +02:00
Jef Roosens f4bb03f488
Tests n bug fixes 2022-04-12 09:48:25 +02:00
Jef Roosens 04e54b8b10
Migrated tests to new bitv-based implementation 2022-04-12 09:00:18 +02:00
Jef Roosens ab4f64b6b6
Failed attempt at x,y,z cron stuff [CI SKIP] 2022-04-11 22:52:06 +02:00
Jef Roosens 0e5f31e649
Added some much-needed documentation 2022-04-11 22:30:22 +02:00
Jef Roosens 135b6c3d7f
Alpha version cron 'next' function 2022-04-11 22:16:31 +02:00
Jef Roosens 18a18864e4 Merge pull request 'Configure Renovate' (#124) from renovate/configure into dev
Reviewed-on: Chewing_Bever/vieter#124
2022-04-11 13:10:15 +02:00
Renovate Bot 4a68cb3c03 Add renovate.json 2022-04-11 10:01:38 +00:00
Jef Roosens 4b6a661d71 Merge pull request 'Release 0.2.0' (#121) from release-0.2.0 into main
Reviewed-on: Chewing_Bever/vieter#121
2022-04-11 09:41:43 +02:00
Jef Roosens 3b15066329
Removed unnecessary log output 2022-04-11 09:36:40 +02:00
Jef Roosens e3da3d0d7f
Can't figure out cron algo right now [CI SKIP] 2022-04-10 17:48:15 +02:00
Jef Roosens 799fe2e454
Added some extra tests for parse_range 2022-04-10 16:58:55 +02:00
Jef Roosens f92a20fcf8
Gave all modules own directory; added test CI pipeline 2022-04-10 16:48:37 +02:00
Jef Roosens 6d60ea1538
Started writing cron expression parser [CI SKIP] 2022-04-10 16:17:50 +02:00
Jef Roosens 7e142cb6c7
Updated CHANGELOG [CI SKIP] 2022-04-09 22:41:38 +02:00
Jef Roosens 207344a99d
Merge branch 'main' into release-0.2.0 2022-04-09 22:17:19 +02:00
Jef Roosens aacadca7a8
Bumped version in cli 2022-04-09 22:13:21 +02:00
Jef Roosens ff9ff9bf99
Forgot trailing slash [CI SKIP] 2022-04-09 22:09:38 +02:00
Jef Roosens 2d01c5374b
Updated README (Closes #68) [CI SKIP] 2022-04-09 21:53:54 +02:00
Jef Roosens 8e7d3508d2 Merge pull request 'Old packages are now removed properly' (#120) from remove-old-packages into dev
Reviewed-on: Chewing_Bever/vieter#120
2022-04-09 21:20:54 +02:00
Jef Roosens 62bee78955
Updated changelog 2022-04-09 21:17:22 +02:00
Jef Roosens a65207f961
Solved the "removing old packages" problem (I think) 2022-04-09 21:08:54 +02:00
Jef Roosens cec5ecce7f
Each repo now has its own subdir in pkg_dir 2022-04-09 17:41:41 +02:00
Jef Roosens ebe01c2d44
Added route to request desc file; updated builder for new route (fixes #118) 2022-04-09 12:23:54 +02:00
Jef Roosens e890128bda
Ran formatter 2022-04-09 09:50:37 +02:00
Jef Roosens 41ee08045b Start of cron implementation 2022-04-09 09:46:07 +02:00
Jef Roosens 8b2900d7f3
Added option to specify base build image to use 2022-04-08 13:22:29 +02:00
Jef Roosens fb4710fc2a
Remove deploy step
Because of the bug that causes a panic, this CI run is also required to
properly deploy the newest vieter version for aarch64
2022-04-07 22:23:10 +02:00
Jef Roosens ffd83eeb18
Vieter releases are now also aarch64 2022-04-07 22:01:59 +02:00
Jef Roosens 0617c9b904
forgot to add part for creating filename 2022-04-07 22:00:38 +02:00
Jef Roosens 0a74f10052
This is to tickle the CI 2022-04-07 21:36:33 +02:00
Jef Roosens c3ac00f24d
Added support for xz-compressed packages 2022-04-07 21:29:08 +02:00
Jef Roosens 0bfe28dbc9
Added --noconfirm flag to pacman 2022-04-07 16:26:06 +02:00
Jef Roosens 690ca90b45
Maybe it needs some quotes? 2022-04-07 16:24:51 +02:00
Jef Roosens 8fd2b8c7ec
Switched arch build curl back to other image 2022-04-07 16:23:52 +02:00
Jef Roosens e074af64da Merge pull request 'multi-repo & multi-arch support' (#112) from multi-arch-repos-v2 into dev
Reviewed-on: Chewing_Bever/vieter#112
2022-04-07 16:14:08 +02:00
Jef Roosens 97f3532204
Ran vfmt 2022-04-07 16:11:05 +02:00
Jef Roosens 3b555efa91
Renamed data_dir to repos_dir 2022-04-07 15:21:27 +02:00
Jef Roosens a5ac0b6956
Fixed dumb mistake in repos cli 2022-04-07 15:12:48 +02:00
Jef Roosens c6d176f426
Added patch support to repos cli 2022-04-07 15:08:27 +02:00
Jef Roosens ab72c800c3
Ran vfmt 2022-04-07 14:50:07 +02:00
Jef Roosens d11ad78bff
Updated CI to use new system 2022-04-07 14:43:41 +02:00
Jef Roosens 8ecac2ff28
Updated build system to respect repo arch settings 2022-04-07 14:40:49 +02:00
Jef Roosens 7eab7afa98
Expanded git repos api to store repository to publish to 2022-04-07 14:28:21 +02:00
Jef Roosens 9d8491a77a
Changed behavior for default_arch variable 2022-04-07 13:47:06 +02:00
Jef Roosens 6479071fd7
Merge branch 'dev' into multi-arch-repos-v2 2022-04-07 13:06:37 +02:00
Jef Roosens 06167030bb Merge pull request 'Web rework & improved Git API' (#114) from restful-api into dev
Reviewed-on: Chewing_Bever/vieter#114
2022-04-07 12:26:49 +02:00
Jef Roosens 7895240e9b
Updatd CHANGELOG.md 2022-04-07 12:22:41 +02:00
Jef Roosens 78310fa1e4
Builder now uses new Git repos API 2022-04-07 12:10:37 +02:00
Jef Roosens fc1d4480dc
Split Git client code into separate module 2022-04-07 12:07:56 +02:00
Jef Roosens b31b4cbd7a
Pleased vfmt & vet 2022-04-07 11:58:05 +02:00
Jef Roosens 7eb0aa76e1
CLI tool can now work with new repo UUIDs 2022-04-07 11:54:20 +02:00
Jef Roosens a893577ade
Merge branch 'dev' into multi-arch-repos-v2 2022-04-06 23:11:41 +02:00
Jef Roosens f44ce1c17f
Started work on better repos cli 2022-04-06 22:41:19 +02:00
Jef Roosens d7f6c87053
Added some comments 2022-04-06 21:11:38 +02:00
Jef Roosens 6b495b4e6e
Merge branch 'dev' into restful-api 2022-04-06 21:03:52 +02:00
Jef Roosens 4c3f322e6f
Removed arm/v7 from docker release builds 2022-04-06 20:03:26 +02:00
Jef Roosens 94f96feb5d Merge pull request 'improve CLI experience; merge binaries' (#115) from merge-cli-server into dev
Reviewed-on: Chewing_Bever/vieter#115
2022-04-06 20:01:02 +02:00
Jef Roosens dff531d866
Some final adjustments before merge 2022-04-06 19:51:54 +02:00
Jef Roosens c656e672e2
Moved config structs to more logical location 2022-04-06 18:20:14 +02:00
Jef Roosens 2aa2aa143c
Switched to proper default values system 2022-04-06 18:17:33 +02:00
Jef Roosens b70be0574e
Small change to documentation 2022-04-06 18:02:57 +02:00
Jef Roosens 75dfc5267b
Made vet happy 2022-04-06 17:57:05 +02:00
Jef Roosens e9d7858380
env module now properly supports config file 2022-04-06 17:51:06 +02:00
Jef Roosens 21ef262ede
Migrated rest of cli commands 2022-04-06 17:16:27 +02:00
Jef Roosens 9dd02426ff
Removd armv7 from ci 2022-04-06 16:58:15 +02:00
Jef Roosens b90e6cf6b4
Updatd config files; ran formatter 2022-04-06 16:57:27 +02:00
Jef Roosens 5b919ceeae
Switched to cli module; merged cli & vieter into single binary 2022-04-06 16:52:31 +02:00
Jef Roosens 56517c0ff0
Removed arm/v7 from CI 2022-04-01 23:15:30 +02:00
Jef Roosens fe24774848
Added some docs 2022-04-01 21:50:00 +02:00
Jef Roosens 3a6effad80
Ran vfmt 2022-04-01 21:34:58 +02:00
Jef Roosens 148ec3ab47
Updated changelog 2022-04-01 21:33:55 +02:00
Jef Roosens e5a630e990
Switched to net.http.Status for status codes 2022-03-28 14:44:23 +02:00
Jef Roosens 0a6be87970
Start of web framework revamp 2022-03-28 14:24:26 +02:00
Jef Roosens 08821725f9
Added proper constraint for creating repo 2022-03-28 13:34:22 +02:00
Jef Roosens a4a71a2797
First part of RESTful API (not correct yet) [CI SKIP] 2022-03-28 10:19:57 +02:00
Jef Roosens 56cb23cc7e
Just some changes to poke CI 2022-03-27 23:33:33 +02:00
Jef Roosens 4139c50780
Small changes to Makefile 2022-03-27 23:30:38 +02:00
Jef Roosens aa632c7cd9
Switched to correct filenames 2022-03-27 20:26:58 +02:00
Jef Roosens 0dd4534e20
Added extra comments; made linter happy 2022-03-27 19:54:49 +02:00
Jef Roosens cb2ba86200
Updated logging for multi-repo setup 2022-03-27 18:22:30 +02:00
Jef Roosens 014ade5092
Updated routes for multi-repo setup (untested) 2022-03-27 17:00:11 +02:00
Jef Roosens a47cace296
Very alpha support for multiple & multi-arch repos 2022-03-27 16:33:06 +02:00
Jef Roosens 013ce511d7
Loosed up SRCINFO field requirements (fixes #111) 2022-03-27 15:10:45 +02:00
Jef Roosens 09d0a40aae Merge pull request 'Isolate builds, build when necessary' (#107) from build-system-upgrade into dev
Reviewed-on: Chewing_Bever/vieter#107
2022-02-25 22:08:02 +01:00
Jef Roosens 88e048fbe2
Updated deploy webhooks [CI SKIP] 2022-02-25 22:07:03 +01:00
Jef Roosens 4a4362c138
Fixed linting errors 2022-02-25 21:54:16 +01:00
Jef Roosens 732b53b6ce
Forgot to uncomment line 2022-02-25 21:50:07 +01:00
Jef Roosens a7cb08f93d
Containers now check whether package should be rebuilt 2022-02-25 21:47:28 +01:00
Jef Roosens 540574b3c3
Split builds into separate containers; made makepkg parallel 2022-02-25 20:52:30 +01:00
Jef Roosens 13a2ced6f9
Possible fix for CI arch build 2022-02-24 22:13:23 +01:00
Jef Roosens 6276fbe0d3
Added arch package descriptions 2022-02-24 22:06:14 +01:00
Jef Roosens 2cf0286413
This should fix the arch publish 2022-02-24 14:24:57 +01:00
Jef Roosens 9f87653877
Added makedepends to PKGBUILD 2022-02-24 14:18:25 +01:00
Jef Roosens d94b797556 Merge pull request 'cli tool to manage git repos' (#103) from repos-api into dev
Reviewed-on: Chewing_Bever/vieter#103
2022-02-24 14:15:32 +01:00
Jef Roosens aa25290f4f
Added CI step to publish dev arch packages 2022-02-24 14:04:29 +01:00
Jef Roosens 00804bf115
Fix for broken PKGBUILD 2022-02-24 14:00:40 +01:00
Jef Roosens d5c1366d65
Failed attempt at writing PKGBUILD [CI SKIP] 2022-02-22 20:46:28 +01:00
Jef Roosens 13e04cd615
Wrong filename in CI 2022-02-22 18:48:29 +01:00
Jef Roosens 098f89909d
Added cli to CI builds 2022-02-22 18:42:09 +01:00
Jef Roosens 07b069c686
Merge branch 'dev' into repos-api 2022-02-22 18:38:05 +01:00
Jef Roosens 730d201f33
Merge branch 'dev' into repos-api 2022-02-22 18:37:10 +01:00
Jef Roosens 6d3ff8ad08 Merge pull request 'Merge dockerfiles' (#102) from builder-fix into dev
Reviewed-on: Chewing_Bever/vieter#102
2022-02-22 18:08:43 +01:00
Jef Roosens f6b0e29552
Merged dockerfiles 2022-02-22 18:04:54 +01:00
Jef Roosens 9f46c27232
Very basic CLI to update repos 2022-02-22 10:11:18 +01:00
Jef Roosens 6a44eb705a Merge pull request 'Better env vars & api for managing repos' (#95) from repos-api into dev
Reviewed-on: Chewing_Bever/vieter#95
2022-02-22 08:22:53 +01:00
Jef Roosens 27f59c6664
Updated CI Dockerfile; fixed formatting & vet 2022-02-22 08:14:20 +01:00
Jef Roosens 6194a3f408
Builder now gets list of repos from server 2022-02-21 22:58:05 +01:00
Jef Roosens fe98112f79
Added repos delete route 2022-02-21 22:40:59 +01:00
Jef Roosens 398758a727
Fixed segfault
All together now: thank you spytheman
2022-02-21 22:32:54 +01:00
Jef Roosens e13252d368
Initial part of repos API (SEGFAULTS) [CI SKIP] 2022-02-21 22:22:36 +01:00
Jef Roosens 92ad0c51eb
Split off server into own module 2022-02-21 20:51:41 +01:00
Jef Roosens 1d434db166
Wrote a proper env file system 2022-02-21 20:42:13 +01:00
Jef Roosens d6e71e9a1c Merge pull request 'basic builds' (#84) from basic-builds into dev
Reviewed-on: Chewing_Bever/vieter#84
2022-02-21 18:06:54 +01:00
Jef Roosens 0cdd4e7b4b
Versioned API endpoints (closes #91) 2022-02-21 17:49:10 +01:00
Jef Roosens 96416585bc
Added some error messages; updated changelog 2022-02-21 17:18:14 +01:00
Jef Roosens 9cc88e629f
Added some documentation; ran format 2022-02-20 22:15:10 +01:00
Jef Roosens 36693900a3
Added crontab to docker image 2022-02-20 21:43:18 +01:00
Jef Roosens 138386682d
Repos are now read from a json file 2022-02-20 21:19:31 +01:00
Jef Roosens 941b30e7d2
Fully functional hardcoded build command 2022-02-20 21:09:06 +01:00
Jef Roosens 4f705f5fb5
Working build example!! 2022-02-20 20:26:39 +01:00
Jef Roosens 5515e2dca5
Formatting & some cleanup 2022-02-20 13:10:48 +01:00
Jef Roosens fbba66caa5
Docker wrapper now waits for chunked responses 2022-02-20 13:03:00 +01:00
Jef Roosens 275227400f
Wait for chunked stream WIP [CI SKIP] 2022-02-20 12:35:10 +01:00
Jef Roosens e6a1d32f0e
Some experimenting with docker api 2022-02-19 22:25:52 +01:00
Jef Roosens 57c4af0aaf
Fix for segfault 2022-02-19 21:41:26 +01:00
Jef Roosens 6c435c2a1e
Merge branch 'dev' into basic-builds 2022-02-19 15:55:45 +01:00
Jef Roosens 96c0ac3d59 Merge pull request 'Better V Integration' (#81) from better-v-integration into dev
Reviewed-on: Chewing_Bever/vieter#81
2022-02-19 15:45:30 +01:00
Jef Roosens 34ccd9a6ef
Merge branch 'dev' into better-v-integration 2022-02-19 15:38:36 +01:00
Jef Roosens 3b3a2f4fc1
Fixed linting errors 2022-02-19 15:36:30 +01:00
Jef Roosens 07bd0beb58
Removed builder & patches code; updated README 2022-02-19 15:27:41 +01:00
Jef Roosens 871ce8a407 Merge pull request 'Single Version per Package' (#80) from single-version-per-pkg into dev
Reviewed-on: Chewing_Bever/vieter#80
2022-02-19 09:10:17 +01:00
Jef Roosens 99f6dc69fd
Fixed tiny linting error 2022-02-18 22:08:58 +01:00
Jef Roosens 18edb0ea8d
Merge branch 'dev' into single-version-per-pkg 2022-02-18 22:01:04 +01:00
Jef Roosens 79b47a76e2
Remove packages from db before adding new version 2022-02-18 21:59:33 +01:00
Jef Roosens 6f86033cd9
Currently broken start of docker wrapper [CI SKIP] 2022-02-17 22:00:46 +01:00
Jef Roosens 022f8c4fbe
Updated to weekly.2022.07 2022-02-14 22:28:18 +01:00
Jef Roosens c8a10261c4
Bump v version to 2022.06 2022-02-13 13:31:07 +01:00
Jef Roosens 3379db017d
Added garbage collector to builder image 2022-02-04 13:28:03 +01:00
Jef Roosens a4346aad39
Switched to boehm garbage collector 2022-02-04 13:17:12 +01:00
175 changed files with 24534 additions and 1268 deletions

4
.clang-format 100644
View File

@ -0,0 +1,4 @@
# To stay consistent with the V formatting style, we use tabs
UseTab: Always
IndentWidth: 4
TabWidth: 4

View File

@ -1,4 +1,3 @@
# top-most EditorConfig file
root = true root = true
# Unix-style newlines with a newline ending every file # Unix-style newlines with a newline ending every file
@ -6,5 +5,5 @@ root = true
end_of_line = lf end_of_line = lf
insert_final_newline = true insert_final_newline = true
[*.v] [*.{v,c,h}]
indent_style = space indent_style = tab

27
.gitignore vendored
View File

@ -1,11 +1,13 @@
*.c vieter.c
data/ /data/
# Build artifacts # Build artifacts
vieter /vieter
dvieter /dvieter
pvieter /pvieter
vieter.c /suvieter
/afvieter
/vieter.c
# Ignore testing files # Ignore testing files
*.pkg* *.pkg*
@ -17,4 +19,15 @@ libarchive-*
test/ test/
# V compiler directory # V compiler directory
v-*/ v/
# gdb log file
gdb.txt
# Generated docs
_docs/
docs/resources/_gen/
/man/
# VLS logs
vls.log

6
.gitmodules vendored 100644
View File

@ -0,0 +1,6 @@
[submodule "docs/themes/hugo-book"]
path = docs/themes/hugo-book
url = https://github.com/alex-shpak/hugo-book
[submodule "src/libvieter"]
path = src/libvieter
url = https://git.rustybever.be/vieter-v/libvieter

View File

@ -1,18 +0,0 @@
branches: dev
platform: linux/amd64
pipeline:
publish:
image: woodpeckerci/plugin-docker-buildx
secrets: [ docker_username, docker_password ]
settings:
repo: chewingbever/vlang
tag: latest
dockerfile: Dockerfile.builder
platforms: [ linux/arm/v7, linux/arm64/v8, linux/amd64 ]
when:
event: push
path:
- Makefile
- Dockerfile.builder
- patches/*

View File

@ -1,15 +0,0 @@
# Deploys the newest development image to my server
branches: [dev]
platform: linux/amd64
depends_on:
- docker
skip_clone: true
pipeline:
webhook:
image: chewingbever/vlang:latest
secrets:
- webhook
commands:
- curl -XPOST -s "$WEBHOOK"

View File

@ -1,33 +0,0 @@
branches: [main, dev]
platform: linux/amd64
depends_on:
- builder
- build
pipeline:
dev:
image: woodpeckerci/plugin-docker-buildx
secrets: [ docker_username, docker_password ]
settings:
repo: chewingbever/vieter
dockerfile: Dockerfile.ci
tag: dev
platforms: [ linux/arm/v7, linux/arm64/v8, linux/amd64 ]
build_args_from_env:
- CI_COMMIT_SHA
when:
event: push
branch: dev
release:
image: woodpeckerci/plugin-docker-buildx
secrets: [ docker_username, docker_password ]
settings:
repo: chewingbever/vieter
dockerfile: Dockerfile.ci
auto_tag: true
platforms: [ linux/arm/v7, linux/arm64/v8, linux/amd64 ]
build_args_from_env:
- CI_COMMIT_SHA
when:
event: tag

View File

@ -1,13 +0,0 @@
# These checks already get performed on the feature branches
branches:
exclude: [ main, dev ]
platform: linux/amd64
pipeline:
lint:
image: 'chewingbever/vlang:latest'
pull: true
group: lint
commands:
- make lint
- make vet

View File

@ -0,0 +1,40 @@
matrix:
PLATFORM:
- linux/amd64
- linux/arm64
platform: ${PLATFORM}
branches: [main]
skip_clone: true
pipeline:
build:
image: 'git.rustybever.be/vieter-v/vieter-builder'
pull: true
commands:
# Add the vieter repository so we can use the compiler
- echo -e '[vieter]\nServer = https://arch.r8r.be/$repo/$arch\nSigLevel = Optional' >> /etc/pacman.conf
# Update packages
- pacman -Syu --noconfirm
# Create non-root user to perform build & switch to their home
- groupadd -g 1000 builder
- useradd -mg builder builder
- chown -R builder:builder "$PWD"
- "echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
- su builder
# Due to a bug with the V compiler, we can't just use the PKGBUILD from
# inside the repo
- curl -OL "https://git.rustybever.be/vieter-v/vieter/raw/tag/$CI_COMMIT_TAG/PKGBUILD"
- makepkg -s --noconfirm --needed
when:
event: tag
publish:
image: 'curlimages/curl'
commands:
# Publish the package
- 'for pkg in $(ls -1 *.pkg*); do curl -XPOST -T "$pkg" -H "X-API-KEY: $VIETER_API_KEY" https://arch.r8r.be/vieter/publish; done'
secrets:
- vieter_api_key
when:
event: tag

View File

@ -0,0 +1,40 @@
matrix:
PLATFORM:
- linux/amd64
- linux/arm64
platform: ${PLATFORM}
branches: [dev]
skip_clone: true
pipeline:
build:
image: 'git.rustybever.be/vieter-v/vieter-builder'
pull: true
commands:
# Add the vieter repository so we can use the compiler
- echo -e '[vieter]\nServer = https://arch.r8r.be/$repo/$arch\nSigLevel = Optional' >> /etc/pacman.conf
# Update packages
- pacman -Syu --noconfirm
# Create non-root user to perform build & switch to their home
- groupadd -g 1000 builder
- useradd -mg builder builder
- chown -R builder:builder "$PWD"
- "echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
- su builder
# Due to a bug with the V compiler, we can't just use the PKGBUILD from
# inside the repo
- curl -o PKGBUILD -L https://git.rustybever.be/vieter-v/vieter/raw/branch/dev/PKGBUILD.dev
- makepkg -s --noconfirm --needed
when:
event: push
publish:
image: 'curlimages/curl'
commands:
# Publish the package
- 'for pkg in $(ls -1 *.pkg*); do curl -XPOST -T "$pkg" -H "X-API-KEY: $VIETER_API_KEY" https://arch.r8r.be/vieter/publish; done'
secrets:
- vieter_api_key
when:
event: push

View File

@ -1,31 +1,41 @@
variables:
- &vlang_image 'git.rustybever.be/vieter/vlang:5d4c9dc9fc11bf8648541c934adb64f27cb94e37-alpine3.17'
matrix: matrix:
PLATFORM: PLATFORM:
- linux/amd64 - 'linux/amd64'
- linux/arm64 - 'linux/arm64'
- linux/arm/v7
# These checks already get performed on the feature branches
platform: ${PLATFORM} platform: ${PLATFORM}
pipeline: pipeline:
# The default build isn't needed, as alpine switches to gcc for the compiler anyways install-modules:
debug: image: *vlang_image
image: 'chewingbever/vlang:latest'
pull: true pull: true
group: 'build'
commands: commands:
- make debug - export VMODULES=$PWD/.vmodules
- 'cd src && v install'
when: when:
event: push event: [push, pull_request]
debug:
image: *vlang_image
commands:
- export VMODULES=$PWD/.vmodules
- make
when:
event: [pull_request]
branch:
exclude: [main]
prod: prod:
image: 'chewingbever/vlang:latest' image: *vlang_image
pull: true
environment: environment:
- LDFLAGS=-lz -lbz2 -llzma -lexpat -lzstd -llz4 -static - LDFLAGS=-lz -lbz2 -llzma -lexpat -lzstd -llz4 -lsqlite3 -static
group: 'build'
commands: commands:
- make prod - export VMODULES=$PWD/.vmodules
# Apparently this -D is *very* important
- CFLAGS='-DGC_THREADS=1' make prod
# Make sure the binary is actually statically built # Make sure the binary is actually statically built
- readelf -d pvieter - readelf -d pvieter
- du -h pvieter - du -h pvieter
@ -34,23 +44,24 @@ pipeline:
- strip -s pvieter - strip -s pvieter
- du -h pvieter - du -h pvieter
when: when:
event: push event: [push, pull_request]
upload: upload:
image: 'chewingbever/vlang:latest' image: *vlang_image
secrets: [ s3_username, s3_password ] secrets: [ s3_username, s3_password ]
commands: commands:
# https://gist.github.com/JustinTimperio/7c7115f87b775618637d67ac911e595f # https://gist.github.com/JustinTimperio/7c7115f87b775618637d67ac911e595f
- export URL=s3.rustybever.be - export URL=s3.rustybever.be
- export OBJ_PATH="/vieter/commits/$CI_COMMIT_SHA/vieter-$(echo '${PLATFORM}' | sed 's:/:-:g')"
- export DATE="$(date -R --utc)" - export DATE="$(date -R --utc)"
- export CONTENT_TYPE='application/zstd' - export CONTENT_TYPE='application/zstd'
- export SIG_STRING="PUT\n\n$CONTENT_TYPE\n$DATE\n$OBJ_PATH"
- export SIGNATURE=`echo -en $SIG_STRING | openssl sha1 -hmac $S3_PASSWORD -binary | base64`
- export OBJ_PATH="/vieter/commits/$CI_COMMIT_SHA/vieter-$(echo '${PLATFORM}' | sed 's:/:-:g')"
- export SIG_STRING="PUT\n\n$CONTENT_TYPE\n$DATE\n$OBJ_PATH"
- export SIGNATURE="$(echo -en $SIG_STRING | openssl dgst -sha1 -hmac $S3_PASSWORD -binary | base64)"
- > - >
curl curl
--silent --silent
--fail
-XPUT -XPUT
-T pvieter -T pvieter
-H "Host: $URL" -H "Host: $URL"
@ -59,4 +70,4 @@ pipeline:
-H "Authorization: AWS $S3_USERNAME:$SIGNATURE" -H "Authorization: AWS $S3_USERNAME:$SIGNATURE"
https://$URL$OBJ_PATH https://$URL$OBJ_PATH
when: when:
event: push event: [push, pull_request]

View File

@ -0,0 +1,18 @@
branches: [ 'dev' ]
platform: 'linux/amd64'
depends_on:
- 'docker'
skip_clone: true
pipeline:
webhooks:
image: 'curlimages/curl'
secrets:
- 'webhook_app'
- 'webhook_cron'
commands:
- 'curl -XPOST -s --fail $WEBHOOK_APP'
- 'curl -XPOST -s --fail $WEBHOOK_CRON'
when:
event: push

View File

@ -0,0 +1,36 @@
branches: [main, dev]
platform: 'linux/amd64'
depends_on:
- build
pipeline:
dev:
image: 'woodpeckerci/plugin-docker-buildx'
secrets:
- 'docker_username'
- 'docker_password'
settings:
repo: 'chewingbever/vieter'
tags:
- 'dev'
- ${CI_COMMIT_SHA}
platforms: [ 'linux/arm64/v8', 'linux/amd64' ]
build_args_from_env:
- 'CI_COMMIT_SHA'
when:
event: push
branch: dev
release:
image: 'woodpeckerci/plugin-docker-buildx'
secrets:
- 'docker_username'
- 'docker_password'
settings:
repo: 'chewingbever/vieter'
auto_tag: true
platforms: [ 'linux/arm64/v8', 'linux/amd64' ]
build_args_from_env:
- 'CI_COMMIT_SHA'
when:
event: tag

View File

@ -0,0 +1,50 @@
variables:
- &vlang_image 'git.rustybever.be/vieter/vlang:5d4c9dc9fc11bf8648541c934adb64f27cb94e37-alpine3.17'
platform: 'linux/amd64'
branches:
exclude: [ main ]
pipeline:
docs:
image: 'klakegg/hugo:ext-alpine'
group: 'generate'
commands:
- apk add git
- make docs
api-docs:
image: *vlang_image
pull: true
group: 'generate'
commands:
- make api-docs
slate-docs:
image: 'slatedocs/slate:v2.13.0'
group: 'generate'
# Slate requires a specific directory to run in
commands:
- cd docs/api
- bundle exec middleman build --clean
archive:
image: 'alpine'
commands:
- cp -r docs/api/build docs/public/api
- 'cd docs/public && tar czvf ../../docs.tar.gz *'
- 'cd ../../src/_docs && tar czvf ../../api-docs.tar.gz *'
when:
event: push
branch: dev
deploy:
image: 'curlimages/curl'
secrets:
- 'site_api_key'
commands:
- 'curl -XPOST --fail -s -H "Authorization: Bearer $SITE_API_KEY" -T docs.tar.gz https://rustybever.be/api/deploy?dir=docs-vieter'
- 'curl -XPOST --fail -s -H "Authorization: Bearer $SITE_API_KEY" -T api-docs.tar.gz https://rustybever.be/api/deploy?dir=api-docs-vieter'
when:
event: push
branch: dev

View File

@ -1,6 +1,8 @@
# Yeah so this only works on tags so we'll worry about this later variables:
platform: linux/amd64 - &vlang_image 'git.rustybever.be/vieter/vlang:5d4c9dc9fc11bf8648541c934adb64f27cb94e37-alpine3.17'
branches: main
platform: 'linux/amd64'
branches: [ 'main' ]
depends_on: depends_on:
- build - build
@ -9,12 +11,13 @@ skip_clone: true
pipeline: pipeline:
prepare: prepare:
image: 'chewingbever/vlang:latest' image: *vlang_image
pull: true pull: true
secrets: [ s3_username, s3_password ] secrets: [ s3_username, s3_password ]
commands: commands:
- mc alias set s3/ https://s3.rustybever.be "$S3_USERNAME" "$S3_PASSWORD" - mc alias set s3/ https://s3.rustybever.be "$S3_USERNAME" "$S3_PASSWORD"
- mc cp -r "s3/vieter/commits/$CI_COMMIT_SHA" . - mc cp -r "s3/vieter/commits/$CI_COMMIT_SHA" .
- mv "$CI_COMMIT_SHA"/vieter-* .
when: when:
event: tag event: tag
@ -24,9 +27,8 @@ pipeline:
- gitea_release_api_key - gitea_release_api_key
settings: settings:
base_url: https://git.rustybever.be base_url: https://git.rustybever.be
files: ${CI_COMMIT_SHA}/* files: vieter-*
checksum: checksum:
- md5
- sha256 - sha256
title: ${CI_COMMIT_TAG} title: ${CI_COMMIT_TAG}
when: when:

View File

@ -0,0 +1,27 @@
variables:
- &vlang_image 'git.rustybever.be/vieter/vlang:5d4c9dc9fc11bf8648541c934adb64f27cb94e37-alpine3.17'
# These checks already get performed on the feature branches
branches:
exclude: [ main ]
platform: 'linux/amd64'
pipeline:
# vfmt seems to get confused if these aren't present
install-modules:
image: *vlang_image
pull: true
commands:
- export VMODULES=$PWD/.vmodules
- 'cd src && v install'
when:
event: [pull_request]
lint:
image: *vlang_image
pull: true
commands:
- export VMODULES=$PWD/.vmodules
- make lint
when:
event: [pull_request]

View File

@ -0,0 +1,45 @@
variables:
- &vlang_image 'git.rustybever.be/vieter/vlang:5d4c9dc9fc11bf8648541c934adb64f27cb94e37-alpine3.17'
platform: 'linux/amd64'
branches:
exclude: [ main ]
depends_on:
- build
pipeline:
install-modules:
image: *vlang_image
pull: true
commands:
- export VMODULES=$PWD/.vmodules
- 'cd src && v install'
generate:
image: *vlang_image
commands:
# - curl -o vieter -L "https://s3.rustybever.be/vieter/commits/$CI_COMMIT_SHA/vieter-linux-amd64"
# - chmod +x vieter
- export VMODULES=$PWD/.vmodules
- make
- ./vieter man man
- cd man
# Generate an HTML page from each man page
- for f in $(ls -1 *.1); do mandoc -Thtml -O style=mandoc.css,man=%N.%S.html $f > "$f.html"; done
# Download the mandoc.css file from the official site
- curl -o mandoc.css -L https://mandoc.bsd.lv/mandoc.css
- tar czvf ../man.tar.gz *.html mandoc.css
deploy:
image: 'curlimages/curl'
secrets:
- 'site_api_key'
commands:
- 'curl -XPOST --fail -s -H "Authorization: Bearer $SITE_API_KEY" -T man.tar.gz https://rustybever.be/api/deploy?dir=man-vieter'
when:
event: push
branch: dev

View File

@ -0,0 +1,30 @@
variables:
- &vlang_image 'git.rustybever.be/vieter/vlang:5d4c9dc9fc11bf8648541c934adb64f27cb94e37-alpine3.17'
matrix:
PLATFORM:
- 'linux/amd64'
- 'linux/arm64'
branches:
exclude: [ main ]
platform: ${PLATFORM}
pipeline:
install-modules:
image: *vlang_image
pull: true
commands:
- export VMODULES=$PWD/.vmodules
- 'cd src && v install'
when:
event: [pull_request]
test:
image: *vlang_image
pull: true
commands:
- export VMODULES=$PWD/.vmodules
- make test
when:
event: [pull_request]

View File

@ -5,15 +5,222 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased](https://git.rustybever.be/Chewing_Bever/vieter) ## [Unreleased](https://git.rustybever.be/vieter-v/vieter/src/branch/dev)
## [0.1.0](https://git.rustybever.be/Chewing_Bever/vieter/src/tag/0.1.0) ### Added
* Metrics endpoint for Prometheus integration
* Search in list of targets using API & CLI
* Allow filtering targets by arch value
### Changed
* Rewrote cron expression logic in C
* Updated codebase to V commit after 0.3.3
### Removed
* Deprecated cron daemon
## [0.5.0](https://git.rustybever.be/vieter-v/vieter/src/tag/0.5.0)
### Added
* CLI commands for removing packages, arch-repos & repositories
## [0.5.0-rc.2](https://git.rustybever.be/vieter-v/vieter/src/tag/0.5.0-rc.2)
### Added
* API route for removing logs & accompanying CLI command
* Daemon for periodically removing old logs
* CLI flag to filter logs by specific exit codes
### Changed
* Use `--long-option` instead of `-long-option` for CLI
## [0.5.0-rc.1](https://git.rustybever.be/vieter-v/vieter/src/tag/0.5.0-rc.1)
### Added
* Allow specifying subdirectory inside Git repository
* Added option to deploy using agent-server architecture instead of cron daemon
* Allow scheduling builds on the server from the CLI tool instead of building
them locally
* Allow force-building packages, meaning the build won't check if the
repository is already up to date
### Changed
* Migrated codebase to V 0.3.2
* Cron expression parser now uses bitfields instead of bool arrays
### Fixed
* Arch value for target is now properly set if not provided
* Allow NULL values for branch in database
* Endpoint for adding targets now returns the correct id
* CLI now correctly errors and doesn't error when sending requests
* Fixed possible infinite loop when removing old build images
* Check whether build image still exists before starting build
* Don't run makepkg `prepare()` function twice
* Don't buffer stdout in Docker containers
## [0.4.0](https://git.rustybever.be/vieter-v/vieter/src/tag/0.4.0)
### Added
* Server port can now be configured
* Targets now have a 'kind' field describing whether it's a Git repository or a
URL to a PKGBUILD
* Targets with kind 'url' can provide a direct URL to a PKGBUILD instead of
providing a Git repository
* CLI commands for searching the AUR & directly adding packages
* HTTP routes for removing packages, arch-repos & repos
* All endpoints serving files now support HTTP byte range requests
* Better CLI UX
* When adding targets, the ID of the created target is returned
* The `-r` flag only shows raw data of action
* When adding a target, only ID is shown and not surrounding text
* Tabled output returns a tab-separated list (easy to script using
`cut`)
### Changed
* Moved all API routes under `/v1` namespace
* Renamed `vieter repos` to `vieter targets`
* Renamed `/api/v1/repos` namespace to `/api/v1/targets`
* Branch name for 'git' targets is now optional; if not provided, the
repository will be cloned with the default branch
* Build containers now explicitely set the PATH variable
* Refactor of web framework
* API endpoints now return id of newly created entries
* Repo POST requests now return information on published package
* `api` can no longer be used as a repository name
* CLI client now allows setting values to an empty value
### Removed
* md5 hashes are no longer calculated for packages
## [0.3.0](https://git.rustybever.be/vieter-v/vieter/src/tag/0.3.0)
Nothing besides bumping the versions.
## [0.3.0-rc.1](https://git.rustybever.be/vieter-v/vieter/src/tag/0.3.0-rc.1)
### Added
* Database migrations
* Improved GitRepo & BuildLog API
* Pagination using `limit` & `offset` query params
* GitRepo: filter by repo
* BuildLog: filter by start & end date, repo, exit code & arch
* CLI flags to take advantage of above API improvements
* Added CLI command to generate all man pages
* PKGBUILDs now install man pages
* Hosted CLI man pages ([vieter(1)](https://rustybever.be/man/vieter/vieter.1.html))
* Proper HTTP API docs ([link](https://rustybever.be/docs/vieter/api/))
### Changed
* Packages from target repo are available during builds
* This can be used as a basic way to support AUR dependencies, by adding
the dependencies to the same repository
* Every build now updates its packages first instead of solely relying on the
updated builder image
* Build logs now show commands being executed
### Fixed
* `POST /api/logs` now correctly uses epoch timestamps instead of strings
## [0.3.0-alpha.2](https://git.rustybever.be/vieter-v/vieter/src/tag/0.3.0-alpha.2)
### Added
* Web API for adding & querying build logs
* CLI commands to access build logs API
* Cron build logs are uploaded to above API
* Proper ASCII table output in CLI
* `vieter repos build id` command to run builds locally
### Removed
* `vieter build` command
* This command was used alongside cron for periodic builds, but this has
been replaced by `vieter cron`
### Changed
* `vieter build` command now only builds a single repository & uploads the
build logs
* Official Arch packages are now split between `vieter` & `vieter-git`
* `vieter` is the latest release
* `vieter-git` is the latest commit on the dev branch
* Full refactor of Docker socket code
## [0.3.0-alpha.1](https://git.rustybever.be/vieter-v/vieter/src/tag/0.3.0-alpha.1)
### Changed
* Switched from compiler fork to fully vanilla compiler mirror
* `download_dir`, `repos_file` & `repos_dir` config values have been replaced
with `data_dir`
* Storage of metadata (e.g. Git repositories) is now done using Sqlite
### Added
* Implemented own cron daemon for builder
* Build schedule can be configured globally or individually per repository
* Added CLI command to show detailed information per repo
### Fixed
* Binary no longer panics when an env var is missing
## [0.2.0](https://git.rustybever.be/vieter-v/vieter/src/tag/0.2.0)
### Changed
* Better config system
* Support for both a config file & environment variables
* Each env var can now be provided from a file by appending it with `_FILE`
& passing the path to the file as value
* Revamped web framework
* All routes now return proper JSON where applicable & the correct status
codes
### Added
* Very basic build system
* Build is triggered by separate cron container
* Packages build on cron container's system
* A HEAD request is used to determine whether a package should be rebuilt
or not
* Hardcoded planning of builds
* Builds are sequential
* API for managing Git repositories to build
* CLI to list, add & remove Git repos to build
* Published packages on my Vieter instance
* Support for multiple repositories
* Support for multiple architectures per repository
### Fixed
* Each package can now only have one version in the repository at once
(required by Pacman)
* Packages with unknown fields in .PKGINFO are now allowed
* Old packages are now properly removed
## [0.1.0](https://git.rustybever.be/vieter-v/vieter/src/tag/0.1.0)
### Changed ### Changed
* Improved logging * Improved logging
## [0.1.0-rc.1](https://git.rustybever.be/Chewing_Bever/vieter/src/tag/0.1.0-rc.1) ## [0.1.0-rc.1](https://git.rustybever.be/vieter-v/vieter/src/tag/0.1.0-rc.1)
### Added ### Added

View File

@ -1,19 +1,48 @@
FROM chewingbever/vlang:latest AS builder FROM git.rustybever.be/chewing_bever/vlang:0.3.2 AS builder
ARG TARGETPLATFORM
ARG CI_COMMIT_SHA
ARG DI_VER=1.2.5
WORKDIR /app WORKDIR /app
# Build dumb-init
RUN curl -Lo - "https://github.com/Yelp/dumb-init/archive/refs/tags/v${DI_VER}.tar.gz" | tar -xzf - && \
cd "dumb-init-${DI_VER}" && \
make SHELL=/bin/sh && \
mv dumb-init .. && \
cd ..
# Copy over source code & build production binary # Copy over source code & build production binary
COPY src ./src COPY src ./src
COPY Makefile ./ COPY Makefile ./
ENV LDFLAGS='-lz -lbz2 -llzma -lexpat -lzstd -llz4 -static' RUN if [ -n "${CI_COMMIT_SHA}" ]; then \
RUN v -o pvieter -cflags "-O3" src curl --fail \
-o vieter \
"https://s3.rustybever.be/vieter/commits/${CI_COMMIT_SHA}/vieter-$(echo "${TARGETPLATFORM}" | sed 's:/:-:g')" && \
chmod +x vieter ; \
else \
cd src && v install && cd .. && \
LDFLAGS='-lz -lbz2 -llzma -lexpat -lzstd -llz4 -lsqlite3 -static' make prod && \
mv pvieter vieter ; \
fi
FROM alpine:3.15 FROM busybox:1.35.0
ENV REPO_DIR=/data ENV PATH=/bin \
VIETER_DATA_DIR=/data \
VIETER_PKG_DIR=/data/pkgs
COPY --from=builder /app/pvieter /usr/local/bin/vieter COPY --from=builder /app/dumb-init /app/vieter /bin/
ENTRYPOINT [ "/usr/local/bin/vieter" ] RUN mkdir /data && \
chown -R www-data:www-data /data
WORKDIR /data
USER www-data:www-data
ENTRYPOINT ["/bin/dumb-init", "--"]
CMD ["/bin/vieter", "server"]

View File

@ -1,35 +0,0 @@
FROM alpine:3.12
ARG TARGETPLATFORM
WORKDIR /opt/vlang
ENV VVV /opt/vlang
ENV PATH /opt/vlang:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV VFLAGS -cc gcc
ENV V_PATH /opt/vlang/v
RUN ln -s /opt/vlang/v /usr/bin/v && \
apk --no-cache add \
git make gcc curl openssl \
musl-dev \
openssl-libs-static openssl-dev \
zlib-static bzip2-static xz-dev expat-static zstd-static lz4-static \
sqlite-static sqlite-dev \
libx11-dev glfw-dev freetype-dev \
libarchive-static libarchive-dev \
diffutils
COPY patches ./patches
COPY Makefile ./
RUN make v && \
mv v-*/* /opt/vlang && \
v -version
RUN if [ "$TARGETPLATFORM" = 'linux/amd64' ]; then \
wget -O /usr/local/bin/mc https://dl.min.io/client/mc/release/linux-amd64/mc && \
chmod +x /usr/local/bin/mc ; \
fi
CMD ["v"]

View File

@ -1,46 +0,0 @@
# vim: ft=dockerfile
# This image just has the required tools to download the binaries
FROM chewingbever/vlang:latest AS builder
ARG TARGETPLATFORM
ARG CI_COMMIT_SHA
ARG DI_VER=1.2.5
WORKDIR /app
# Build dumb-init
RUN curl -Lo - "https://github.com/Yelp/dumb-init/archive/refs/tags/v${DI_VER}.tar.gz" | tar -xzf - && \
cd "dumb-init-${DI_VER}" && \
make SHELL=/bin/sh && \
mv dumb-init .. && \
cd ..
RUN curl --fail \
-o vieter \
"https://s3.rustybever.be/vieter/commits/${CI_COMMIT_SHA}/vieter-$(echo "${TARGETPLATFORM}" | sed 's:/:-:g')" && \
chmod +x vieter
FROM busybox:1.35.0
ENV PATH=/bin \
REPO_DIR=/data/repo \
PKG_DIR=/data/pkgs \
DOWNLOAD_DIR=/data/downloads
COPY --from=builder /app/dumb-init /app/vieter /bin/
HEALTHCHECK --interval=30s \
--timeout=3s \
--start-period=5s \
CMD /bin/wget --spider http://localhost:8000/health || exit 1
RUN mkdir /data && \
chown -R www-data:www-data /data
WORKDIR /data
USER www-data:www-data
ENTRYPOINT ["/bin/dumb-init", "--"]
CMD ["/bin/vieter"]

View File

@ -1,33 +1,44 @@
# =====CONFIG===== # =====CONFIG=====
SRC_DIR := src SRC_DIR := src
SOURCES != find '$(SRC_DIR)' -iname '*.v' SRCS != find '$(SRC_DIR)' -iname '*.v'
V_RELEASE := weekly.2022.05 V_PATH ?= v
V_PATH ?= v-$(V_RELEASE)/v V := $(V_PATH) -showcc -gc boehm -d use_openssl -skip-unused
V := $(V_PATH) -showcc
all: vieter all: vieter
# =====COMPILATION===== # =====COMPILATION=====
.PHONY: libvieter
libvieter:
make -C '$(SRC_DIR)/libvieter' CFLAGS='-O3'
# Regular binary # Regular binary
vieter: $(SOURCES) vieter: $(SOURCES) libvieter
$(V) -g -o vieter $(SRC_DIR) $(V) -g -o vieter $(SRC_DIR)
# Debug build using gcc # Debug build using gcc
# The debug build can't use the boehm garbage collector, as that is
# multi-threaded and causes issues when running vieter inside gdb.
.PHONY: debug .PHONY: debug
debug: dvieter debug: dvieter
dvieter: $(SOURCES) dvieter: $(SOURCES) libvieter
$(V) -keepc -cg -cc gcc -o dvieter $(SRC_DIR) $(V_PATH) -showcc -keepc -cg -o dvieter $(SRC_DIR)
# Run the debug build inside gdb
.PHONY: gdb
gdb: dvieter
gdb --args ./dvieter -f vieter.toml server
# Optimised production build # Optimised production build
.PHONY: prod .PHONY: prod
prod: pvieter prod: pvieter
pvieter: $(SOURCES) pvieter: $(SOURCES) libvieter
$(V) -o pvieter -prod $(SRC_DIR) $(V) -o pvieter -prod $(SRC_DIR)
# Only generate C code # Only generate C code
.PHONY: c .PHONY: c
c: c: $(SOURCES) libvieter
$(V) -o vieter.c $(SRC_DIR) $(V) -o vieter.c $(SRC_DIR)
@ -35,39 +46,66 @@ c:
# Run the server in the default 'data' directory # Run the server in the default 'data' directory
.PHONY: run .PHONY: run
run: vieter run: vieter
API_KEY=test DOWNLOAD_DIR=data/downloads REPO_DIR=data/repo PKG_DIR=data/pkgs LOG_LEVEL=DEBUG ./vieter ./vieter -f vieter.toml server
.PHONY: run-prod .PHONY: run-prod
run-prod: prod run-prod: prod
API_KEY=test DOWNLOAD_DIR=data/downloads REPO_DIR=data/repo PKG_DIR=data/pkgs LOG_LEVEL=DEBUG ./pvieter ./pvieter -f vieter.toml server
# Same as run, but restart when the source code changes
.PHONY: watch # =====DOCS=====
watch: .PHONY: docs
API_KEY=test DOWNLOAD_DIR=data/downloads REPO_DIR=data/repo PKG_DIR=data/pkgs LOG_LEVEL=DEBUG $(V) watch run vieter docs:
rm -rf 'docs/public'
cd docs && hugo
.PHONY: api-docs
api-docs:
rm -rf '$(SRC_DIR)/_docs'
cd '$(SRC_DIR)' && v doc -all -f html -m -readme .
.PHONY: man
man: vieter
rm -rf man
./vieter man man
# =====OTHER===== # =====OTHER=====
# Linting
.PHONY: lint .PHONY: lint
lint: lint:
$(V) fmt -verify $(SRC_DIR) $(V) fmt -verify $(SRC_DIR)
$(V) vet -W $(SRC_DIR)
$(V_PATH) missdoc -p $(SRC_DIR)
@ [ $$($(V_PATH) missdoc -p $(SRC_DIR) | wc -l) = 0 ]
# Format the V codebase
# Formatting
.PHONY: fmt .PHONY: fmt
fmt: fmt:
$(V) fmt -w $(SRC_DIR) $(V) fmt -w $(SRC_DIR)
.PHONY: vet
vet:
$(V) vet -W $(SRC_DIR)
# Build & patch the V compiler # Testing
.PHONY: v .PHONY: test
v: v-$(V_RELEASE)/v test: libvieter
v-$(V_RELEASE)/v: $(V) -g test $(SRC_DIR)
curl -Lo - 'https://github.com/vlang/v/archive/refs/tags/$(V_RELEASE).tar.gz' | tar xzf -
cd patches && sh patch.sh '../v-$(V_RELEASE)'
make -C 'v-$(V_RELEASE)'
# Cleaning
.PHONY: clean
clean: clean:
rm -rf 'data' 'vieter' 'dvieter' 'pvieter' 'vieter.c' 'v-$(V_RELEASE)' rm -rf 'data' 'vieter' 'dvieter' 'pvieter' 'vieter.c' 'pkg' 'src/vieter' *.pkg.tar.zst 'suvieter' 'afvieter' '$(SRC_DIR)/_docs' 'docs/public'
make -C '$(SRC_DIR)/libvieter' clean
# =====EXPERIMENTAL=====
.PHONY: autofree
autofree: afvieter
afvieter: $(SOURCES)
$(V) -showcc -autofree -o afvieter $(SRC_DIR)
.PHONY: skip-unused
skip-unused: suvieter
suvieter: $(SOURCES)
$(V) -skip-unused -o suvieter $(SRC_DIR)

42
PKGBUILD 100644
View File

@ -0,0 +1,42 @@
# vim: ft=bash
# Maintainer: Jef Roosens
pkgbase='vieter'
pkgname='vieter'
pkgver='0.5.0'
pkgrel=1
pkgdesc="Lightweight Arch repository server & package build system"
depends=('glibc' 'openssl' 'libarchive' 'sqlite')
makedepends=('git' 'vieter-vlang')
arch=('x86_64' 'aarch64')
url='https://git.rustybever.be/vieter-v/vieter'
license=('AGPL3')
source=("$pkgname::git+https://git.rustybever.be/vieter-v/vieter#tag=${pkgver//_/-}")
md5sums=('SKIP')
prepare() {
export VMODULES="$srcdir/.vmodules"
cd "$pkgname/src" && v install
}
build() {
export VMODULES="$srcdir/.vmodules"
cd "$pkgname"
make prod
# The default CFLAGS for some reason causes vieter to segfault if used
# inside the PKGBUILD. As a workaround, we use tcc to build a debug build
# that does work, so we can generate the manpages.
CFLAGS= LDFLAGS= make man
}
package() {
install -dm755 "$pkgdir/usr/bin"
install -Dm755 "$pkgname/pvieter" "$pkgdir/usr/bin/vieter"
install -dm755 "$pkgdir/usr/share/man/man1"
install -Dm644 "$pkgname/man"/*.1 "$pkgdir/usr/share/man/man1"
}

60
PKGBUILD.dev 100644
View File

@ -0,0 +1,60 @@
# vim: ft=bash
# Maintainer: Jef Roosens
pkgbase='vieter-git'
pkgname='vieter-git'
pkgver=0.2.0.r25.g20112b8
pkgrel=1
pkgdesc="Lightweight Arch repository server & package build system (development version)"
depends=('glibc' 'openssl' 'libarchive' 'sqlite')
makedepends=('git' 'vieter-vlang')
arch=('x86_64' 'aarch64')
url='https://git.rustybever.be/vieter-v/vieter'
license=('AGPL3')
source=(
"${pkgname}::git+https://git.rustybever.be/vieter-v/vieter#branch=dev"
"libvieter::git+https://git.rustybever.be/vieter-v/libvieter"
)
md5sums=('SKIP' 'SKIP')
provides=('vieter')
conflicts=('vieter')
pkgver() {
cd "${pkgname}"
git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare() {
cd "${pkgname}"
# Add the libvieter submodule
git submodule init
git config submodules.src/libvieter.url "${srcdir}/libvieter"
git -c protocol.file.allow=always submodule update
export VMODULES="${srcdir}/.vmodules"
cd src && v install
}
build() {
export VMODULES="${srcdir}/.vmodules"
cd "${pkgname}"
make prod
# The default CFLAGS for some reason causes vieter to segfault if used
# inside the PKGBUILD. As a workaround, we use tcc to build a debug build
# that does work, so we can generate the manpages.
CFLAGS= LDFLAGS= make man
}
package() {
install -dm755 "${pkgdir}/usr/bin"
install -Dm755 "${pkgname}/pvieter" "${pkgdir}/usr/bin/vieter"
install -dm755 "${pkgdir}/usr/share/man/man1"
install -Dm644 "${pkgname}/man"/*.1 "${pkgdir}/usr/share/man/man1"
}

115
README.md
View File

@ -1,46 +1,97 @@
# Vieter # Vieter
Vieter is a re-implementation of the Pieter project. The goal is to create a I host documentation for Vieter over at https://rustybever.be/docs/vieter/. API
simple PKGBUILD-based build system, combined with a self-hosted Arch documentation for the current codebase can be found at
repository. This would allow me to periodically re-build AUR packages (or https://rustybever.be/api-docs/vieter/.
PKGBUILDs I created myself), & make sure I never have to compile anything on my
own systems, making my updates a lot quicker. For more information, questions or just a chat, there's
[#vieter:rustybever.be](https://matrix.to/#/#vieter:rustybever.be) on Matrix!
## Overview
Vieter is a restart of the Pieter project. The goal is to create a simple,
lightweight self-hostable Arch repository server, paired with a system that
periodically builds & publishes select Arch packages. This would allow me to
build AUR packages (or PKGBUILDs I created myself) "in the cloud" & make sure I
never have to compile anything on my own systems, making my updates a lot
quicker.
## Why V? ## Why V?
I chose [V](https://vlang.io/) as I've been very intrigued by this language for I chose [V](https://vlang.io/) as I've been very intrigued by this language for
a while now. I wanted a fast language that I could code while relaxing, without a while now. I wanted a fast language that I could code while relaxing, without
having to exert too much mental effort & V seemed like the right choice for having to exert too much mental effort & V seemed like the right choice for
that. that. Sadly, this didn't quite turn out the way I expected, but I'm sticking
with it anyways ;p
### Custom Compiler
Currently, this program only works with a very slightly modified version of the
V standard library, and therefore the compiler. The changes that are made to
the standard V release can be found in the [patches](/patches) directory. You
can obtain this modified version of the compiler by running `make v`, which
will download, patch & build the compiler. Afterwards, all make commands that
require the V compiler will use this new binary.
## Features ## Features
The project will consist of a server-agent model, where one or more builder * Arch repository server
nodes can register with the server. These agents communicate with the Docker * Support for multiple repositories & multiple architectures
daemon to start builds, which are then uploaded to the server's repository. The * Endpoints for publishing new packages
server also allows for non-agents to upload packages, as long as they have the * API for managing repositories to build
required secrets. This allows me to also develop non-git packages, such as my * Build system
terminal, & upload them to the servers using CI. * Periodic rebuilding of packages
* Prevent unnecessary rebuilds
## Directory Structure ## Building
The data directory consists of three main directories: Besides a V installer, Vieter also requires the following libraries to work:
* `downloads` - This is where packages are initially downloaded. Because vieter * libarchive
moves files from this folder to the `pkgs` folder, these two folders should * openssl
best be on the same drive * sqlite3
* `pkgs` - This is where approved package files are stored.
* `repos` - Each repository gets a subfolder here. The subfolder contains the Vieter also depends on some external V modules which you can install using `cd
uncompressed contents of the db file. src && v install`. Make sure to keep these dependencies up to date using `v
* Each repo subdirectory contains the compressed db & files archive for the update`.
repository, alongside a directory called `files` which contains the
uncompressed contents. ### Compiler
V is developed using a specific compiler commit that is usually updated
whenever a new version is released. Information on this can be found in the
[tools](https://git.rustybever.be/vieter-v/tools) repository.
## Contributing
If you wish to contribute to the project, please take note of the following:
* Rebase instead of merging whenever possible, e.g. when updating your branch
with the dev branch.
* Please follow the
[Conventional Commits](https://www.conventionalcommits.org/) style for your
commit messages.
### Writing documentation
The `docs` directory contains a Hugo site consisting of all user &
administrator documentation. `docs/api` on the other hand is a
[Slate](https://github.com/slatedocs/slate) project describing the HTTP web
API.
To modify the Hugo documentation, you'll need to install Hugo. Afterwards, you
can use the following commands inside the `docs` directory:
```sh
# Build the documentation
hugo
# Host an auto-refreshing web server with the documentation. Important to note
# is that the files will be at `http://localhost:1313/docs/vieter` instead of
# just `http://localhost:1313/`
hugo server
```
For the Slate docs, I personally just start a docker container:
```sh
docker run \
--rm \
-p 4567:4567 \
--name slate \
-v $(pwd)/docs/api/source:/srv/slate/source slatedocs/slate serve
```
This will make the Slate docs available at http://localhost:4567. Sadly, this
server doesn't auto-refresh, so you'll have to manually refresh your browser
every time you make a change.

2
docs/.gitignore vendored 100644
View File

@ -0,0 +1,2 @@
.hugo_build.lock
/public/

View File

@ -0,0 +1,17 @@
platform: 'linux/amd64'
branches: 'main'
pipeline:
release:
image: 'klakegg/hugo:alpine'
commands:
- apk add git
- hugo
- 'cd public && tar czvf ../public.tar.gz *'
deploy:
image: 'curlimages/curl'
secrets:
- 'api_key'
commands:
- 'curl -XPOST --fail -s -H "Authorization: Bearer $API_KEY" -T public.tar.gz https://rustybever.be/api/deploy?dir=docs'

9
docs/LICENSE 100644
View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) <year> <copyright holders>
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.

3
docs/README.md 100644
View File

@ -0,0 +1,3 @@
# docs
Repository containing docs for various personal projects I've made.

View File

@ -0,0 +1,12 @@
.git/
.github/
build/
.editorconfig
.gitattributes
.gitignore
CHANGELOG.md
CODE_OF_CONDUCT.md
deploy.sh
font-selection.json
README.md
Vagrantfile

View File

@ -0,0 +1,18 @@
# EditorConfig is awesome: https://EditorConfig.org
# Top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
[*.rb]
charset = utf-8
[*.md]
trim_trailing_whitespace = false

1
docs/api/.gitattributes vendored 100644
View File

@ -0,0 +1 @@
source/javascripts/lib/* linguist-vendored

27
docs/api/.gitignore vendored 100644
View File

@ -0,0 +1,27 @@
*.gem
*.rbc
.bundle
.config
coverage
InstalledFiles
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
*.DS_STORE
build/
.cache
.vagrant
.sass-cache
# YARD artifacts
.yardoc
_yardoc
doc/
.idea/
# Vagrant artifacts
ubuntu-*-console.log

13
docs/api/Gemfile 100644
View File

@ -0,0 +1,13 @@
ruby '>= 2.6'
source 'https://rubygems.org'
# Middleman
gem 'middleman', '~> 4.4'
gem 'middleman-syntax', '~> 3.2'
gem 'middleman-autoprefixer', '~> 3.0'
gem 'middleman-sprockets', '~> 4.1'
gem 'rouge', '~> 3.21'
gem 'redcarpet', '~> 3.5.0'
gem 'nokogiri', '~> 1.13.3'
gem 'sass'
gem 'webrick'

View File

@ -0,0 +1,145 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (6.1.4.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
autoprefixer-rails (10.2.5.0)
execjs (< 2.8.0)
backports (3.21.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.9)
contracts (0.13.0)
dotenv (2.7.6)
erubis (2.7.0)
execjs (2.7.0)
fast_blank (1.0.1)
fastimage (2.2.5)
ffi (1.15.4)
haml (5.2.2)
temple (>= 0.8.0)
tilt
hamster (3.0.0)
concurrent-ruby (~> 1.0)
hashie (3.6.0)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
kramdown (2.3.1)
rexml
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
memoist (0.16.2)
middleman (4.4.2)
coffee-script (~> 2.2)
haml (>= 4.0.5)
kramdown (>= 2.3.0)
middleman-cli (= 4.4.2)
middleman-core (= 4.4.2)
middleman-autoprefixer (3.0.0)
autoprefixer-rails (~> 10.0)
middleman-core (>= 4.0.0)
middleman-cli (4.4.2)
thor (>= 0.17.0, < 2.0)
middleman-core (4.4.2)
activesupport (>= 6.1, < 7.0)
addressable (~> 2.4)
backports (~> 3.6)
bundler (~> 2.0)
contracts (~> 0.13.0)
dotenv
erubis
execjs (~> 2.0)
fast_blank
fastimage (~> 2.0)
hamster (~> 3.0)
hashie (~> 3.4)
i18n (~> 1.6.0)
listen (~> 3.0.0)
memoist (~> 0.14)
padrino-helpers (~> 0.15.0)
parallel
rack (>= 1.4.5, < 3)
sassc (~> 2.0)
servolux
tilt (~> 2.0.9)
toml
uglifier (~> 3.0)
webrick
middleman-sprockets (4.1.1)
middleman-core (~> 4.0)
sprockets (>= 3.0)
middleman-syntax (3.2.0)
middleman-core (>= 3.2)
rouge (~> 3.2)
mini_portile2 (2.8.0)
minitest (5.14.4)
nokogiri (1.13.4)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
padrino-helpers (0.15.1)
i18n (>= 0.6.7, < 2)
padrino-support (= 0.15.1)
tilt (>= 1.4.1, < 3)
padrino-support (0.15.1)
parallel (1.21.0)
parslet (2.0.0)
public_suffix (4.0.6)
racc (1.6.0)
rack (2.2.3)
rb-fsevent (0.11.0)
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.2.5)
rouge (3.28.0)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sassc (2.4.0)
ffi (~> 1.9)
servolux (0.13.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
temple (0.8.2)
thor (1.1.0)
tilt (2.0.10)
toml (0.3.0)
parslet (>= 1.8.0, < 3.0.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
uglifier (3.2.0)
execjs (>= 0.3.0, < 3)
webrick (1.7.0)
zeitwerk (2.5.1)
PLATFORMS
ruby
DEPENDENCIES
middleman (~> 4.4)
middleman-autoprefixer (~> 3.0)
middleman-sprockets (~> 4.1)
middleman-syntax (~> 3.2)
nokogiri (~> 1.13.3)
redcarpet (~> 3.5.0)
rouge (~> 3.21)
sass
webrick
RUBY VERSION
ruby 2.7.2p137
BUNDLED WITH
2.2.22

63
docs/api/config.rb 100644
View File

@ -0,0 +1,63 @@
# Unique header generation
require './lib/unique_head.rb'
# Markdown
set :markdown_engine, :redcarpet
set :markdown,
fenced_code_blocks: true,
smartypants: true,
disable_indented_code_blocks: true,
prettify: true,
strikethrough: true,
tables: true,
with_toc_data: true,
no_intra_emphasis: true,
renderer: UniqueHeadCounter
# Assets
set :css_dir, 'stylesheets'
set :js_dir, 'javascripts'
set :images_dir, 'images'
set :fonts_dir, 'fonts'
# Activate the syntax highlighter
activate :syntax
ready do
require './lib/monokai_sublime_slate.rb'
require './lib/multilang.rb'
end
activate :sprockets
activate :autoprefixer do |config|
config.browsers = ['last 2 version', 'Firefox ESR']
config.cascade = false
config.inline = true
end
# Github pages require relative links
activate :relative_assets
set :relative_links, true
# Build Configuration
configure :build do
# We do want to hash woff and woff2 as there's a bug where woff2 will use
# woff asset hash which breaks things. Trying to use a combination of ignore and
# rewrite_ignore does not work as it conflicts weirdly with relative_assets. Disabling
# the .woff2 extension only does not work as .woff will still activate it so have to
# have both. See https://github.com/slatedocs/slate/issues/1171 for more details.
activate :asset_hash, :exts => app.config[:asset_extensions] - %w[.woff .woff2]
# If you're having trouble with Middleman hanging, commenting
# out the following two lines has been known to help
activate :minify_css
activate :minify_javascript
# activate :gzip
end
# Deploy Configuration
# If you want Middleman to listen on a different port, you can set that below
set :port, 4567
helpers do
require './lib/toc_data.rb'
end

View File

@ -0,0 +1,148 @@
{
"IcoMoonType": "selection",
"icons": [
{
"icon": {
"paths": [
"M438.857 73.143q119.429 0 220.286 58.857t159.714 159.714 58.857 220.286-58.857 220.286-159.714 159.714-220.286 58.857-220.286-58.857-159.714-159.714-58.857-220.286 58.857-220.286 159.714-159.714 220.286-58.857zM512 785.714v-108.571q0-8-5.143-13.429t-12.571-5.429h-109.714q-7.429 0-13.143 5.714t-5.714 13.143v108.571q0 7.429 5.714 13.143t13.143 5.714h109.714q7.429 0 12.571-5.429t5.143-13.429zM510.857 589.143l10.286-354.857q0-6.857-5.714-10.286-5.714-4.571-13.714-4.571h-125.714q-8 0-13.714 4.571-5.714 3.429-5.714 10.286l9.714 354.857q0 5.714 5.714 10t13.714 4.286h105.714q8 0 13.429-4.286t6-10z"
],
"attrs": [],
"isMulticolor": false,
"tags": [
"exclamation-circle"
],
"defaultCode": 61546,
"grid": 14
},
"attrs": [],
"properties": {
"id": 100,
"order": 4,
"prevSize": 28,
"code": 58880,
"name": "exclamation-sign",
"ligatures": ""
},
"setIdx": 0,
"iconIdx": 0
},
{
"icon": {
"paths": [
"M585.143 786.286v-91.429q0-8-5.143-13.143t-13.143-5.143h-54.857v-292.571q0-8-5.143-13.143t-13.143-5.143h-182.857q-8 0-13.143 5.143t-5.143 13.143v91.429q0 8 5.143 13.143t13.143 5.143h54.857v182.857h-54.857q-8 0-13.143 5.143t-5.143 13.143v91.429q0 8 5.143 13.143t13.143 5.143h256q8 0 13.143-5.143t5.143-13.143zM512 274.286v-91.429q0-8-5.143-13.143t-13.143-5.143h-109.714q-8 0-13.143 5.143t-5.143 13.143v91.429q0 8 5.143 13.143t13.143 5.143h109.714q8 0 13.143-5.143t5.143-13.143zM877.714 512q0 119.429-58.857 220.286t-159.714 159.714-220.286 58.857-220.286-58.857-159.714-159.714-58.857-220.286 58.857-220.286 159.714-159.714 220.286-58.857 220.286 58.857 159.714 159.714 58.857 220.286z"
],
"attrs": [],
"isMulticolor": false,
"tags": [
"info-circle"
],
"defaultCode": 61530,
"grid": 14
},
"attrs": [],
"properties": {
"id": 85,
"order": 3,
"name": "info-sign",
"prevSize": 28,
"code": 58882
},
"setIdx": 0,
"iconIdx": 2
},
{
"icon": {
"paths": [
"M733.714 419.429q0-16-10.286-26.286l-52-51.429q-10.857-10.857-25.714-10.857t-25.714 10.857l-233.143 232.571-129.143-129.143q-10.857-10.857-25.714-10.857t-25.714 10.857l-52 51.429q-10.286 10.286-10.286 26.286 0 15.429 10.286 25.714l206.857 206.857q10.857 10.857 25.714 10.857 15.429 0 26.286-10.857l310.286-310.286q10.286-10.286 10.286-25.714zM877.714 512q0 119.429-58.857 220.286t-159.714 159.714-220.286 58.857-220.286-58.857-159.714-159.714-58.857-220.286 58.857-220.286 159.714-159.714 220.286-58.857 220.286 58.857 159.714 159.714 58.857 220.286z"
],
"attrs": [],
"isMulticolor": false,
"tags": [
"check-circle"
],
"defaultCode": 61528,
"grid": 14
},
"attrs": [],
"properties": {
"id": 83,
"order": 9,
"prevSize": 28,
"code": 58886,
"name": "ok-sign"
},
"setIdx": 0,
"iconIdx": 6
},
{
"icon": {
"paths": [
"M658.286 475.429q0-105.714-75.143-180.857t-180.857-75.143-180.857 75.143-75.143 180.857 75.143 180.857 180.857 75.143 180.857-75.143 75.143-180.857zM950.857 950.857q0 29.714-21.714 51.429t-51.429 21.714q-30.857 0-51.429-21.714l-196-195.429q-102.286 70.857-228 70.857-81.714 0-156.286-31.714t-128.571-85.714-85.714-128.571-31.714-156.286 31.714-156.286 85.714-128.571 128.571-85.714 156.286-31.714 156.286 31.714 128.571 85.714 85.714 128.571 31.714 156.286q0 125.714-70.857 228l196 196q21.143 21.143 21.143 51.429z"
],
"width": 951,
"attrs": [],
"isMulticolor": false,
"tags": [
"search"
],
"defaultCode": 61442,
"grid": 14
},
"attrs": [],
"properties": {
"id": 2,
"order": 1,
"prevSize": 28,
"code": 58887,
"name": "icon-search"
},
"setIdx": 0,
"iconIdx": 7
}
],
"height": 1024,
"metadata": {
"name": "slate",
"license": "SIL OFL 1.1"
},
"preferences": {
"showGlyphs": true,
"showQuickUse": true,
"showQuickUse2": true,
"showSVGs": true,
"fontPref": {
"prefix": "icon-",
"metadata": {
"fontFamily": "slate",
"majorVersion": 1,
"minorVersion": 0,
"description": "Based on FontAwesome",
"license": "SIL OFL 1.1"
},
"metrics": {
"emSize": 1024,
"baseline": 6.25,
"whitespace": 50
},
"resetPoint": 58880,
"showSelector": false,
"selector": "class",
"classSelector": ".icon",
"showMetrics": false,
"showMetadata": true,
"showVersion": true,
"ie7": false
},
"imagePref": {
"prefix": "icon-",
"png": true,
"useClassSelector": true,
"color": 4473924,
"bgColor": 16777215
},
"historySize": 100,
"showCodes": true,
"gridSize": 16,
"showLiga": false
}
}

View File

@ -0,0 +1,95 @@
# -*- coding: utf-8 -*- #
# frozen_string_literal: true
# this is based on https://github.com/rouge-ruby/rouge/blob/master/lib/rouge/themes/monokai_sublime.rb
# but without the added background, and changed styling for JSON keys to be soft_yellow instead of white
module Rouge
module Themes
class MonokaiSublimeSlate < CSSTheme
name 'monokai.sublime.slate'
palette :black => '#000000'
palette :bright_green => '#a6e22e'
palette :bright_pink => '#f92672'
palette :carmine => '#960050'
palette :dark => '#49483e'
palette :dark_grey => '#888888'
palette :dark_red => '#aa0000'
palette :dimgrey => '#75715e'
palette :emperor => '#555555'
palette :grey => '#999999'
palette :light_grey => '#aaaaaa'
palette :light_violet => '#ae81ff'
palette :soft_cyan => '#66d9ef'
palette :soft_yellow => '#e6db74'
palette :very_dark => '#1e0010'
palette :whitish => '#f8f8f2'
palette :orange => '#f6aa11'
palette :white => '#ffffff'
style Generic::Heading, :fg => :grey
style Literal::String::Regex, :fg => :orange
style Generic::Output, :fg => :dark_grey
style Generic::Prompt, :fg => :emperor
style Generic::Strong, :bold => false
style Generic::Subheading, :fg => :light_grey
style Name::Builtin, :fg => :orange
style Comment::Multiline,
Comment::Preproc,
Comment::Single,
Comment::Special,
Comment, :fg => :dimgrey
style Error,
Generic::Error,
Generic::Traceback, :fg => :carmine
style Generic::Deleted,
Generic::Inserted,
Generic::Emph, :fg => :dark
style Keyword::Constant,
Keyword::Declaration,
Keyword::Reserved,
Name::Constant,
Keyword::Type, :fg => :soft_cyan
style Literal::Number::Float,
Literal::Number::Hex,
Literal::Number::Integer::Long,
Literal::Number::Integer,
Literal::Number::Oct,
Literal::Number,
Literal::String::Char,
Literal::String::Escape,
Literal::String::Symbol, :fg => :light_violet
style Literal::String::Doc,
Literal::String::Double,
Literal::String::Backtick,
Literal::String::Heredoc,
Literal::String::Interpol,
Literal::String::Other,
Literal::String::Single,
Literal::String, :fg => :soft_yellow
style Name::Attribute,
Name::Class,
Name::Decorator,
Name::Exception,
Name::Function, :fg => :bright_green
style Name::Variable::Class,
Name::Namespace,
Name::Entity,
Name::Builtin::Pseudo,
Name::Variable::Global,
Name::Variable::Instance,
Name::Variable,
Text::Whitespace,
Text,
Name, :fg => :white
style Name::Label, :fg => :bright_pink
style Operator::Word,
Name::Tag,
Keyword,
Keyword::Namespace,
Keyword::Pseudo,
Operator, :fg => :bright_pink
end
end
end

View File

@ -0,0 +1,16 @@
module Multilang
def block_code(code, full_lang_name)
if full_lang_name
parts = full_lang_name.split('--')
rouge_lang_name = (parts) ? parts[0] : "" # just parts[0] here causes null ref exception when no language specified
super(code, rouge_lang_name).sub("highlight #{rouge_lang_name}") do |match|
match + " tab-" + full_lang_name
end
else
super(code, full_lang_name)
end
end
end
require 'middleman-core/renderers/redcarpet'
Middleman::Renderers::MiddlemanRedcarpetHTML.send :include, Multilang

View File

@ -0,0 +1,22 @@
# Nested unique header generation
require 'middleman-core/renderers/redcarpet'
class NestingUniqueHeadCounter < Middleman::Renderers::MiddlemanRedcarpetHTML
def initialize
super
@@headers_history = {} if !defined?(@@headers_history)
end
def header(text, header_level)
friendly_text = text.gsub(/<[^>]*>/,"").parameterize
@@headers_history[header_level] = text.parameterize
if header_level > 1
for i in (header_level - 1).downto(1)
friendly_text.prepend("#{@@headers_history[i]}-") if @@headers_history.key?(i)
end
end
return "<h#{header_level} id='#{friendly_text}'>#{text}</h#{header_level}>"
end
end

View File

@ -0,0 +1,31 @@
require 'nokogiri'
def toc_data(page_content)
html_doc = Nokogiri::HTML::DocumentFragment.parse(page_content)
# get a flat list of headers
headers = []
html_doc.css('h1, h2, h3').each do |header|
headers.push({
id: header.attribute('id').to_s,
content: header.children,
title: header.children.to_s.gsub(/<[^>]*>/, ''),
level: header.name[1].to_i,
children: []
})
end
[3,2].each do |header_level|
header_to_nest = nil
headers = headers.reject do |header|
if header[:level] == header_level
header_to_nest[:children].push header if header_to_nest
true
else
header_to_nest = header if header[:level] < header_level
false
end
end
end
headers
end

View File

@ -0,0 +1,24 @@
# Unique header generation
require 'middleman-core/renderers/redcarpet'
require 'digest'
class UniqueHeadCounter < Middleman::Renderers::MiddlemanRedcarpetHTML
def initialize
super
@head_count = {}
end
def header(text, header_level)
friendly_text = text.gsub(/<[^>]*>/,"").parameterize
if friendly_text.strip.length == 0
# Looks like parameterize removed the whole thing! It removes many unicode
# characters like Chinese and Russian. To get a unique URL, let's just
# URI escape the whole header
friendly_text = Digest::SHA1.hexdigest(text)[0,10]
end
@head_count[friendly_text] ||= 0
@head_count[friendly_text] += 1
if @head_count[friendly_text] > 1
friendly_text += "-#{@head_count[friendly_text]}"
end
return "<h#{header_level} id='#{friendly_text}'>#{text}</h#{header_level}>"
end
end

248
docs/api/slate.sh 100755
View File

@ -0,0 +1,248 @@
#!/usr/bin/env bash
set -o errexit #abort if any command fails
me=$(basename "$0")
help_message="\
Usage: $me [<options>] <command> [<command-options>]
Run commands related to the slate process.
Commands:
serve Run the middleman server process, useful for
development.
build Run the build process.
deploy Will build and deploy files to branch. Use
--no-build to only deploy.
Global Options:
-h, --help Show this help information.
-v, --verbose Increase verbosity. Useful for debugging.
Deploy options:
-e, --allow-empty Allow deployment of an empty directory.
-m, --message MESSAGE Specify the message used when committing on the
deploy branch.
-n, --no-hash Don't append the source commit's hash to the deploy
commit's message.
--no-build Do not build the source files.
"
run_serve() {
exec bundle exec middleman serve --watcher-force-polling
}
run_build() {
bundle exec middleman build --clean
}
parse_args() {
# Set args from a local environment file.
if [ -e ".env" ]; then
source .env
fi
command=
# Parse arg flags
# If something is exposed as an environment variable, set/overwrite it
# here. Otherwise, set/overwrite the internal variable instead.
while : ; do
if [[ $1 = "-h" || $1 = "--help" ]]; then
echo "$help_message"
exit 0
elif [[ $1 = "-v" || $1 = "--verbose" ]]; then
verbose=true
shift
elif [[ $1 = "-e" || $1 = "--allow-empty" ]]; then
allow_empty=true
shift
elif [[ ( $1 = "-m" || $1 = "--message" ) && -n $2 ]]; then
commit_message=$2
shift 2
elif [[ $1 = "-n" || $1 = "--no-hash" ]]; then
GIT_DEPLOY_APPEND_HASH=false
shift
elif [[ $1 = "--no-build" ]]; then
no_build=true
shift
elif [[ $1 = "serve" || $1 = "build" || $1 = "deploy" ]]; then
if [ ! -z "${command}" ]; then
>&2 echo "You can only specify one command."
exit 1
fi
command=$1
shift
elif [ -z $1 ]; then
break
fi
done
if [ -z "${command}" ]; then
>&2 echo "Command not specified."
exit 1
fi
# Set internal option vars from the environment and arg flags. All internal
# vars should be declared here, with sane defaults if applicable.
# Source directory & target branch.
deploy_directory=build
deploy_branch=gh-pages
#if no user identity is already set in the current git environment, use this:
default_username=${GIT_DEPLOY_USERNAME:-deploy.sh}
default_email=${GIT_DEPLOY_EMAIL:-}
#repository to deploy to. must be readable and writable.
repo=origin
#append commit hash to the end of message by default
append_hash=${GIT_DEPLOY_APPEND_HASH:-true}
}
main() {
enable_expanded_output
if ! git diff --exit-code --quiet --cached; then
echo Aborting due to uncommitted changes in the index >&2
return 1
fi
commit_title=`git log -n 1 --format="%s" HEAD`
commit_hash=` git log -n 1 --format="%H" HEAD`
#default commit message uses last title if a custom one is not supplied
if [[ -z $commit_message ]]; then
commit_message="publish: $commit_title"
fi
#append hash to commit message unless no hash flag was found
if [ $append_hash = true ]; then
commit_message="$commit_message"$'\n\n'"generated from commit $commit_hash"
fi
previous_branch=`git rev-parse --abbrev-ref HEAD`
if [ ! -d "$deploy_directory" ]; then
echo "Deploy directory '$deploy_directory' does not exist. Aborting." >&2
return 1
fi
# must use short form of flag in ls for compatibility with macOS and BSD
if [[ -z `ls -A "$deploy_directory" 2> /dev/null` && -z $allow_empty ]]; then
echo "Deploy directory '$deploy_directory' is empty. Aborting. If you're sure you want to deploy an empty tree, use the --allow-empty / -e flag." >&2
return 1
fi
if git ls-remote --exit-code $repo "refs/heads/$deploy_branch" ; then
# deploy_branch exists in $repo; make sure we have the latest version
disable_expanded_output
git fetch --force $repo $deploy_branch:$deploy_branch
enable_expanded_output
fi
# check if deploy_branch exists locally
if git show-ref --verify --quiet "refs/heads/$deploy_branch"
then incremental_deploy
else initial_deploy
fi
restore_head
}
initial_deploy() {
git --work-tree "$deploy_directory" checkout --orphan $deploy_branch
git --work-tree "$deploy_directory" add --all
commit+push
}
incremental_deploy() {
#make deploy_branch the current branch
git symbolic-ref HEAD refs/heads/$deploy_branch
#put the previously committed contents of deploy_branch into the index
git --work-tree "$deploy_directory" reset --mixed --quiet
git --work-tree "$deploy_directory" add --all
set +o errexit
diff=$(git --work-tree "$deploy_directory" diff --exit-code --quiet HEAD --)$?
set -o errexit
case $diff in
0) echo No changes to files in $deploy_directory. Skipping commit.;;
1) commit+push;;
*)
echo git diff exited with code $diff. Aborting. Staying on branch $deploy_branch so you can debug. To switch back to main, use: git symbolic-ref HEAD refs/heads/main && git reset --mixed >&2
return $diff
;;
esac
}
commit+push() {
set_user_id
git --work-tree "$deploy_directory" commit -m "$commit_message"
disable_expanded_output
#--quiet is important here to avoid outputting the repo URL, which may contain a secret token
git push --quiet $repo $deploy_branch
enable_expanded_output
}
#echo expanded commands as they are executed (for debugging)
enable_expanded_output() {
if [ $verbose ]; then
set -o xtrace
set +o verbose
fi
}
#this is used to avoid outputting the repo URL, which may contain a secret token
disable_expanded_output() {
if [ $verbose ]; then
set +o xtrace
set -o verbose
fi
}
set_user_id() {
if [[ -z `git config user.name` ]]; then
git config user.name "$default_username"
fi
if [[ -z `git config user.email` ]]; then
git config user.email "$default_email"
fi
}
restore_head() {
if [[ $previous_branch = "HEAD" ]]; then
#we weren't on any branch before, so just set HEAD back to the commit it was on
git update-ref --no-deref HEAD $commit_hash $deploy_branch
else
git symbolic-ref HEAD refs/heads/$previous_branch
fi
git reset --mixed
}
filter() {
sed -e "s|$repo|\$repo|g"
}
sanitize() {
"$@" 2> >(filter 1>&2) | filter
}
parse_args "$@"
if [ "${command}" = "serve" ]; then
run_serve
elif [[ "${command}" = "build" ]]; then
run_build
elif [[ ${command} = "deploy" ]]; then
if [[ ${no_build} != true ]]; then
run_build
fi
main "$@"
fi

Binary file not shown.

View File

@ -0,0 +1,14 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by IcoMoon</metadata>
<defs>
<font id="slate" horiz-adv-x="1024">
<font-face units-per-em="1024" ascent="960" descent="-64" />
<missing-glyph horiz-adv-x="1024" />
<glyph unicode="&#x20;" d="" horiz-adv-x="512" />
<glyph unicode="&#xe600;" d="M438.857 877.714q119.429 0 220.286-58.857t159.714-159.714 58.857-220.286-58.857-220.286-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857zM512 165.143v108.571q0 8-5.143 13.429t-12.571 5.429h-109.714q-7.429 0-13.143-5.714t-5.714-13.143v-108.571q0-7.429 5.714-13.143t13.143-5.714h109.714q7.429 0 12.571 5.429t5.143 13.429zM510.857 361.714l10.286 354.857q0 6.857-5.714 10.286-5.714 4.571-13.714 4.571h-125.714q-8 0-13.714-4.571-5.714-3.429-5.714-10.286l9.714-354.857q0-5.714 5.714-10t13.714-4.286h105.714q8 0 13.429 4.286t6 10z" />
<glyph unicode="&#xe602;" d="M585.143 164.571v91.429q0 8-5.143 13.143t-13.143 5.143h-54.857v292.571q0 8-5.143 13.143t-13.143 5.143h-182.857q-8 0-13.143-5.143t-5.143-13.143v-91.429q0-8 5.143-13.143t13.143-5.143h54.857v-182.857h-54.857q-8 0-13.143-5.143t-5.143-13.143v-91.429q0-8 5.143-13.143t13.143-5.143h256q8 0 13.143 5.143t5.143 13.143zM512 676.571v91.429q0 8-5.143 13.143t-13.143 5.143h-109.714q-8 0-13.143-5.143t-5.143-13.143v-91.429q0-8 5.143-13.143t13.143-5.143h109.714q8 0 13.143 5.143t5.143 13.143zM877.714 438.857q0-119.429-58.857-220.286t-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857 220.286-58.857 159.714-159.714 58.857-220.286z" />
<glyph unicode="&#xe606;" d="M733.714 531.428q0 16-10.286 26.286l-52 51.429q-10.857 10.857-25.714 10.857t-25.714-10.857l-233.143-232.571-129.143 129.143q-10.857 10.857-25.714 10.857t-25.714-10.857l-52-51.429q-10.286-10.286-10.286-26.286 0-15.429 10.286-25.714l206.857-206.857q10.857-10.857 25.714-10.857 15.429 0 26.286 10.857l310.286 310.286q10.286 10.286 10.286 25.714zM877.714 438.857q0-119.429-58.857-220.286t-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857 220.286-58.857 159.714-159.714 58.857-220.286z" />
<glyph unicode="&#xe607;" d="M658.286 475.428q0 105.714-75.143 180.857t-180.857 75.143-180.857-75.143-75.143-180.857 75.143-180.857 180.857-75.143 180.857 75.143 75.143 180.857zM950.857 0q0-29.714-21.714-51.429t-51.429-21.714q-30.857 0-51.429 21.714l-196 195.429q-102.286-70.857-228-70.857-81.714 0-156.286 31.714t-128.571 85.714-85.714 128.571-31.714 156.286 31.714 156.286 85.714 128.571 128.571 85.714 156.286 31.714 156.286-31.714 128.571-85.714 85.714-128.571 31.714-156.286q0-125.714-70.857-228l196-196q21.143-21.143 21.143-51.429z" horiz-adv-x="951" />
</font></defs></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

View File

@ -0,0 +1,78 @@
# Jobs
<aside class="notice">
All routes in this section require authentication.
</aside>
## Manually schedule a job
```shell
curl \
-H 'X-Api-Key: secret' \
https://example.com/api/v1/jobs/queue?target=10&force&arch=x86_64
```
Manually schedule a job on the server.
### HTTP Request
`POST /api/v1/jobs/queue`
### Query Parameters
Parameter | Description
--------- | -----------
target | Id of target to schedule build for
arch | Architecture to build on
force | Whether it's a forced build (true if present)
## Poll for new jobs
<aside class="warning">
This endpoint is used by the agents and should not be used manually. It's just
here for completeness. Requests to this endpoint modify the build queue,
meaning manual requests can cause builds to be skipped.
</aside>
```shell
curl \
-H 'X-Api-Key: secret' \
https://example.com/api/v1/jobs/poll?arch=x86_64&max=2
```
> JSON output format
```json
{
"message": "",
"data": [
{
"target_id": 1,
"kind": "git",
"url": "https://aur.archlinux.org/discord-ptb.git",
"branch": "master",
"path": "",
"repo": "bur",
"base_image": "archlinux:base-devel",
"force": true
}
]
}
```
Poll the server for new builds.
### HTTP Request
`GET /api/v1/jobs/poll`
### Query Parameters
Parameter | Description
--------- | -----------
arch | For which architecture to receive jobs
max | How many jobs to receive at most

View File

@ -0,0 +1,172 @@
# Build Logs
<aside class="notice">
All routes in this section require authentication.
</aside>
Endpoints for interacting with stored build logs.
## List logs
```shell
curl \
-H 'X-Api-Key: secret' \
https://example.com/api/v1/logs?offset=10&limit=20
```
> JSON output format
```json
{
"message": "",
"data": [
{
"id": 1,
"target_id": 3,
"start_time": 1652008554,
"end_time": 1652008559,
"arch": "x86_64",
"exit_code": 0
}
]
}
```
Retrieve a list of build logs.
### HTTP Request
`GET /api/v1/logs`
### Query Parameters
Parameter | Description
--------- | -----------
limit | Maximum amount of results to return.
offset | Offset of results.
target | Only return builds for this target id.
before | Only return logs started before this time (UTC epoch)
after | Only return logs started after this time (UTC epoch)
arch | Only return logs built on this architecture
exit_codes | Comma-separated list of exit codes to limit result to; using `!` as a prefix makes it exclude that value. For example, `1,2` only returns logs with status code 1 or 2, while `!1,!2` returns those that don't have 1 or 2 as the result.
## Get build log
```shell
curl \
-H 'X-Api-Key: secret' \
https://example.com/api/v1/logs/1
```
> JSON output format
```json
{
"message": "",
"data": {
"id": 1,
"target_id": 3,
"start_time": 1652008554,
"end_time": 1652008559,
"arch": "x86_64",
"exit_code": 0
}
}
```
Retrieve info about a specific build log.
### HTTP Request
`GET /api/v1/logs/:id`
### URL Parameters
Parameter | Description
--------- | -----------
id | ID of requested log
## Get log contents
```shell
curl \
-H 'X-Api-Key: secret' \
https://example.com/api/v1/logs/15/content
```
Retrieve the contents of a build log. The response is the build log in
plaintext.
### HTTP Request
`GET /api/v1/logs/:id/content`
### URL Parameters
Parameter | Description
--------- | -----------
id | ID of requested log
## Publish build log
> JSON output format
```json
{
"message": "",
"data": {
"id": 15
}
}
```
<aside class="warning">
This endpoint is used by the agents and should not be used manually unless you
know what you're doing. It's just here for completeness.
</aside>
Publish a new build log to the server.
### HTTP Request
`POST /api/v1/logs`
### Query parameters
Parameter | Description
--------- | -----------
startTime | Start time of the build (UTC epoch)
endTime | End time of the build (UTC epoch)
arch | Architecture on which the build was done
exitCode | Exit code of the build container
target | id of target this build is for
### Request body
Plaintext contents of the build log.
## Remove a build log
```shell
curl \
-XDELETE \
-H 'X-Api-Key: secret' \
https://example.com/api/v1/logs/1
```
Remove a build log from the server.
### HTTP Request
`DELETE /api/v1/logs/:id`
### URL Parameters
Parameter | Description
--------- | -----------
id | id of log to remove

View File

@ -0,0 +1,179 @@
# Repository
Besides providing a RESTful API, the Vieter server is also a Pacman-compatible
repository server. This section describes the various routes that make this
possible.
## Get a package archive or database file
```shell
curl -L https://example.com/bur/x86_64/tuxedo-keyboard-3.0.10-1-x86_64.pkg.tar.zst
```
This endpoint is really the entire repository. It serves both the package
archives & the database files for a specific arch-repo. It has three different
behaviors, depending on `filename`:
* If the file extension is one of `.db`, `.files`, `.db.tar.gz` or
`.files.tar.gz`, it tries to serve the requested database file.
* If the filename contains `.pkg`, it serves the package file.
* Otherwise, it assumes `filename` is the name & version of a package inside
the repository (e.g. `vieter-0.3.0_alpha.2-1`) & serves that package's `desc`
file from inside the database archive.
<aside class="notice">
The final option might sound a little strange, but it's used by the build
system to determine whether a package needs to be rebuilt.
</aside>
### HTTP Request
`GET /:repo/:arch/:filename`
### URL Parameters
Parameter | Description
--------- | -----------
repo | Repository containing the package
arch | Arch-repo containing the package
filename | actual filename to request
## Check whether file exists
```shell
curl -L https://example.com/bur/x86_64/tuxedo-keyboard-3.0.10-1-x86_64.pkg.tar.zst
```
The above request can also be performed as a HEAD request. The behavior is the
same, except no data is returned besides an error 404 if the file doesn't exist
& an error 200 otherwise.
### HTTP Request
`GET /:repo/:arch/:filename`
### URL Parameters
Parameter | Description
--------- | -----------
repo | Repository containing the package
arch | Arch-repo containing the package
filename | actual filename to request
## Publish package
<aside class="notice">
This endpoint requests authentication.
</aside>
```shell
curl \
-H 'X-Api-Key: secret' \
-XPOST \
-T tuxedo-keyboard-3.0.10-1-x86_64.pkg.tar.zst \
https://example.com/some-repo/publish
```
This endpoint allows you to publish a new package archive to a given repo.
If the package's architecture is not `any`, it is added to that specific
arch-repo. Otherwise, it is added to the configured default architecture & any
other already present arch-repos.
### HTTP Request
`POST /:repo/publish`
### URL Parameters
Parameter | Description
--------- | -----------
repo | Repository to publish package to
## Remove package from arch-repo
<aside class="notice">
This endpoint requests authentication.
</aside>
```shell
curl \
-H 'X-Api-Key: secret' \
-XDELETE \
https://example.com/vieter/x86_64/mike
```
This endpoint allows you to remove a package from a given arch-repo.
### HTTP Request
`DELETE /:repo/:arch/:pkg`
### URL Parameters
Parameter | Description
--------- | -----------
repo | Repository to delete package from
arch | Specific arch-repo to remove package from
pkg | Name of package to remove (without any version information)
## Remove arch-repo
<aside class="notice">
This endpoint requests authentication.
</aside>
```shell
curl \
-H 'X-Api-Key: secret' \
-XDELETE \
https://example.com/vieter/x86_64
```
This endpoint allows removing an entire arch-repo.
### HTTP Request
`DELETE /:repo/:arch`
### URL Parameters
Parameter | Description
--------- | -----------
repo | Repository to delete arch-repo from
arch | Specific architecture to remove
## Remove repo
<aside class="notice">
This endpoint requests authentication.
</aside>
```shell
curl \
-H 'X-Api-Key: secret' \
-XDELETE \
https://example.com/vieter
```
This endpoint allows removing an entire repo.
### HTTP Request
`DELETE /:repo`
### URL Parameters
Parameter | Description
--------- | -----------
repo | Repository to delete

View File

@ -0,0 +1,181 @@
# Targets
<aside class="notice">
All routes in this section require authentication.
</aside>
Endpoints for interacting with the list of targets stored on the server.
## List targets
```shell
curl \
-H 'X-Api-Key: secret' \
https://example.com/api/v1/targets?offset=10&limit=20
```
> JSON output format
```json
{
"message": "",
"data": [
{
"id": 1,
"kind": "git",
"url": "https://aur.archlinux.org/discord-ptb.git",
"branch": "master",
"path" : "",
"repo": "bur",
"schedule": "",
"arch": [
{
"id": 1,
"target_id": 1,
"value": "x86_64"
}
]
}
]
}
```
Retrieve a list of targets.
### HTTP Request
`GET /api/v1/targets`
### Query Parameters
Parameter | Description
--------- | -----------
limit | Maximum amount of results to return.
offset | Offset of results.
repo | Limit results to targets that publish to the given repo.
query | Only return targets that have this substring in their URL, path or branch.
arch | Only return targets that publish to this arch.
## Get specific target
```shell
curl \
-H 'X-Api-Key: secret' \
https://example.com/api/v1/targets/1
```
> JSON output format
```json
{
"message": "",
"data": {
"id": 1,
"kind": "git",
"url": "https://aur.archlinux.org/discord-ptb.git",
"branch": "master",
"path": "",
"repo": "bur",
"schedule": "0 2",
"arch": [
{
"id": 1,
"target_id": 1,
"value": "x86_64"
}
]
}
}
```
Get info about a specific target.
### HTTP Request
`GET /api/v1/targets/:id`
### URL Parameters
Parameter | Description
--------- | -----------
id | id of requested target
## Create a new target
> JSON output format
```json
{
"message": "",
"data": {
"id": 15
}
}
```
Create a new target with the given data.
### HTTP Request
`POST /api/v1/targets`
### Query Parameters
Parameter | Description
--------- | -----------
kind | Kind of target to add; one of 'git', 'url'.
url | URL of the Git repository.
branch | Branch of the Git repository.
path | Subdirectory inside Git repository to use.
repo | Vieter repository to publish built packages to.
schedule | Cron build schedule (syntax explained [here](https://rustybever.be/docs/vieter/usage/builds/schedule/))
arch | Comma-separated list of architectures to build package on.
## Modify a target
Modify the data of an existing target.
### HTTP Request
`PATCH /api/v1/targets/:id`
### URL Parameters
Parameter | Description
--------- | -----------
id | id of target to modify
### Query Parameters
Parameter | Description
--------- | -----------
kind | Kind of target; one of 'git', 'url'.
url | URL of the Git repository.
branch | Branch of the Git repository.
path | Subdirectory inside Git repository to use.
repo | Vieter repository to publish built packages to.
schedule | Cron build schedule
arch | Comma-separated list of architectures to build package on.
## Remove a target
```shell
curl \
-XDELETE \
-H 'X-Api-Key: secret' \
https://example.com/api/v1/targets/1
```
Remove a target from the server.
### HTTP Request
`DELETE /api/v1/targets/:id`
### URL Parameters
Parameter | Description
--------- | -----------
id | id of target to remove

View File

@ -0,0 +1,40 @@
---
title: API Reference
language_tabs: # must be one of https://git.io/vQNgJ
- shell: cURL
toc_footers:
- <a href='https://github.com/slatedocs/slate'>Documentation Powered by Slate</a>
includes:
- repository
- targets
- logs
- jobs
search: true
code_clipboard: true
meta:
- name: description
content: Documentation for the Vieter API
---
# Introduction
Welcome to the Vieter API documentation! Here, you can find everything related
to interacting with Vieter's HTTP API.
# Authentication
```shell
curl -H 'X-Api-Key: secret' https://example.com/api/some/path
```
> Don't forget to replace `secret` with your Vieter instance's secret.
Authentication is done by passing the HTTP header `X-Api-Key: secret` along
with each request, where `secret` is replaced with your Vieter server's
configured secret.

View File

@ -0,0 +1,2 @@
//= require ./all_nosearch
//= require ./app/_search

View File

@ -0,0 +1,27 @@
//= require ./lib/_energize
//= require ./app/_copy
//= require ./app/_toc
//= require ./app/_lang
function adjustLanguageSelectorWidth() {
const elem = $('.dark-box > .lang-selector');
elem.width(elem.parent().width());
}
$(function() {
loadToc($('#toc'), '.toc-link', '.toc-list-h2', 10);
setupLanguages($('body').data('languages'));
$('.content').imagesLoaded( function() {
window.recacheHeights();
window.refreshToc();
});
$(window).resize(function() {
adjustLanguageSelectorWidth();
});
adjustLanguageSelectorWidth();
});
window.onpopstate = function() {
activateLanguage(getLanguageFromQueryString());
};

View File

@ -0,0 +1,15 @@
function copyToClipboard(container) {
const el = document.createElement('textarea');
el.value = container.textContent.replace(/\n$/, '');
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
}
function setupCodeCopy() {
$('pre.highlight').prepend('<div class="copy-clipboard"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>Copy to Clipboard</title><path d="M18 6v-6h-18v18h6v6h18v-18h-6zm-12 10h-4v-14h14v4h-10v10zm16 6h-14v-14h14v14z"></path></svg></div>');
$('.copy-clipboard').on('click', function() {
copyToClipboard(this.parentNode.children[1]);
});
}

View File

@ -0,0 +1,171 @@
//= require ../lib/_jquery
/*
Copyright 2008-2013 Concur Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
*/
;(function () {
'use strict';
var languages = [];
window.setupLanguages = setupLanguages;
window.activateLanguage = activateLanguage;
window.getLanguageFromQueryString = getLanguageFromQueryString;
function activateLanguage(language) {
if (!language) return;
if (language === "") return;
$(".lang-selector a").removeClass('active');
$(".lang-selector a[data-language-name='" + language + "']").addClass('active');
for (var i=0; i < languages.length; i++) {
$(".highlight.tab-" + languages[i]).hide();
$(".lang-specific." + languages[i]).hide();
}
$(".highlight.tab-" + language).show();
$(".lang-specific." + language).show();
window.recacheHeights();
// scroll to the new location of the position
if ($(window.location.hash).get(0)) {
$(window.location.hash).get(0).scrollIntoView(true);
}
}
// parseURL and stringifyURL are from https://github.com/sindresorhus/query-string
// MIT licensed
// https://github.com/sindresorhus/query-string/blob/7bee64c16f2da1a326579e96977b9227bf6da9e6/license
function parseURL(str) {
if (typeof str !== 'string') {
return {};
}
str = str.trim().replace(/^(\?|#|&)/, '');
if (!str) {
return {};
}
return str.split('&').reduce(function (ret, param) {
var parts = param.replace(/\+/g, ' ').split('=');
var key = parts[0];
var val = parts[1];
key = decodeURIComponent(key);
// missing `=` should be `null`:
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
val = val === undefined ? null : decodeURIComponent(val);
if (!ret.hasOwnProperty(key)) {
ret[key] = val;
} else if (Array.isArray(ret[key])) {
ret[key].push(val);
} else {
ret[key] = [ret[key], val];
}
return ret;
}, {});
};
function stringifyURL(obj) {
return obj ? Object.keys(obj).sort().map(function (key) {
var val = obj[key];
if (Array.isArray(val)) {
return val.sort().map(function (val2) {
return encodeURIComponent(key) + '=' + encodeURIComponent(val2);
}).join('&');
}
return encodeURIComponent(key) + '=' + encodeURIComponent(val);
}).join('&') : '';
};
// gets the language set in the query string
function getLanguageFromQueryString() {
if (location.search.length >= 1) {
var language = parseURL(location.search).language;
if (language) {
return language;
} else if (jQuery.inArray(location.search.substr(1), languages) != -1) {
return location.search.substr(1);
}
}
return false;
}
// returns a new query string with the new language in it
function generateNewQueryString(language) {
var url = parseURL(location.search);
if (url.language) {
url.language = language;
return stringifyURL(url);
}
return language;
}
// if a button is clicked, add the state to the history
function pushURL(language) {
if (!history) { return; }
var hash = window.location.hash;
if (hash) {
hash = hash.replace(/^#+/, '');
}
history.pushState({}, '', '?' + generateNewQueryString(language) + '#' + hash);
// save language as next default
if (localStorage) {
localStorage.setItem("language", language);
}
}
function setupLanguages(l) {
var defaultLanguage = null;
if (localStorage) {
defaultLanguage = localStorage.getItem("language");
}
languages = l;
var presetLanguage = getLanguageFromQueryString();
if (presetLanguage) {
// the language is in the URL, so use that language!
activateLanguage(presetLanguage);
if (localStorage) {
localStorage.setItem("language", presetLanguage);
}
} else if ((defaultLanguage !== null) && (jQuery.inArray(defaultLanguage, languages) != -1)) {
// the language was the last selected one saved in localstorage, so use that language!
activateLanguage(defaultLanguage);
} else {
// no language selected, so use the default
activateLanguage(languages[0]);
}
}
// if we click on a language tab, activate that language
$(function() {
$(".lang-selector a").on("click", function() {
var language = $(this).data("language-name");
pushURL(language);
activateLanguage(language);
return false;
});
});
})();

View File

@ -0,0 +1,102 @@
//= require ../lib/_lunr
//= require ../lib/_jquery
//= require ../lib/_jquery.highlight
;(function () {
'use strict';
var content, searchResults;
var highlightOpts = { element: 'span', className: 'search-highlight' };
var searchDelay = 0;
var timeoutHandle = 0;
var index;
function populate() {
index = lunr(function(){
this.ref('id');
this.field('title', { boost: 10 });
this.field('body');
this.pipeline.add(lunr.trimmer, lunr.stopWordFilter);
var lunrConfig = this;
$('h1, h2').each(function() {
var title = $(this);
var body = title.nextUntil('h1, h2');
lunrConfig.add({
id: title.prop('id'),
title: title.text(),
body: body.text()
});
});
});
determineSearchDelay();
}
$(populate);
$(bind);
function determineSearchDelay() {
if (index.tokenSet.toArray().length>5000) {
searchDelay = 300;
}
}
function bind() {
content = $('.content');
searchResults = $('.search-results');
$('#input-search').on('keyup',function(e) {
var wait = function() {
return function(executingFunction, waitTime){
clearTimeout(timeoutHandle);
timeoutHandle = setTimeout(executingFunction, waitTime);
};
}();
wait(function(){
search(e);
}, searchDelay);
});
}
function search(event) {
var searchInput = $('#input-search')[0];
unhighlight();
searchResults.addClass('visible');
// ESC clears the field
if (event.keyCode === 27) searchInput.value = '';
if (searchInput.value) {
var results = index.search(searchInput.value).filter(function(r) {
return r.score > 0.0001;
});
if (results.length) {
searchResults.empty();
$.each(results, function (index, result) {
var elem = document.getElementById(result.ref);
searchResults.append("<li><a href='#" + result.ref + "'>" + $(elem).text() + "</a></li>");
});
highlight.call(searchInput);
} else {
searchResults.html('<li></li>');
$('.search-results li').text('No Results Found for "' + searchInput.value + '"');
}
} else {
unhighlight();
searchResults.removeClass('visible');
}
}
function highlight() {
if (this.value) content.highlight(this.value, highlightOpts);
}
function unhighlight() {
content.unhighlight(highlightOpts);
}
})();

View File

@ -0,0 +1,122 @@
//= require ../lib/_jquery
//= require ../lib/_imagesloaded.min
;(function () {
'use strict';
var htmlPattern = /<[^>]*>/g;
var loaded = false;
var debounce = function(func, waitTime) {
var timeout = false;
return function() {
if (timeout === false) {
setTimeout(function() {
func();
timeout = false;
}, waitTime);
timeout = true;
}
};
};
var closeToc = function() {
$(".toc-wrapper").removeClass('open');
$("#nav-button").removeClass('open');
};
function loadToc($toc, tocLinkSelector, tocListSelector, scrollOffset) {
var headerHeights = {};
var pageHeight = 0;
var windowHeight = 0;
var originalTitle = document.title;
var recacheHeights = function() {
headerHeights = {};
pageHeight = $(document).height();
windowHeight = $(window).height();
$toc.find(tocLinkSelector).each(function() {
var targetId = $(this).attr('href');
if (targetId[0] === "#") {
headerHeights[targetId] = $("#" + $.escapeSelector(targetId.substring(1))).offset().top;
}
});
};
var refreshToc = function() {
var currentTop = $(document).scrollTop() + scrollOffset;
if (currentTop + windowHeight >= pageHeight) {
// at bottom of page, so just select last header by making currentTop very large
// this fixes the problem where the last header won't ever show as active if its content
// is shorter than the window height
currentTop = pageHeight + 1000;
}
var best = null;
for (var name in headerHeights) {
if ((headerHeights[name] < currentTop && headerHeights[name] > headerHeights[best]) || best === null) {
best = name;
}
}
// Catch the initial load case
if (currentTop == scrollOffset && !loaded) {
best = window.location.hash;
loaded = true;
}
var $best = $toc.find("[href='" + best + "']").first();
if (!$best.hasClass("active")) {
// .active is applied to the ToC link we're currently on, and its parent <ul>s selected by tocListSelector
// .active-expanded is applied to the ToC links that are parents of this one
$toc.find(".active").removeClass("active");
$toc.find(".active-parent").removeClass("active-parent");
$best.addClass("active");
$best.parents(tocListSelector).addClass("active").siblings(tocLinkSelector).addClass('active-parent');
$best.siblings(tocListSelector).addClass("active");
$toc.find(tocListSelector).filter(":not(.active)").slideUp(150);
$toc.find(tocListSelector).filter(".active").slideDown(150);
if (window.history.replaceState) {
window.history.replaceState(null, "", best);
}
var thisTitle = $best.data("title");
if (thisTitle !== undefined && thisTitle.length > 0) {
document.title = thisTitle.replace(htmlPattern, "") + " " + originalTitle;
} else {
document.title = originalTitle;
}
}
};
var makeToc = function() {
recacheHeights();
refreshToc();
$("#nav-button").click(function() {
$(".toc-wrapper").toggleClass('open');
$("#nav-button").toggleClass('open');
return false;
});
$(".page-wrapper").click(closeToc);
$(".toc-link").click(closeToc);
// reload immediately after scrolling on toc click
$toc.find(tocLinkSelector).click(function() {
setTimeout(function() {
refreshToc();
}, 0);
});
$(window).scroll(debounce(refreshToc, 200));
$(window).resize(debounce(recacheHeights, 200));
};
makeToc();
window.recacheHeights = recacheHeights;
window.refreshToc = refreshToc;
}
window.loadToc = loadToc;
})();

View File

@ -0,0 +1,169 @@
/**
* energize.js v0.1.0
*
* Speeds up click events on mobile devices.
* https://github.com/davidcalhoun/energize.js
*/
(function() { // Sandbox
/**
* Don't add to non-touch devices, which don't need to be sped up
*/
if(!('ontouchstart' in window)) return;
var lastClick = {},
isThresholdReached, touchstart, touchmove, touchend,
click, closest;
/**
* isThresholdReached
*
* Compare touchstart with touchend xy coordinates,
* and only fire simulated click event if the coordinates
* are nearby. (don't want clicking to be confused with a swipe)
*/
isThresholdReached = function(startXY, xy) {
return Math.abs(startXY[0] - xy[0]) > 5 || Math.abs(startXY[1] - xy[1]) > 5;
};
/**
* touchstart
*
* Save xy coordinates when the user starts touching the screen
*/
touchstart = function(e) {
this.startXY = [e.touches[0].clientX, e.touches[0].clientY];
this.threshold = false;
};
/**
* touchmove
*
* Check if the user is scrolling past the threshold.
* Have to check here because touchend will not always fire
* on some tested devices (Kindle Fire?)
*/
touchmove = function(e) {
// NOOP if the threshold has already been reached
if(this.threshold) return false;
this.threshold = isThresholdReached(this.startXY, [e.touches[0].clientX, e.touches[0].clientY]);
};
/**
* touchend
*
* If the user didn't scroll past the threshold between
* touchstart and touchend, fire a simulated click.
*
* (This will fire before a native click)
*/
touchend = function(e) {
// Don't fire a click if the user scrolled past the threshold
if(this.threshold || isThresholdReached(this.startXY, [e.changedTouches[0].clientX, e.changedTouches[0].clientY])) {
return;
}
/**
* Create and fire a click event on the target element
* https://developer.mozilla.org/en/DOM/event.initMouseEvent
*/
var touch = e.changedTouches[0],
evt = document.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, window, 0, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);
evt.simulated = true; // distinguish from a normal (nonsimulated) click
e.target.dispatchEvent(evt);
};
/**
* click
*
* Because we've already fired a click event in touchend,
* we need to listed for all native click events here
* and suppress them as necessary.
*/
click = function(e) {
/**
* Prevent ghost clicks by only allowing clicks we created
* in the click event we fired (look for e.simulated)
*/
var time = Date.now(),
timeDiff = time - lastClick.time,
x = e.clientX,
y = e.clientY,
xyDiff = [Math.abs(lastClick.x - x), Math.abs(lastClick.y - y)],
target = closest(e.target, 'A') || e.target, // needed for standalone apps
nodeName = target.nodeName,
isLink = nodeName === 'A',
standAlone = window.navigator.standalone && isLink && e.target.getAttribute("href");
lastClick.time = time;
lastClick.x = x;
lastClick.y = y;
/**
* Unfortunately Android sometimes fires click events without touch events (seen on Kindle Fire),
* so we have to add more logic to determine the time of the last click. Not perfect...
*
* Older, simpler check: if((!e.simulated) || standAlone)
*/
if((!e.simulated && (timeDiff < 500 || (timeDiff < 1500 && xyDiff[0] < 50 && xyDiff[1] < 50))) || standAlone) {
e.preventDefault();
e.stopPropagation();
if(!standAlone) return false;
}
/**
* Special logic for standalone web apps
* See http://stackoverflow.com/questions/2898740/iphone-safari-web-app-opens-links-in-new-window
*/
if(standAlone) {
window.location = target.getAttribute("href");
}
/**
* Add an energize-focus class to the targeted link (mimics :focus behavior)
* TODO: test and/or remove? Does this work?
*/
if(!target || !target.classList) return;
target.classList.add("energize-focus");
window.setTimeout(function(){
target.classList.remove("energize-focus");
}, 150);
};
/**
* closest
* @param {HTMLElement} node current node to start searching from.
* @param {string} tagName the (uppercase) name of the tag you're looking for.
*
* Find the closest ancestor tag of a given node.
*
* Starts at node and goes up the DOM tree looking for a
* matching nodeName, continuing until hitting document.body
*/
closest = function(node, tagName){
var curNode = node;
while(curNode !== document.body) { // go up the dom until we find the tag we're after
if(!curNode || curNode.nodeName === tagName) { return curNode; } // found
curNode = curNode.parentNode; // not found, so keep going up
}
return null; // not found
};
/**
* Add all delegated event listeners
*
* All the events we care about bubble up to document,
* so we can take advantage of event delegation.
*
* Note: no need to wait for DOMContentLoaded here
*/
document.addEventListener('touchstart', touchstart, false);
document.addEventListener('touchmove', touchmove, false);
document.addEventListener('touchend', touchend, false);
document.addEventListener('click', click, true); // TODO: why does this use capture?
})();

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,108 @@
/*
* jQuery Highlight plugin
*
* Based on highlight v3 by Johann Burkard
* http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html
*
* Code a little bit refactored and cleaned (in my humble opinion).
* Most important changes:
* - has an option to highlight only entire words (wordsOnly - false by default),
* - has an option to be case sensitive (caseSensitive - false by default)
* - highlight element tag and class names can be specified in options
*
* Usage:
* // wrap every occurrance of text 'lorem' in content
* // with <span class='highlight'> (default options)
* $('#content').highlight('lorem');
*
* // search for and highlight more terms at once
* // so you can save some time on traversing DOM
* $('#content').highlight(['lorem', 'ipsum']);
* $('#content').highlight('lorem ipsum');
*
* // search only for entire word 'lorem'
* $('#content').highlight('lorem', { wordsOnly: true });
*
* // don't ignore case during search of term 'lorem'
* $('#content').highlight('lorem', { caseSensitive: true });
*
* // wrap every occurrance of term 'ipsum' in content
* // with <em class='important'>
* $('#content').highlight('ipsum', { element: 'em', className: 'important' });
*
* // remove default highlight
* $('#content').unhighlight();
*
* // remove custom highlight
* $('#content').unhighlight({ element: 'em', className: 'important' });
*
*
* Copyright (c) 2009 Bartek Szopka
*
* Licensed under MIT license.
*
*/
jQuery.extend({
highlight: function (node, re, nodeName, className) {
if (node.nodeType === 3) {
var match = node.data.match(re);
if (match) {
var highlight = document.createElement(nodeName || 'span');
highlight.className = className || 'highlight';
var wordNode = node.splitText(match.index);
wordNode.splitText(match[0].length);
var wordClone = wordNode.cloneNode(true);
highlight.appendChild(wordClone);
wordNode.parentNode.replaceChild(highlight, wordNode);
return 1; //skip added node in parent
}
} else if ((node.nodeType === 1 && node.childNodes) && // only element nodes that have children
!/(script|style)/i.test(node.tagName) && // ignore script and style nodes
!(node.tagName === nodeName.toUpperCase() && node.className === className)) { // skip if already highlighted
for (var i = 0; i < node.childNodes.length; i++) {
i += jQuery.highlight(node.childNodes[i], re, nodeName, className);
}
}
return 0;
}
});
jQuery.fn.unhighlight = function (options) {
var settings = { className: 'highlight', element: 'span' };
jQuery.extend(settings, options);
return this.find(settings.element + "." + settings.className).each(function () {
var parent = this.parentNode;
parent.replaceChild(this.firstChild, this);
parent.normalize();
}).end();
};
jQuery.fn.highlight = function (words, options) {
var settings = { className: 'highlight', element: 'span', caseSensitive: false, wordsOnly: false };
jQuery.extend(settings, options);
if (words.constructor === String) {
words = [words];
}
words = jQuery.grep(words, function(word, i){
return word != '';
});
words = jQuery.map(words, function(word, i) {
return word.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
});
if (words.length == 0) { return this; };
var flag = settings.caseSensitive ? "" : "i";
var pattern = "(" + words.join("|") + ")";
if (settings.wordsOnly) {
pattern = "\\b" + pattern + "\\b";
}
var re = new RegExp(pattern, flag);
return this.each(function () {
jQuery.highlight(this, re, settings.element, settings.className);
});
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,137 @@
<%#
Copyright 2008-2013 Concur Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
%>
<% language_tabs = current_page.data.language_tabs || [] %>
<% page_content = yield %>
<%
if current_page.data.includes
current_page.data.includes.each do |include|
page_content += partial("includes/#{include}")
end
end
%>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<% if current_page.data.key?('meta') %>
<% current_page.data.meta.each do |meta| %>
<meta
<% meta.each do |key, value| %>
<%= "#{key}=\"#{value}\"" %>
<% end %>
>
<% end %>
<% end %>
<title><%= current_page.data.title || "API Documentation" %></title>
<style media="screen">
<%= Rouge::Themes::MonokaiSublimeSlate.render(:scope => '.highlight') %>
</style>
<style media="print">
* {
transition:none!important;
}
<%= Rouge::Themes::Base16::Solarized.render(:scope => '.highlight') %>
</style>
<%= stylesheet_link_tag :screen, media: :screen %>
<%= stylesheet_link_tag :print, media: :print %>
<% if current_page.data.search %>
<%= javascript_include_tag "all" %>
<% else %>
<%= javascript_include_tag "all_nosearch" %>
<% end %>
<% if current_page.data.code_clipboard %>
<script>
$(function() { setupCodeCopy(); });
</script>
<% end %>
</head>
<body class="<%= page_classes %>" data-languages="<%=h language_tabs.map{ |lang| lang.is_a?(Hash) ? lang.keys.first : lang }.to_json %>">
<a href="#" id="nav-button">
<span>
NAV
<%= image_tag('navbar.png') %>
</span>
</a>
<div class="toc-wrapper">
<%= image_tag "logo.png", class: 'logo' %>
<% if language_tabs.any? %>
<div class="lang-selector">
<% language_tabs.each do |lang| %>
<% if lang.is_a? Hash %>
<a href="#" data-language-name="<%= lang.keys.first %>"><%= lang.values.first %></a>
<% else %>
<a href="#" data-language-name="<%= lang %>"><%= lang %></a>
<% end %>
<% end %>
</div>
<% end %>
<% if current_page.data.search %>
<div class="search">
<input type="text" class="search" id="input-search" placeholder="Search">
</div>
<ul class="search-results"></ul>
<% end %>
<ul id="toc" class="toc-list-h1">
<% toc_data(page_content).each do |h1| %>
<li>
<a href="#<%= h1[:id] %>" class="toc-h1 toc-link" data-title="<%= h1[:title] %>"><%= h1[:content] %></a>
<% if h1[:children].length > 0 %>
<ul class="toc-list-h2">
<% h1[:children].each do |h2| %>
<li>
<a href="#<%= h2[:id] %>" class="toc-h2 toc-link" data-title="<%= h2[:title] %>"><%= h2[:content] %></a>
</li>
<% end %>
</ul>
<% end %>
</li>
<% end %>
</ul>
<% if current_page.data.toc_footers %>
<ul class="toc-footer">
<% current_page.data.toc_footers.each do |footer| %>
<li><%= footer %></li>
<% end %>
</ul>
<% end %>
</div>
<div class="page-wrapper">
<div class="dark-box"></div>
<div class="content">
<%= page_content %>
</div>
<div class="dark-box">
<% if language_tabs.any? %>
<div class="lang-selector">
<% language_tabs.each do |lang| %>
<% if lang.is_a? Hash %>
<a href="#" data-language-name="<%= lang.keys.first %>"><%= lang.values.first %></a>
<% else %>
<a href="#" data-language-name="<%= lang %>"><%= lang %></a>
<% end %>
<% end %>
</div>
<% end %>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,38 @@
@font-face {
font-family: 'slate';
src:font-url('slate.eot?-syv14m');
src:font-url('slate.eot?#iefix-syv14m') format('embedded-opentype'),
font-url('slate.woff2?-syv14m') format('woff2'),
font-url('slate.woff?-syv14m') format('woff'),
font-url('slate.ttf?-syv14m') format('truetype'),
font-url('slate.svg?-syv14m#slate') format('svg');
font-weight: normal;
font-style: normal;
}
%icon {
font-family: 'slate';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
}
%icon-exclamation-sign {
@extend %icon;
content: "\e600";
}
%icon-info-sign {
@extend %icon;
content: "\e602";
}
%icon-ok-sign {
@extend %icon;
content: "\e606";
}
%icon-search {
@extend %icon;
content: "\e607";
}

View File

@ -0,0 +1,427 @@
/*! normalize.css v3.0.2 | MIT License | git.io/normalize */
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* user zoom.
*/
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove default margin.
*/
body {
margin: 0;
}
/* HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined for any HTML5 element in IE 8/9.
* Correct `block` display not defined for `details` or `summary` in IE 10/11
* and Firefox.
* Correct `block` display not defined for `main` in IE 11.
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: block;
}
/**
* 1. Correct `inline-block` display not defined in IE 8/9.
* 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
*/
audio,
canvas,
progress,
video {
display: inline-block; /* 1 */
vertical-align: baseline; /* 2 */
}
/**
* Prevent modern browsers from displaying `audio` without controls.
* Remove excess height in iOS 5 devices.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Address `[hidden]` styling not present in IE 8/9/10.
* Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.
*/
[hidden],
template {
display: none;
}
/* Links
========================================================================== */
/**
* Remove the gray background color from active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* Improve readability when focused and also mouse hovered in all browsers.
*/
a:active,
a:hover {
outline: 0;
}
/* Text-level semantics
========================================================================== */
/**
* Address styling not present in IE 8/9/10/11, Safari, and Chrome.
*/
abbr[title] {
border-bottom: 1px dotted;
}
/**
* Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
*/
b,
strong {
font-weight: bold;
}
/**
* Address styling not present in Safari and Chrome.
*/
dfn {
font-style: italic;
}
/**
* Address variable `h1` font-size and margin within `section` and `article`
* contexts in Firefox 4+, Safari, and Chrome.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/**
* Address styling not present in IE 8/9.
*/
mark {
background: #ff0;
color: #000;
}
/**
* Address inconsistent and variable font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* Embedded content
========================================================================== */
/**
* Remove border when inside `a` element in IE 8/9/10.
*/
img {
border: 0;
}
/**
* Correct overflow not hidden in IE 9/10/11.
*/
svg:not(:root) {
overflow: hidden;
}
/* Grouping content
========================================================================== */
/**
* Address margin not present in IE 8/9 and Safari.
*/
figure {
margin: 1em 40px;
}
/**
* Address differences between Firefox and other browsers.
*/
hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
}
/**
* Contain overflow in all browsers.
*/
pre {
overflow: auto;
}
/**
* Address odd `em`-unit font size rendering in all browsers.
*/
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
/* Forms
========================================================================== */
/**
* Known limitation: by default, Chrome and Safari on OS X allow very limited
* styling of `select`, unless a `border` property is set.
*/
/**
* 1. Correct color not being inherited.
* Known issue: affects color of disabled elements.
* 2. Correct font properties not being inherited.
* 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
*/
button,
input,
optgroup,
select,
textarea {
color: inherit; /* 1 */
font: inherit; /* 2 */
margin: 0; /* 3 */
}
/**
* Address `overflow` set to `hidden` in IE 8/9/10/11.
*/
button {
overflow: visible;
}
/**
* Address inconsistent `text-transform` inheritance for `button` and `select`.
* All other form control elements do not inherit `text-transform` values.
* Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
* Correct `select` style inheritance in Firefox.
*/
button,
select {
text-transform: none;
}
/**
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
* and `video` controls.
* 2. Correct inability to style clickable `input` types in iOS.
* 3. Improve usability and consistency of cursor style between image-type
* `input` and others.
*/
button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
}
/**
* Re-set default cursor for disabled elements.
*/
button[disabled],
html input[disabled] {
cursor: default;
}
/**
* Remove inner padding and border in Firefox 4+.
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/**
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
*/
input {
line-height: normal;
}
/**
* It's recommended that you don't attempt to style these elements.
* Firefox's implementation doesn't respect box-sizing, padding, or width.
*
* 1. Address box sizing set to `content-box` in IE 8/9/10.
* 2. Remove excess padding in IE 8/9/10.
*/
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Fix the cursor style for Chrome's increment/decrement buttons. For certain
* `font-size` values of the `input`, it causes the cursor style of the
* decrement button to change from `default` to `text`.
*/
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Address `appearance` set to `searchfield` in Safari and Chrome.
* 2. Address `box-sizing` set to `border-box` in Safari and Chrome
* (include `-moz` to future-proof).
*/
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box; /* 2 */
box-sizing: content-box;
}
/**
* Remove inner padding and search cancel button in Safari and Chrome on OS X.
* Safari (but not Chrome) clips the cancel button when the search input has
* padding (and `textfield` appearance).
*/
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* Define consistent border, margin, and padding.
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
* 1. Correct `color` not being inherited in IE 8/9/10/11.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
*/
legend {
border: 0; /* 1 */
padding: 0; /* 2 */
}
/**
* Remove default vertical scrollbar in IE 8/9/10/11.
*/
textarea {
overflow: auto;
}
/**
* Don't inherit the `font-weight` (applied by a rule above).
* NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
*/
optgroup {
font-weight: bold;
}
/* Tables
========================================================================== */
/**
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
padding: 0;
}

View File

@ -0,0 +1,140 @@
////////////////////////////////////////////////////////////////////////////////
// RTL Styles Variables
////////////////////////////////////////////////////////////////////////////////
$default: auto;
////////////////////////////////////////////////////////////////////////////////
// TABLE OF CONTENTS
////////////////////////////////////////////////////////////////////////////////
#toc>ul>li>a>span {
float: left;
}
.toc-wrapper {
transition: right 0.3s ease-in-out !important;
left: $default !important;
#{right}: 0;
}
.toc-h2 {
padding-#{right}: $nav-padding + $nav-indent;
}
#nav-button {
#{right}: 0;
transition: right 0.3s ease-in-out;
&.open {
right: $nav-width
}
}
////////////////////////////////////////////////////////////////////////////////
// PAGE LAYOUT AND CODE SAMPLE BACKGROUND
////////////////////////////////////////////////////////////////////////////////
.page-wrapper {
margin-#{left}: $default !important;
margin-#{right}: $nav-width;
.dark-box {
#{right}: $default;
#{left}: 0;
}
}
.lang-selector {
width: $default !important;
a {
float: right;
}
}
////////////////////////////////////////////////////////////////////////////////
// CODE SAMPLE STYLES
////////////////////////////////////////////////////////////////////////////////
.content {
&>h1,
&>h2,
&>h3,
&>h4,
&>h5,
&>h6,
&>p,
&>table,
&>ul,
&>ol,
&>aside,
&>dl {
margin-#{left}: $examples-width;
margin-#{right}: $default !important;
}
&>ul,
&>ol {
padding-#{right}: $main-padding + 15px;
}
table {
th,
td {
text-align: right;
}
}
dd {
margin-#{right}: 15px;
}
aside {
aside:before {
padding-#{left}: 0.5em;
}
.search-highlight {
background: linear-gradient(to top right, #F7E633 0%, #F1D32F 100%);
}
}
pre,
blockquote {
float: left !important;
clear: left !important;
}
}
////////////////////////////////////////////////////////////////////////////////
// TYPOGRAPHY
////////////////////////////////////////////////////////////////////////////////
h1,
h2,
h3,
h4,
h5,
h6,
p,
aside {
text-align: right;
direction: rtl;
}
.toc-wrapper {
text-align: right;
direction: rtl;
font-weight: 100 !important;
}
////////////////////////////////////////////////////////////////////////////////
// RESPONSIVE DESIGN
////////////////////////////////////////////////////////////////////////////////
@media (max-width: $tablet-width) {
.toc-wrapper {
#{right}: -$nav-width;
&.open {
#{right}: 0;
}
}
.page-wrapper {
margin-#{right}: 0;
}
}
@media (max-width: $phone-width) {
%left-col {
margin-#{left}: 0;
}
}

View File

@ -0,0 +1,103 @@
/*
Copyright 2008-2013 Concur Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
*/
////////////////////////////////////////////////////////////////////////////////
// CUSTOMIZE SLATE
////////////////////////////////////////////////////////////////////////////////
// Use these settings to help adjust the appearance of Slate
// BACKGROUND COLORS
////////////////////
$nav-bg: #2E3336 !default;
$examples-bg: #2E3336 !default;
$code-bg: #1E2224 !default;
$code-annotation-bg: #191D1F !default;
$nav-subitem-bg: #1E2224 !default;
$nav-active-bg: #0F75D4 !default;
$nav-active-parent-bg: #1E2224 !default; // parent links of the current section
$lang-select-border: #000 !default;
$lang-select-bg: #1E2224 !default;
$lang-select-active-bg: $examples-bg !default; // feel free to change this to blue or something
$lang-select-pressed-bg: #111 !default; // color of language tab bg when mouse is pressed
$main-bg: #F3F7F9 !default;
$aside-notice-bg: #8fbcd4 !default;
$aside-warning-bg: #c97a7e !default;
$aside-success-bg: #6ac174 !default;
$search-notice-bg: #c97a7e !default;
// TEXT COLORS
////////////////////
$main-text: #333 !default; // main content text color
$nav-text: #fff !default;
$nav-active-text: #fff !default;
$nav-active-parent-text: #fff !default; // parent links of the current section
$lang-select-text: #fff !default; // color of unselected language tab text
$lang-select-active-text: #fff !default; // color of selected language tab text
$lang-select-pressed-text: #fff !default; // color of language tab text when mouse is pressed
// SIZES
////////////////////
$nav-width: 230px !default; // width of the navbar
$examples-width: 50% !default; // portion of the screen taken up by code examples
$logo-margin: 0px !default; // margin below logo
$main-padding: 28px !default; // padding to left and right of content & examples
$nav-padding: 15px !default; // padding to left and right of navbar
$nav-v-padding: 10px !default; // padding used vertically around search boxes and results
$nav-indent: 10px !default; // extra padding for ToC subitems
$code-annotation-padding: 13px !default; // padding inside code annotations
$h1-margin-bottom: 21px !default; // padding under the largest header tags
$tablet-width: 930px !default; // min width before reverting to tablet size
$phone-width: $tablet-width - $nav-width !default; // min width before reverting to mobile size
// FONTS
////////////////////
%default-font {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 14px;
}
%header-font {
@extend %default-font;
font-weight: bold;
}
%code-font {
font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, serif;
font-size: 12px;
line-height: 1.5;
}
// OTHER
////////////////////
$nav-footer-border-color: #666 !default;
$search-box-border-color: #666 !default;
////////////////////////////////////////////////////////////////////////////////
// INTERNAL
////////////////////////////////////////////////////////////////////////////////
// These settings are probably best left alone.
%break-words {
word-break: break-all;
hyphens: auto;
}

View File

@ -0,0 +1,153 @@
@charset "utf-8";
@import 'normalize';
@import 'variables';
@import 'icon-font';
/*
Copyright 2008-2013 Concur Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
*/
$print-color: #999;
$print-color-light: #ccc;
$print-font-size: 12px;
body {
@extend %default-font;
}
.tocify, .toc-footer, .lang-selector, .search, #nav-button {
display: none;
}
.tocify-wrapper>img {
margin: 0 auto;
display: block;
}
.content {
font-size: 12px;
pre, code {
@extend %code-font;
@extend %break-words;
border: 1px solid $print-color;
border-radius: 5px;
font-size: 0.8em;
}
pre {
code {
border: 0;
}
}
pre {
padding: 1.3em;
}
code {
padding: 0.2em;
}
table {
border: 1px solid $print-color;
tr {
border-bottom: 1px solid $print-color;
}
td,th {
padding: 0.7em;
}
}
p {
line-height: 1.5;
}
a {
text-decoration: none;
color: #000;
}
h1 {
@extend %header-font;
font-size: 2.5em;
padding-top: 0.5em;
padding-bottom: 0.5em;
margin-top: 1em;
margin-bottom: $h1-margin-bottom;
border: 2px solid $print-color-light;
border-width: 2px 0;
text-align: center;
}
h2 {
@extend %header-font;
font-size: 1.8em;
margin-top: 2em;
border-top: 2px solid $print-color-light;
padding-top: 0.8em;
}
h1+h2, h1+div+h2 {
border-top: none;
padding-top: 0;
margin-top: 0;
}
h3, h4 {
@extend %header-font;
font-size: 0.8em;
margin-top: 1.5em;
margin-bottom: 0.8em;
text-transform: uppercase;
}
h5, h6 {
text-transform: uppercase;
}
aside {
padding: 1em;
border: 1px solid $print-color-light;
border-radius: 5px;
margin-top: 1.5em;
margin-bottom: 1.5em;
line-height: 1.6;
}
aside:before {
vertical-align: middle;
padding-right: 0.5em;
font-size: 14px;
}
aside.notice:before {
@extend %icon-info-sign;
}
aside.warning:before {
@extend %icon-exclamation-sign;
}
aside.success:before {
@extend %icon-ok-sign;
}
}
.copy-clipboard {
@media print {
display: none
}
}

View File

@ -0,0 +1,633 @@
@charset "utf-8";
@import 'normalize';
@import 'variables';
@import 'icon-font';
// @import 'rtl'; // uncomment to switch to RTL format
/*
Copyright 2008-2013 Concur Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
*/
////////////////////////////////////////////////////////////////////////////////
// GENERAL STUFF
////////////////////////////////////////////////////////////////////////////////
html, body {
color: $main-text;
padding: 0;
margin: 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
@extend %default-font;
background-color: $main-bg;
height: 100%;
-webkit-text-size-adjust: none; /* Never autoresize text */
}
////////////////////////////////////////////////////////////////////////////////
// TABLE OF CONTENTS
////////////////////////////////////////////////////////////////////////////////
#toc > ul > li > a > span {
float: right;
background-color: #2484FF;
border-radius: 40px;
width: 20px;
}
.toc-wrapper {
transition: left 0.3s ease-in-out;
overflow-y: auto;
overflow-x: hidden;
position: fixed;
z-index: 30;
top: 0;
left: 0;
bottom: 0;
width: $nav-width;
background-color: $nav-bg;
font-size: 13px;
font-weight: bold;
// language selector for mobile devices
.lang-selector {
display: none;
a {
padding-top: 0.5em;
padding-bottom: 0.5em;
}
}
// This is the logo at the top of the ToC
.logo {
display: block;
max-width: 100%;
margin-bottom: $logo-margin;
}
&>.search {
position: relative;
input {
background: $nav-bg;
border-width: 0 0 1px 0;
border-color: $search-box-border-color;
padding: 6px 0 6px 20px;
box-sizing: border-box;
margin: $nav-v-padding $nav-padding;
width: $nav-width - ($nav-padding*2);
outline: none;
color: $nav-text;
border-radius: 0; /* ios has a default border radius */
}
&:before {
position: absolute;
top: 17px;
left: $nav-padding;
color: $nav-text;
@extend %icon-search;
}
}
.search-results {
margin-top: 0;
box-sizing: border-box;
height: 0;
overflow-y: auto;
overflow-x: hidden;
transition-property: height, margin;
transition-duration: 180ms;
transition-timing-function: ease-in-out;
background: $nav-subitem-bg;
&.visible {
height: 30%;
margin-bottom: 1em;
}
li {
margin: 1em $nav-padding;
line-height: 1;
}
a {
color: $nav-text;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}
// The Table of Contents is composed of multiple nested
// unordered lists. These styles remove the default
// styling of an unordered list because it is ugly.
ul, li {
list-style: none;
margin: 0;
padding: 0;
line-height: 28px;
}
li {
color: $nav-text;
transition-property: background;
transition-timing-function: linear;
transition-duration: 200ms;
}
// This is the currently selected ToC entry
.toc-link.active {
background-color: $nav-active-bg;
color: $nav-active-text;
}
// this is parent links of the currently selected ToC entry
.toc-link.active-parent {
background-color: $nav-active-parent-bg;
color: $nav-active-parent-text;
}
.toc-list-h2 {
display: none;
background-color: $nav-subitem-bg;
font-weight: 500;
}
.toc-h2 {
padding-left: $nav-padding + $nav-indent;
font-size: 12px;
}
.toc-footer {
padding: 1em 0;
margin-top: 1em;
border-top: 1px dashed $nav-footer-border-color;
li,a {
color: $nav-text;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
li {
font-size: 0.8em;
line-height: 1.7;
text-decoration: none;
}
}
}
.toc-link, .toc-footer li {
padding: 0 $nav-padding 0 $nav-padding;
display: block;
overflow-x: hidden;
white-space: nowrap;
text-overflow: ellipsis;
text-decoration: none;
color: $nav-text;
transition-property: background;
transition-timing-function: linear;
transition-duration: 130ms;
}
// button to show navigation on mobile devices
#nav-button {
span {
display: block;
$side-pad: $main-padding / 2 - 8px;
padding: $side-pad $side-pad $side-pad;
background-color: rgba($main-bg, 0.7);
transform-origin: 0 0;
transform: rotate(-90deg) translate(-100%, 0);
border-radius: 0 0 0 5px;
}
padding: 0 1.5em 5em 0; // increase touch size area
display: none;
position: fixed;
top: 0;
left: 0;
z-index: 100;
color: #000;
text-decoration: none;
font-weight: bold;
opacity: 0.7;
line-height: 16px;
img {
height: 16px;
vertical-align: bottom;
}
transition: left 0.3s ease-in-out;
&:hover { opacity: 1; }
&.open {left: $nav-width}
}
////////////////////////////////////////////////////////////////////////////////
// PAGE LAYOUT AND CODE SAMPLE BACKGROUND
////////////////////////////////////////////////////////////////////////////////
.page-wrapper {
margin-left: $nav-width;
position: relative;
z-index: 10;
background-color: $main-bg;
min-height: 100%;
padding-bottom: 1px; // prevent margin overflow
// The dark box is what gives the code samples their dark background.
// It sits essentially under the actual content block, which has a
// transparent background.
// I know, it's hackish, but it's the simplist way to make the left
// half of the content always this background color.
.dark-box {
width: $examples-width;
background-color: $examples-bg;
position: absolute;
right: 0;
top: 0;
bottom: 0;
}
.lang-selector {
position: fixed;
z-index: 50;
border-bottom: 5px solid $lang-select-active-bg;
}
}
.lang-selector {
display: flex;
background-color: $lang-select-bg;
width: 100%;
font-weight: bold;
overflow-x: auto;
a {
display: inline;
color: $lang-select-text;
text-decoration: none;
padding: 0 10px;
line-height: 30px;
outline: 0;
&:active, &:focus {
background-color: $lang-select-pressed-bg;
color: $lang-select-pressed-text;
}
&.active {
background-color: $lang-select-active-bg;
color: $lang-select-active-text;
}
}
&:after {
content: '';
clear: both;
display: block;
}
}
////////////////////////////////////////////////////////////////////////////////
// CONTENT STYLES
////////////////////////////////////////////////////////////////////////////////
// This is all the stuff with the light background in the left half of the page
.content {
// fixes webkit rendering bug for some: see #538
-webkit-transform: translateZ(0);
// to place content above the dark box
position: relative;
z-index: 30;
&:after {
content: '';
display: block;
clear: both;
}
&>h1, &>h2, &>h3, &>h4, &>h5, &>h6, &>p, &>table, &>ul, &>ol, &>aside, &>dl {
margin-right: $examples-width;
padding: 0 $main-padding;
box-sizing: border-box;
display: block;
@extend %left-col;
}
&>ul, &>ol {
padding-left: $main-padding + 15px;
}
// the div is the tocify hidden div for placeholding stuff
&>h1, &>h2, &>div {
clear:both;
}
h1 {
@extend %header-font;
font-size: 25px;
padding-top: 0.5em;
padding-bottom: 0.5em;
margin-bottom: $h1-margin-bottom;
margin-top: 2em;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
background-color: #fdfdfd;
}
h1:first-child, div:first-child + h1 {
border-top-width: 0;
margin-top: 0;
}
h2 {
@extend %header-font;
font-size: 19px;
margin-top: 4em;
margin-bottom: 0;
border-top: 1px solid #ccc;
padding-top: 1.2em;
padding-bottom: 1.2em;
background-image: linear-gradient(to bottom, rgba(#fff, 0.2), rgba(#fff, 0));
}
// h2s right after h1s should bump right up
// against the h1s.
h1 + h2, h1 + div + h2 {
margin-top: $h1-margin-bottom * -1;
border-top: none;
}
h3, h4, h5, h6 {
@extend %header-font;
font-size: 15px;
margin-top: 2.5em;
margin-bottom: 0.8em;
}
h4, h5, h6 {
font-size: 10px;
}
hr {
margin: 2em 0;
border-top: 2px solid $examples-bg;
border-bottom: 2px solid $main-bg;
}
table {
margin-bottom: 1em;
overflow: auto;
th,td {
text-align: left;
vertical-align: top;
line-height: 1.6;
code {
white-space: nowrap;
}
}
th {
padding: 5px 10px;
border-bottom: 1px solid #ccc;
vertical-align: bottom;
}
td {
padding: 10px;
}
tr:last-child {
border-bottom: 1px solid #ccc;
}
tr:nth-child(odd)>td {
background-color: lighten($main-bg,4.2%);
}
tr:nth-child(even)>td {
background-color: lighten($main-bg,2.4%);
}
}
dt {
font-weight: bold;
}
dd {
margin-left: 15px;
}
p, li, dt, dd {
line-height: 1.6;
margin-top: 0;
}
img {
max-width: 100%;
}
code {
background-color: rgba(0,0,0,0.05);
padding: 3px;
border-radius: 3px;
@extend %break-words;
@extend %code-font;
}
pre>code {
background-color: transparent;
padding: 0;
}
aside {
padding-top: 1em;
padding-bottom: 1em;
margin-top: 1.5em;
margin-bottom: 1.5em;
background: $aside-notice-bg;
line-height: 1.6;
&.warning {
background-color: $aside-warning-bg;
}
&.success {
background-color: $aside-success-bg;
}
}
aside:before {
vertical-align: middle;
padding-right: 0.5em;
font-size: 14px;
}
aside.notice:before {
@extend %icon-info-sign;
}
aside.warning:before {
@extend %icon-exclamation-sign;
}
aside.success:before {
@extend %icon-ok-sign;
}
.search-highlight {
padding: 2px;
margin: -3px;
border-radius: 4px;
border: 1px solid #F7E633;
background: linear-gradient(to top left, #F7E633 0%, #F1D32F 100%);
}
}
////////////////////////////////////////////////////////////////////////////////
// CODE SAMPLE STYLES
////////////////////////////////////////////////////////////////////////////////
// This is all the stuff that appears in the right half of the page
.content {
&>div.highlight {
clear:none;
}
pre, blockquote {
background-color: $code-bg;
color: #fff;
margin: 0;
width: $examples-width;
float:right;
clear:right;
box-sizing: border-box;
@extend %right-col;
&>p { margin: 0; }
a {
color: #fff;
text-decoration: none;
border-bottom: dashed 1px #ccc;
}
}
pre {
@extend %code-font;
padding-top: 2em;
padding-bottom: 2em;
padding: 2em $main-padding;
}
blockquote {
&>p {
background-color: $code-annotation-bg;
padding: $code-annotation-padding 2em;
color: #eee;
}
}
}
////////////////////////////////////////////////////////////////////////////////
// RESPONSIVE DESIGN
////////////////////////////////////////////////////////////////////////////////
// These are the styles for phones and tablets
// There are also a couple styles disperesed
@media (max-width: $tablet-width) {
.toc-wrapper {
left: -$nav-width;
&.open {
left: 0;
}
}
.page-wrapper {
margin-left: 0;
}
#nav-button {
display: block;
}
.toc-link {
padding-top: 0.3em;
padding-bottom: 0.3em;
}
}
@media (max-width: $phone-width) {
.dark-box {
display: none;
}
%left-col {
margin-right: 0;
}
.toc-wrapper .lang-selector {
display: block;
}
.page-wrapper .lang-selector {
display: none;
}
%right-col {
width: auto;
float: none;
}
%right-col + %left-col {
margin-top: $main-padding;
}
}
.highlight .c, .highlight .cm, .highlight .c1, .highlight .cs {
color: #909090;
}
.highlight, .highlight .w {
background-color: $code-bg;
}
.copy-clipboard {
float: right;
fill: #9DAAB6;
cursor: pointer;
opacity: 0.4;
height: 18px;
width: 18px;
}
.copy-clipboard:hover {
opacity: 0.8;
}

View File

@ -0,0 +1,6 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

115
docs/config.toml 100644
View File

@ -0,0 +1,115 @@
# hugo server --minify --themesDir ... --baseURL=http://0.0.0.0:1313/theme/hugo-book/
baseURL = 'https://rustybever.be/docs/vieter/'
title = 'Vieter - Docs'
theme = 'hugo-book'
# Book configuration
disablePathToLower = true
# Doesn't work with docs as subdir
enableGitInfo = true
# Needed for mermaid/katex shortcodes
[markup]
[markup.goldmark.renderer]
unsafe = true
[markup.tableOfContents]
startLevel = 1
# Multi-lingual mode config
# There are different options to translate files
# See https://gohugo.io/content-management/multilingual/#translation-by-filename
# And https://gohugo.io/content-management/multilingual/#translation-by-content-directory
[languages]
[languages.en]
languageName = 'English'
contentDir = 'content'
weight = 1
[menu]
[[menu.after]]
name = "HTTP API Docs"
url = "https://rustybever.be/docs/vieter/api/"
weight = 10
[[menu.after]]
name = "Man Pages"
url = "https://rustybever.be/man/vieter/vieter.1.html"
weight = 20
[[menu.after]]
name = "Vieter"
url = "https://git.rustybever.be/vieter-v/vieter"
weight = 30
[[menu.after]]
name = "Hugo Theme"
url = "https://github.com/alex-shpak/hugo-book"
weight = 40
[params]
# (Optional, default light) Sets color theme: light, dark or auto.
# Theme 'auto' switches between dark and light modes based on browser/os preferences
BookTheme = 'auto'
# (Optional, default true) Controls table of contents visibility on right side of pages.
# Start and end levels can be controlled with markup.tableOfContents setting.
# You can also specify this parameter per page in front matter.
BookToC = true
# (Optional, default none) Set the path to a logo for the book. If the logo is
# /static/logo.png then the path would be logo.png
# BookLogo = 'logo.png'
# (Optional, default none) Set leaf bundle to render as side menu
# When not specified file structure and weights will be used
# BookMenuBundle = '/menu'
# (Optional, default docs) Specify root page to render child pages as menu.
# Page is resoled by .GetPage function: https://gohugo.io/functions/getpage/
# For backward compatibility you can set '*' to render all sections to menu. Acts same as '/'
BookSection = '/'
# Set source repository location.
# Used for 'Last Modified' and 'Edit this page' links.
BookRepo = 'https://git.rustybever.be/vieter-v/vieter'
# (Optional, default 'commit') Specifies commit portion of the link to the page's last modified
# commit hash for 'doc' page type.
# Requires 'BookRepo' param.
# Value used to construct a URL consisting of BookRepo/BookCommitPath/<commit-hash>
# Github uses 'commit', Bitbucket uses 'commits'
BookCommitPath = 'src/commit'
# Enable "Edit this page" links for 'doc' page type.
# Disabled by default. Uncomment to enable. Requires 'BookRepo' param.
# Edit path must point to root directory of repo.
# BookEditPath = 'edit/main/exampleSite'
# Configure the date format used on the pages
# - In git information
# - In blog posts
BookDateFormat = 'January 2, 2006'
# (Optional, default true) Enables search function with flexsearch,
# Index is built on fly, therefore it might slowdown your website.
# Configuration for indexing can be adjusted in i18n folder per language.
BookSearch = true
# (Optional, default true) Enables comments template on pages
# By default partals/docs/comments.html includes Disqus template
# See https://gohugo.io/content-management/comments/#configure-disqus
# Can be overwritten by same param in page frontmatter
BookComments = false
# /!\ This is an experimental feature, might be removed or changed at any time
# (Optional, experimental, default false) Enables portable links and link checks in markdown pages.
# Portable links meant to work with text editors and let you write markdown without {{< relref >}} shortcode
# Theme will print warning if page referenced in markdown does not exists.
BookPortableLinks = true
# /!\ This is an experimental feature, might be removed or changed at any time
# (Optional, experimental, default false) Enables service worker that caches visited pages and resources for offline use.
BookServiceWorker = true
# /!\ This is an experimental feature, might be removed or changed at any time
# (Optional, experimental, default false) Enables a drop-down menu for translations only if a translation is present.
BookTranslatedOnly = false

View File

@ -0,0 +1,59 @@
# Vieter
{{< hint warning >}}
**Important**
Because this project is still in heavy development, this documentation tries to
follow the development branch & not the latest release. This means that the
documentation might not be relevant anymore for the latest release.
{{< /hint >}}
## Overview
Vieter consists of two main parts, namely an implementation of an Arch
repository server & a scheduling system to periodically build Pacman packages &
publish them to a repository.
{{< hint info >}}
**Note**
While I mention Vieter being an "Arch" repository server, it works with any
distribution that uses Pacman as the package manager. I do recommend using a
base docker image for your distribution if you wish to use the build system as
well.
{{< /hint >}}
### Why?
Vieter is my personal solution to a problem I've been facing for months:
extremely long AUR package build times. I run EndeavourOS on both my laptops,
one of which being a rather old MacBook Air. I really like being a beta-tester
for projects & run development builds for multiple packages (nheko,
newsflash...). Because of this, I have to regularly re-build these packages in
order to stay up to date with development. However, these builds can take a
really long time on the old MacBook. This project is a solution to that
problem: instead of building the packages locally, I can build them
automatically in the cloud & just download them whenever I update my system!
Thanks to this solution, I'm able to shave 10-15 minutes off my update times,
just from not having to compile everything every time there's an update.
Besides this, it's also just really useful to have a repository server that you
control & can upload your own packages to. For example, I package my st
terminal using a CI pipeline & upload it to my repository!
### Why V?
I had been interested in learning V for a couple of months ever since I
stumbled upon it by accident. It looked like a promising language & turned out
to be very fun to use! It's fast & easy to learn, & it's a nice contrast with
my usual Rust-based projects, which tend to get quite complex.
I recommend checking out their [homepage](https://vlang.io/)!
### What's with the name?
Before deciding to write this project in V, I wrote a prototype in Python,
called [Pieter](https://git.rustybever.be/Chewing_Bever/pieter). The name
Pieter came from Pieter Post, the Dutch name for [Postname
Pat](https://en.wikipedia.org/wiki/Postman_Pat). The idea was that the server
"delivered packages", & a good friend of mine suggested the name. When I
decided to switch over to Vieter, I changed the P (for Python) to a V, it
seemed fitting.

View File

@ -0,0 +1,138 @@
---
weight: 20
---
# Configuration
By default, all vieter commands try to read in the TOML file `~/.vieterrc` for
configuration. The location of this file can be changed by using the `-f` flag.
If the above file doesn't exist or you wish to override some of its settings,
configuration is also possible using environment variables. Every variable in
the config file has a respective environment variable of the following form:
say the variable is called `api_key`, then the respective environment variable
would be `VIETER_API_KEY`. In essence, it's the variable in uppercase prepended
with `VIETER_`.
If a variable is both present in the config file & as an environment variable,
the value in the environment variable is used.
{{< hint info >}}
**Note**
All environment variables can also be provided from a file by appending them
with `_FILE`. This for example allows you to provide the API key from a Docker
secrets file.
{{< /hint >}}
## Commands
The first argument passed to Vieter determines which command you wish to use.
Each of these can contain subcommands (e.g. `vieter targets list`), but all
subcommands will use the same configuration. Below you can find the
configuration variable required for each command.
### `vieter server`
* `port`: HTTP port to run on
* Default: `8000`
* `log_level`: log verbosity level. Value should be one of `FATAL`, `ERROR`,
`WARN`, `INFO` or `DEBUG`.
* Default: `WARN`
* `pkg_dir`: where Vieter should store the actual package archives.
* `data_dir`: where Vieter stores the repositories, log file & database.
* `api_key`: the API key to use when authenticating requests.
* `default_arch`: this setting serves two main purposes:
* Packages with architecture `any` are always added to this architecture.
This prevents the server from being confused when an `any` package is
published as the very first package for a repository.
* Targets added without an `arch` value use this value instead.
* `global_schedule`: build schedule for any target that does not have a
schedule defined. For information about this syntax, see
[here](/usage/builds/schedule).
* Default: `0 3` (3AM every night)
* `base_image`: Docker image to use when building a package. Any Pacman-based
distro image should work, as long as `/etc/pacman.conf` is used &
`base-devel` exists in the repositories. Make sure that the image supports
the architecture of your cron daemon.
* Default: `archlinux:base-devel` (only works on `x86_64`). If you require
`aarch64` support, consider using
[`menci/archlinuxarm:base-devel`](https://hub.docker.com/r/menci/archlinuxarm)
([GitHub](https://github.com/Menci/docker-archlinuxarm)). This is the
image used for the Vieter CI builds.
* `max_log_age`: maximum age of logs (in days). Logs older than this will get
cleaned by the log removal daemon. If set to zero, no logs are ever removed.
The age of logs is determined by the time the build was started.
* Default: `0`
* `log_removal_schedule`: cron schedule defining when to clean old logs.
* Default: `0 0` (every day at midnight)
### `vieter cron`
* `log_level`: log verbosity level. Value should be one of `FATAL`, `ERROR`,
`WARN`, `INFO` or `DEBUG`.
* Default: `WARN`
* `log_file`: log file to write logs to.
* Default: `vieter.log` (in `data_dir`)
* `address`: *public* URL of the Vieter repository server to build for. From
this server the list of Git repositories is retrieved. All built packages are
published to this server.
* `api_key`: API key of the above server.
* `data_dir`: directory to store log file in.
* `base_image`: Docker image to use when building a package. Any Pacman-based
distro image should work, as long as `/etc/pacman.conf` is used &
`base-devel` exists in the repositories. Make sure that the image supports
the architecture of your cron daemon.
* Default: `archlinux:base-devel` (only works on `x86_64`). If you require
`aarch64` support, consider using
[`menci/archlinuxarm:base-devel`](https://hub.docker.com/r/menci/archlinuxarm)
([GitHub](https://github.com/Menci/docker-archlinuxarm)). This is the image
used for the Vieter CI builds.
* `max_concurrent_builds`: how many builds to run at the same time.
* Default: `1`
* `api_update_frequency`: how frequently (in minutes) to poll the Vieter
repository server for a new list of Git repositories to build.
* Default: `15`
* `image_rebuild_frequency`: Vieter periodically builds a builder image using
the configured base image. This makes sure build containers do not have to
download a lot of packages when updating their system. This setting defines
how frequently (in minutes) to rebuild this builder image.
* Default: `1440` (every 24 hours)
* `global_schedule`: build schedule for any Git repository that does not have a
schedule defined. For information about this syntax, see
[here](/usage/builds/schedule).
* Default: `0 3` (3AM every night)
### `vieter logs`
* `api_key`: the API key to use when authenticating requests.
* `address`: Base URL of your Vieter instance, e.g. https://example.com
### `vieter targets`
* `api_key`: the API key to use when authenticating requests.
* `address`: Base URL of your Vieter instance, e.g. https://example.com
* `base_image`: image to use when building a package using `vieter targets
build`.
* Default: `archlinux:base-devel`
### `vieter agent`
* `log_level`: log verbosity level. Value should be one of `FATAL`, `ERROR`,
`WARN`, `INFO` or `DEBUG`.
* Default: `WARN`
* `address`: *public* URL of the Vieter repository server to build for. From
this server jobs are retrieved. All built packages are published to this
server.
* `api_key`: API key of the above server.
* `data_dir`: directory to store log file in.
* `max_concurrent_builds`: how many builds to run at the same time.
* Default: `1`
* `polling_frequency`: how often (in seconds) to poll the server for new
builds. Note that the agent might poll more frequently when it's actively
processing builds.
* `image_rebuild_frequency`: Vieter periodically builds images that are then
used as a basis for running build containers. This is to prevent each build
from downloading an entire repository worth of dependencies. This setting
defines how frequently (in minutes) to rebuild these images.
* Default: `1440` (every 24 hours)
* `arch`: architecture for which this agent should pull down builds (e.g.
`x86_64`)

View File

@ -0,0 +1,114 @@
---
weight: 10
---
# Installation
Vieter consists of a single binary, akin to busybox. The binary's behavior is
determined by its CLI arguments, e.g. `vieter server` starts the repository
server.
All installation solutions can be configured the same way,
as described [here](/configuration).
## Docker
Docker images are published to the
[`chewingbever/vieter`](https://hub.docker.com/r/chewingbever/vieter) Docker
Hub repository. You can either pull a release tag (e.g.
`chewingbever/vieter:0.1.0-rc1`), or pull the `chewingbever/vieter:dev` tag.
The latter is updated every time a new commit is pushed to the development
branch. This branch will be the most up to date, but does not give any
guarantees about stability, so beware!
Thanks to the single-binary design of Vieter, this image can be used both for
the repository server, the cron daemon and the agent.
Below is a minimal compose file to set up both the repository server & a build
agent:
```yaml
version: '3'
services:
server:
image: 'chewingbever/vieter:0.5.0-rc.1'
restart: 'always'
environment:
- 'VIETER_API_KEY=secret'
- 'VIETER_DEFAULT_ARCH=x86_64'
volumes:
- 'data:/data'
cron:
image: 'chewingbever/vieter:0.5.0-rc.1'
restart: 'always'
# Required to connect to the Docker daemon
user: root
command: 'vieter agent'
environment:
- 'VIETER_API_KEY=secret'
# MUST be public URL of Vieter repository
- 'VIETER_ADDRESS=https://example.com'
# Architecture for which the agent builds
- 'VIETER_ARCH=x86_64'
- 'VIETER_MAX_CONCURRENT_BUILDS=2'
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
volumes:
data:
```
If you do not require the build system, the repository server can be used
independently as well.
Of course, Vieter allows a lot more configuration than this. This compose file
is meant as a starting point for setting up your installation.
{{< hint info >}}
**Note**
Builds are executed on the agent's system using the host's Docker daemon. An
agent for a specific `arch` will only build packages for that specific
architecture. Therefore, if you wish to build packages for both `x86_64` &
`aarch64`, you'll have to deploy two agents, one on each architecture.
Afterwards, any Git repositories enabled for those two architectures will build
on both.
{{< /hint >}}
## Binary
On the
[releases](https://git.rustybever.be/vieter-v/vieter/releases)
page, you can find statically compiled binaries for all
released versions. This is the same binary as used inside
the Docker images.
## Arch
I publish both development & release versions of Vieter to my personal
repository, https://arch.r8r.be. Packages are available for `x86_64` &
`aarch64`. To use the repository, add the following to your `pacman.conf`:
```
[vieter]
Server = https://arch.r8r.be/$repo/$arch
SigLevel = Optional
```
Afterwards, you can update your system & install the `vieter` package for the
latest official release or `vieter-git` for the latest development release.
### AUR
If you prefer building the packages locally (or on your own Vieter instance),
there's the [`vieter`](https://aur.archlinux.org/packages/vieter) &
[`vieter-git`](https://aur.archlinux.org/packages/vieter-git) packages on the
AUR. These packages build using the `vlang` compiler package, so I can't
guarantee that a compiler update won't temporarily break them.
## Building from source
The project [README](https://git.rustybever.be/vieter-v/vieter#building)
contains instructions for building Vieter from source.

View File

@ -0,0 +1,3 @@
---
weight: 30
---

View File

@ -0,0 +1,51 @@
---
weight: 20
---
# Building packages
The automatic build system is what makes Vieter very useful as a replacement
for an AUR helper. It can perodically build packages & publish them to your
personal Vieter repository server, removing the need to build the packages
locally.
## Adding builds
Before the cron system can start building your package, you need to add its
info to the system. The Vieter repository server exposes an HTTP API for this
(see the [HTTP API Docs](https://rustybever.be/docs/vieter/api/) for more
info). For ease of use, the Vieter binary contains a CLI interface for
interacting with this API (see [Configuration](/configuration) for
configuration details). The [man
pages](https://rustybever.be/man/vieter/vieter-targets.1.html) describe this in
greater detail, but the basic usage is as follows:
```
vieter targets add some-url some-repository
```
Here, `some-url` is the URL of the Git repository containing the PKGBUILD. This
URL is passed to `git clone`, meaning the repository should be public. Vieter
expects the same format as an AUR Git repository, so you can directly use AUR
URLs here. Alternatively, you can also provide the URL to a PKGBUILD file
instead. See
[vieter-targets-add(1)](https://rustybever.be/man/vieter/vieter-targets-add.1.html)
for more information.
`some-repo` is the repository to which the built package archives should be
published.
The above command intentionally leaves out a few parameters to make the CLI
more useable. For information on how to modify all parameters using the CLI,
see
[vieter-targets(1)](https://rustybever.be/man/vieter/vieter-targets.1.html).
## Reading logs
The logs of each build are uploaded to the Vieter repository server, along with
information about the exit code of the build container, when the build
started/ended etc. These logs can then be accessed using the [HTTP
API](https://rustybever.be/docs/vieter/api/).
For ease of use, the logs are also available using some CLI commands; see
[vieter-logs(1)](https://rustybever.be/man/vieter/vieter-logs.1.html) for more
information.

View File

@ -0,0 +1,23 @@
---
weight: 20
---
# Cleanup
Vieter stores the logs of every single package build. While this is great for
debugging why builds fail, it also causes an active or long-running Vieter
instance to accumulate thousands of logs.
To combat this, a log removal daemon can be enabled that periodically removes
old build logs. By starting your server with the `max_log_age` variable (see
[Configuration](/configuration#vieter-server)), a daemon will get enabled that
periodically removes logs older than this setting. By default, this will happen
every day at midnight, but this behavior can be changed using the
`log_removal_schedule` variable.
{{< hint info >}}
**Note**
The daemon will always run a removal of logs on startup. Therefore, it's
possible the daemon will be *very* active when first enabling this setting.
After the initial surge of logs to remove, it'll calm down again.
{{< /hint >}}

View File

@ -0,0 +1,46 @@
---
weight: 10
---
# Cron schedule syntax
The Vieter cron daemon uses a subset of the cron expression syntax to schedule
builds.
## Format
`a b c d`
* `a`: minutes
* `b`: hours
* `c`: days
* `d`: months
An expression consists of two to four sections. If less than four sections are
provided, the parser will append `*` until there are four sections. This means
that `0 3` is the same as `0 3 * *`.
Each section consists of one or more parts, separated by a comma. Each of these
parts, in turn, can be one of the following (any letters are integers):
* `*`: allow all possible values.
* `a`: only this value is allowed.
* `*/n`: allow every n-th value.
* `a/n`: allow every n-th value, starting at a in the list.
* `a-b`: allow every value between a and b, bounds included.
* `a-b/n`: allow every n-th value inside the list of values between a and b,
bounds included.
Each section can consist of as many of these parts as necessary.
## Examples
* `0 3`: every day at 03:00AM.
* `0 0 */7`: every 7th day of the month, at midnight.
## CLI tool
The Vieter binary contains a command that shows you the next matching times for
a given expression. This can be useful for understanding the syntax. For more
information, see
[vieter-schedule(1)](https://rustybever.be/man/vieter/vieter-schedule.1.html).

View File

@ -0,0 +1,41 @@
---
weight: 10
---
# Pacman repository
The part of Vieter that users will interact with the most is the Pacman
repository aka `vieter server`.
## Design overview
A Vieter repository server has support for multiple repositories, with each
repository containing packages for multiple architectures.
If you wish to use these repositories on your system, add the following to
`/etc/pacman.conf` for each repository you wish to use:
```
[repo-name]
Server = https://example.com/$repo/$arch
SigLevel = Optional
```
Here, `$repo` and `$arch` are not variables you have to fill in yourself.
Rather, Pacman will substitute these when reading the config file. `$repo` is
replaced by the name between the square brackets (in this case `repo-name`),
and `$arch` is replaced by your system's architecture, e.g. `x86_64`. Of
course, you can also fill in these values manually yourself, e.g. if you wish
to use a different name inside the square brackets.
Important to note is that, when two repositories contain a package with the
same name, Pacman will choose the one from the repository that's highest up in
the `pacman.conf` file. Therefore, if you know your repository has packages
with the same name as ones from the official repositories, it might be better
to place the repository below the official repositories to avoid overwriting
official packages.
## Publishing packages
Packages can be easily published using a single HTTP POST request. Check out
the [HTTP API docs](https://rustybever.be/docs/vieter/api/) for more info on
these routes, including example cURL commands.

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"Target":"book.min.97cfda4f5e3c9fa49a2bf8d401f4ddc0eec576c99cdcf6afbec19173200c37db.css","MediaType":"text/css","Data":{"Integrity":"sha256-l8/aT148n6SaK/jUAfTdwO7Fdsmc3PavvsGRcyAMN9s="}}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"Target":"book.min.97cfda4f5e3c9fa49a2bf8d401f4ddc0eec576c99cdcf6afbec19173200c37db.css","MediaType":"text/css","Data":{"Integrity":"sha256-l8/aT148n6SaK/jUAfTdwO7Fdsmc3PavvsGRcyAMN9s="}}

1
docs/themes/hugo-book vendored 160000

@ -0,0 +1 @@
Subproject commit 4ef38f3bbf5dae9a11a711d2ed1ced9294c6af5f

View File

@ -1,23 +0,0 @@
// Parse the header of a raw HTTP request into a Request object
pub fn parse_request_head(mut reader io.BufferedReader) ?Request {
// request line
mut line := reader.read_line() ?
method, target, version := parse_request_line(line) ?
// headers
mut header := new_header()
line = reader.read_line() ?
for line != '' {
key, value := parse_header(line) ?
header.add_custom(key, value) ?
line = reader.read_line() ?
}
header.coerce(canonicalize: true)
return Request{
method: method
url: target.str()
header: header
version: version
}
}

View File

@ -1,13 +0,0 @@
#!/usr/bin/env sh
# This file patches the downloaded V version
# Should be run from within the directory it's in, as it uses relative paths to the files used for patching.
# $1 is the path to the downloaded V version
# Add parse_request_no_body
cat parse_request_no_body.v >> "$1"/vlib/net/http/request.v
# Make sha256 functions public
sed -i \
-e 's/\(fn (mut d Digest) checksum(\)/pub \1/' \
-e 's/\(fn (mut d Digest) write(\)/pub \1/' \
"$1"/vlib/crypto/sha256/sha256.v

3
renovate.json 100644
View File

@ -0,0 +1,3 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
}

27
src/agent/agent.v 100644
View File

@ -0,0 +1,27 @@
module agent
import log
import os
import util
const log_file_name = 'vieter.agent.log'
// agent starts an agent service
pub fn agent(conf Config) ! {
log_level := log.level_from_tag(conf.log_level) or {
return error('Invalid log level. The allowed values are FATAL, ERROR, WARN, INFO & DEBUG.')
}
mut logger := log.Log{
level: log_level
}
os.mkdir_all(conf.data_dir) or { util.exit_with_message(1, 'Failed to create data directory.') }
log_file := os.join_path_single(conf.data_dir, agent.log_file_name)
logger.set_full_logpath(log_file)
logger.log_to_console_too()
mut d := agent_init(logger, conf)
d.run()
}

31
src/agent/cli.v 100644
View File

@ -0,0 +1,31 @@
module agent
import cli
import conf as vconf
struct Config {
pub:
log_level string = 'WARN'
// Architecture that the agent represents
arch string
api_key string
address string
data_dir string
max_concurrent_builds int = 1
polling_frequency int = 30
image_rebuild_frequency int = 1440
}
// cmd returns the cli module that handles the cron daemon.
pub fn cmd() cli.Command {
return cli.Command{
name: 'agent'
description: 'Start an agent daemon.'
execute: fn (cmd cli.Command) ! {
config_file := cmd.flags.get_string('config-file')!
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
agent(conf_)!
}
}
}

197
src/agent/daemon.v 100644
View File

@ -0,0 +1,197 @@
module agent
import log
import sync.stdatomic
import build
import models { BuildConfig }
import client
import time
import os
const (
build_empty = 0
build_running = 1
build_done = 2
)
struct AgentDaemon {
logger shared log.Log
conf Config
client client.Client
mut:
images ImageManager
// Which builds are currently running; length is conf.max_concurrent_builds
builds []BuildConfig
// Atomic variables used to detect when a build has finished; length is
// conf.max_concurrent_builds
atomics []u64
}
// agent_init initializes a new agent
fn agent_init(logger log.Log, conf Config) AgentDaemon {
mut d := AgentDaemon{
logger: logger
client: client.new(conf.address, conf.api_key)
conf: conf
images: new_image_manager(conf.image_rebuild_frequency * 60)
builds: []BuildConfig{len: conf.max_concurrent_builds}
atomics: []u64{len: conf.max_concurrent_builds}
}
return d
}
// run starts the actual agent daemon. This function will run forever.
pub fn (mut d AgentDaemon) run() {
// This is just so that the very first time the loop is ran, the jobs are
// always polled
mut last_poll_time := time.now().add_seconds(-d.conf.polling_frequency)
mut sleep_time := 0 * time.second
mut finished, mut empty, mut running := 0, 0, 0
for {
if sleep_time > 0 {
d.ldebug('Sleeping for ${sleep_time}')
time.sleep(sleep_time)
}
finished, empty = d.update_atomics()
running = d.conf.max_concurrent_builds - finished - empty
// No new finished builds and no free slots, so there's nothing to be
// done
if finished + empty == 0 {
sleep_time = 1 * time.second
continue
}
// Builds have finished, so old builder images might have freed up.
// TODO this might query the docker daemon too frequently.
if finished > 0 {
d.images.clean_old_images()
}
// The agent will always poll for new jobs after at most
// `polling_frequency` seconds. However, when jobs have finished, the
// agent will also poll for new jobs. This is because jobs are often
// clustered together (especially when mostly using the global cron
// schedule), so there's a much higher chance jobs are available.
if finished > 0 || time.now() >= last_poll_time.add_seconds(d.conf.polling_frequency) {
d.ldebug('Polling for new jobs')
new_configs := d.client.poll_jobs(d.conf.arch, finished + empty) or {
d.lerror('Failed to poll jobs: ${err.msg()}')
// TODO pick a better delay here
sleep_time = 5 * time.second
continue
}
d.ldebug('Received ${new_configs.len} jobs')
last_poll_time = time.now()
for config in new_configs {
// Make sure a recent build base image is available for
// building the config
if !d.images.up_to_date(config.base_image) {
d.linfo('Building builder image from base image ${config.base_image}')
// TODO handle this better than to just skip the config
d.images.refresh_image(config.base_image) or {
d.lerror(err.msg())
continue
}
}
// It's technically still possible that the build image is
// removed in the very short period between building the
// builder image and starting a build container with it. If
// this happens, faith really just didn't want you to do this
// build.
d.start_build(config)
running++
}
}
// The agent is not doing anything, so we just wait until the next poll
// time
if running == 0 {
sleep_time = last_poll_time.add_seconds(d.conf.polling_frequency) - time.now()
} else {
sleep_time = 1 * time.second
}
}
}
// update_atomics checks for each build whether it's completed, and sets it to
// empty again if so. The return value is a tuple `(finished, empty)` where
// `finished` is how many builds were just finished and thus set to empty, and
// `empty` is how many build slots were already empty. The amount of running
// builds can then be calculated by substracting these two values from the
// total allowed concurrent builds.
fn (mut d AgentDaemon) update_atomics() (int, int) {
mut finished := 0
mut empty := 0
for i in 0 .. d.atomics.len {
if stdatomic.load_u64(&d.atomics[i]) == agent.build_done {
stdatomic.store_u64(&d.atomics[i], agent.build_empty)
finished++
} else if stdatomic.load_u64(&d.atomics[i]) == agent.build_empty {
empty++
}
}
return finished, empty
}
// start_build starts a build for the given BuildConfig.
fn (mut d AgentDaemon) start_build(config BuildConfig) bool {
for i in 0 .. d.atomics.len {
if stdatomic.load_u64(&d.atomics[i]) == agent.build_empty {
stdatomic.store_u64(&d.atomics[i], agent.build_running)
d.builds[i] = config
spawn d.run_build(i, config)
return true
}
}
return false
}
// run_build actually starts the build process for a given target.
fn (mut d AgentDaemon) run_build(build_index int, config BuildConfig) {
d.linfo('started build: ${config}')
// 0 means success, 1 means failure
mut status := 0
new_config := BuildConfig{
...config
base_image: d.images.get(config.base_image)
}
res := build.build_config(d.client.address, d.client.api_key, new_config) or {
d.ldebug('build_config error: ${err.msg()}')
status = 1
build.BuildResult{}
}
if status == 0 {
d.linfo('Uploading build logs for ${config}')
// TODO use the arch value here
build_arch := os.uname().machine
d.client.add_build_log(config.target_id, res.start_time, res.end_time, build_arch,
res.exit_code, res.logs) or { d.lerror('Failed to upload logs for ${config}') }
} else {
d.lwarn('an error occurred during build: ${config}')
}
stdatomic.store_u64(&d.atomics[build_index], agent.build_done)
}

119
src/agent/images.v 100644
View File

@ -0,0 +1,119 @@
module agent
import time
import docker
import build
// An ImageManager is a utility that creates builder images from given base
// images, updating these builder images if they've become too old. This
// structure can manage images from any number of base images, paving the way
// for configurable base images per target/repository.
struct ImageManager {
max_image_age int [required]
mut:
// For each base image, one or more builder images can exist at the same
// time
images map[string][]string [required]
// For each base image, we track when its newest image was built
timestamps map[string]time.Time [required]
}
// new_image_manager initializes a new image manager.
fn new_image_manager(max_image_age int) ImageManager {
return ImageManager{
max_image_age: max_image_age
images: map[string][]string{}
timestamps: map[string]time.Time{}
}
}
// get returns the name of the newest image for the given base image. Note that
// this function should only be called *after* a first call to `refresh_image`.
pub fn (m &ImageManager) get(base_image string) string {
return m.images[base_image].last()
}
// up_to_date returns true if the last known builder image exists and is up to
// date. If this function returns true, the last builder image may be used to
// perform a build.
pub fn (mut m ImageManager) up_to_date(base_image string) bool {
if base_image !in m.timestamps
|| m.timestamps[base_image].add_seconds(m.max_image_age) <= time.now() {
return false
}
// It's possible the image has been removed by some external event, so we
// check whether it actually exists as well.
mut dd := docker.new_conn() or { return false }
defer {
dd.close() or {}
}
dd.image_inspect(m.images[base_image].last()) or {
// Image doesn't exist, so we stop tracking it
if err.code() == 404 {
m.images[base_image].delete_last()
m.timestamps.delete(base_image)
}
// If the inspect fails, it's either because the image doesn't exist or
// because of some other error. Either way, we can't know *for certain*
// that the image exists, so we return false.
return false
}
return true
}
// refresh_image builds a new builder image from the given base image. This
// function should only be called if `up_to_date` returned false.
fn (mut m ImageManager) refresh_image(base_image string) ! {
// TODO use better image tags for built images
new_image := build.create_build_image(base_image) or {
return error('Failed to build builder image from base image ${base_image}')
}
m.images[base_image] << new_image
m.timestamps[base_image] = time.now()
}
// clean_old_images removes all older builder images that are no longer in use.
// The function will always leave at least one builder image, namely the newest
// one.
fn (mut m ImageManager) clean_old_images() {
mut dd := docker.new_conn() or { return }
defer {
dd.close() or {}
}
mut i := 0
for image in m.images.keys() {
i = 0
for i < m.images[image].len - 1 {
// For each builder image, we try to remove it by calling the Docker
// API. If the function returns an error or false, that means the image
// wasn't deleted. Therefore, we move the index over. If the function
// returns true, the array's length has decreased by one so we don't
// move the index.
dd.image_remove(m.images[image][i]) or {
// The image was removed by an external event
if err.code() == 404 {
m.images[image].delete(i)
}
// The image couldn't be removed, so we need to keep track of
// it
else {
i += 1
}
continue
}
m.images[image].delete(i)
}
}
}

36
src/agent/log.v 100644
View File

@ -0,0 +1,36 @@
module agent
// lfatal create a log message with the fatal level
pub fn (mut d AgentDaemon) lfatal(msg string) {
lock d.logger {
d.logger.fatal(msg)
}
}
// lerror create a log message with the error level
pub fn (mut d AgentDaemon) lerror(msg string) {
lock d.logger {
d.logger.error(msg)
}
}
// lwarn create a log message with the warn level
pub fn (mut d AgentDaemon) lwarn(msg string) {
lock d.logger {
d.logger.warn(msg)
}
}
// linfo create a log message with the info level
pub fn (mut d AgentDaemon) linfo(msg string) {
lock d.logger {
d.logger.info(msg)
}
}
// ldebug create a log message with the debug level
pub fn (mut d AgentDaemon) ldebug(msg string) {
lock d.logger {
d.logger.debug(msg)
}
}

View File

@ -4,7 +4,7 @@
#include "archive.h" #include "archive.h"
struct C.archive {} pub struct C.archive {}
// Create a new archive struct for reading // Create a new archive struct for reading
fn C.archive_read_new() &C.archive fn C.archive_read_new() &C.archive
@ -15,6 +15,9 @@ fn C.archive_read_support_filter_zstd(&C.archive)
// Configure the archive to work with gzip compression // Configure the archive to work with gzip compression
fn C.archive_read_support_filter_gzip(&C.archive) fn C.archive_read_support_filter_gzip(&C.archive)
// Configure the archive to work with xz compression
fn C.archive_read_support_filter_xz(&C.archive)
// Configure the archive to work with a tarball content // Configure the archive to work with a tarball content
fn C.archive_read_support_format_tar(&C.archive) fn C.archive_read_support_format_tar(&C.archive)
@ -68,7 +71,7 @@ fn C.archive_filter_code(&C.archive, int) int
#include "archive_entry.h" #include "archive_entry.h"
struct C.archive_entry {} pub struct C.archive_entry {}
// Create a new archive_entry struct // Create a new archive_entry struct
fn C.archive_entry_new() &C.archive_entry fn C.archive_entry_new() &C.archive_entry

View File

@ -1,11 +0,0 @@
module main
import net.http
fn (mut app App) is_authorized() bool {
x_header := app.req.header.get_custom('X-Api-Key', http.HeaderQueryConfig{ exact: true }) or {
return false
}
return x_header.trim_space() == app.api_key
}

161
src/build/build.v 100644
View File

@ -0,0 +1,161 @@
module build
import docker
import encoding.base64
import time
import os
import strings
import util
import models { BuildConfig, Target }
const (
container_build_dir = '/build'
build_image_repo = 'vieter-build'
// Contents of PATH variable in build containers
path_dirs = ['/sbin', '/bin', '/usr/sbin', '/usr/bin', '/usr/local/sbin',
'/usr/local/bin', '/usr/bin/site_perl', '/usr/bin/vendor_perl', '/usr/bin/core_perl']
)
// create_build_image creates a builder image given some base image which can
// then be used to build & package Arch images. It mostly just updates the
// system, install some necessary packages & creates a non-root user to run
// makepkg with. The base image should be some Linux distribution that uses
// Pacman as its package manager.
pub fn create_build_image(base_image string) !string {
mut dd := docker.new_conn()!
defer {
dd.close() or {}
}
commands := [
// Update repos & install required packages
'pacman -Syu --needed --noconfirm base-devel git'
// Add a non-root user to run makepkg
'groupadd -g 1000 builder',
'useradd -mg builder builder'
// Make sure they can use sudo without a password
"echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
// Create the directory for the builds & make it writeable for the
// build user
'mkdir /build',
'chown -R builder:builder /build',
]
cmds_str := base64.encode_str(commands.join('\n'))
c := docker.NewContainer{
image: base_image
env: ['BUILD_SCRIPT=${cmds_str}']
entrypoint: ['/bin/sh', '-c']
cmd: ['echo \$BUILD_SCRIPT | base64 -d | /bin/sh -e']
}
// This check is needed so the user can pass "archlinux" without passing a
// tag & make it still work
image_parts := base_image.split_nth(':', 2)
image_name := image_parts[0]
image_tag := if image_parts.len > 1 { image_parts[1] } else { 'latest' }
// We pull the provided image
dd.image_pull(image_name, image_tag)!
id := dd.container_create(c)!.id
// id := docker.create_container(c)!
dd.container_start(id)!
// This loop waits until the container has stopped, so we can remove it after
for {
data := dd.container_inspect(id)!
if !data.state.running {
break
}
time.sleep(1 * time.second)
}
// Finally, we create the image from the container
// As the tag, we use the epoch value
// TODO also add the base image's name into the image name to prevent
// conflicts.
tag := time.sys_mono_now().str()
image := dd.image_from_container(id, 'vieter-build', tag)!
dd.container_remove(id)!
return image.id
}
pub struct BuildResult {
pub:
start_time time.Time
end_time time.Time
exit_code int
logs string
}
// build_target builds the given target. Internally it calls `build_config`.
pub fn build_target(address string, api_key string, base_image_id string, target &Target, force bool) !BuildResult {
config := target.as_build_config(base_image_id, force)
return build_config(address, api_key, config)
}
// build_config builds, packages & publishes a given Arch package based on the
// provided target. The base image ID should be of an image previously created
// by create_build_image. It returns the logs of the container.
pub fn build_config(address string, api_key string, config BuildConfig) !BuildResult {
mut dd := docker.new_conn()!
defer {
dd.close() or {}
}
build_arch := os.uname().machine
build_script := create_build_script(address, config, build_arch)
// We convert the build script into a base64 string, which then gets passed
// to the container as an env var
base64_script := base64.encode_str(build_script)
c := docker.NewContainer{
image: '${config.base_image}'
env: [
'BUILD_SCRIPT=${base64_script}',
'API_KEY=${api_key}',
// `archlinux:base-devel` does not correctly set the path variable,
// causing certain builds to fail. This fixes it.
'PATH=${build.path_dirs.join(':')}',
]
entrypoint: ['/bin/sh', '-c']
cmd: ['echo \$BUILD_SCRIPT | base64 -d | /bin/bash -e']
work_dir: '/build'
user: '0:0'
}
id := dd.container_create(c)!.id
dd.container_start(id)!
mut data := dd.container_inspect(id)!
// This loop waits until the container has stopped, so we can remove it after
for data.state.running {
time.sleep(1 * time.second)
data = dd.container_inspect(id)!
}
mut logs_stream := dd.container_get_logs(id)!
// Read in the entire stream
mut logs_builder := strings.new_builder(10 * 1024)
util.reader_to_writer(mut logs_stream, mut logs_builder)!
dd.container_remove(id)!
return BuildResult{
start_time: data.state.start_time
end_time: data.state.end_time
exit_code: data.state.exit_code
logs: logs_builder.str()
}
}

216
src/build/queue.v 100644
View File

@ -0,0 +1,216 @@
module build
import models { BuildConfig, Target }
import cron
import time
import datatypes { MinHeap }
import util
struct BuildJob {
pub mut:
// Time at which this build job was created/queued
created time.Time
// Next timestamp from which point this job is allowed to be executed
timestamp time.Time
// Required for calculating next timestamp after having pop'ed a job
ce &cron.Expression = unsafe { nil }
// Actual build config sent to the agent
config BuildConfig
// Whether this is a one-time job
single bool
}
// Allows BuildJob structs to be sorted according to their timestamp in
// MinHeaps
fn (r1 BuildJob) < (r2 BuildJob) bool {
return r1.timestamp < r2.timestamp
}
// The build job queue is responsible for managing the list of scheduled builds
// for each architecture. Agents receive jobs from this queue.
pub struct BuildJobQueue {
// Schedule to use for targets without explicitely defined cron expression
default_schedule &cron.Expression
// Base image to use for targets without defined base image
default_base_image string
mut:
mutex shared util.Dummy
// For each architecture, a priority queue is tracked
queues map[string]MinHeap[BuildJob]
// When a target is removed from the server or edited, its previous build
// configs will be invalid. This map allows for those to be simply skipped
// by ignoring any build configs created before this timestamp.
invalidated map[int]time.Time
}
// new_job_queue initializes a new job queue
pub fn new_job_queue(default_schedule &cron.Expression, default_base_image string) BuildJobQueue {
return BuildJobQueue{
default_schedule: unsafe { default_schedule }
default_base_image: default_base_image
invalidated: map[int]time.Time{}
}
}
// insert_all executes insert for each architecture of the given Target.
pub fn (mut q BuildJobQueue) insert_all(target Target) ! {
for arch in target.arch {
q.insert(target: target, arch: arch.value)!
}
}
[params]
pub struct InsertConfig {
target Target [required]
arch string [required]
single bool
force bool
now bool
}
// insert a new target's job into the queue for the given architecture. This
// job will then be endlessly rescheduled after being pop'ed, unless removed
// explicitely.
pub fn (mut q BuildJobQueue) insert(input InsertConfig) ! {
lock q.mutex {
if input.arch !in q.queues {
q.queues[input.arch] = MinHeap[BuildJob]{}
}
mut job := BuildJob{
created: time.now()
single: input.single
config: input.target.as_build_config(q.default_base_image, input.force)
}
if !input.now {
ce := if input.target.schedule != '' {
cron.parse_expression(input.target.schedule) or {
return error("Error while parsing cron expression '${input.target.schedule}' (id ${input.target.id}): ${err.msg()}")
}
} else {
q.default_schedule
}
job.timestamp = ce.next_from_now()
job.ce = ce
} else {
job.timestamp = time.now()
}
q.queues[input.arch].insert(job)
}
}
// reschedule the given job by calculating the next timestamp and re-adding it
// to its respective queue. This function is called by the pop functions
// *after* having pop'ed the job.
fn (mut q BuildJobQueue) reschedule(job BuildJob, arch string) {
new_timestamp := job.ce.next_from_now()
new_job := BuildJob{
...job
created: time.now()
timestamp: new_timestamp
}
q.queues[arch].insert(new_job)
}
// pop_invalid pops all invalid jobs.
fn (mut q BuildJobQueue) pop_invalid(arch string) {
for {
job := q.queues[arch].peek() or { return }
if job.config.target_id in q.invalidated
&& job.created < q.invalidated[job.config.target_id] {
// This pop *should* never fail according to the source code
q.queues[arch].pop() or {}
} else {
break
}
}
}
// peek shows the first job for the given architecture that's ready to be
// executed, if present.
pub fn (mut q BuildJobQueue) peek(arch string) ?BuildJob {
// Even peek requires a write lock, because pop_invalid can modify the data
// structure
lock q.mutex {
if arch !in q.queues {
return none
}
q.pop_invalid(arch)
job := q.queues[arch].peek() or { return none }
if job.timestamp < time.now() {
return job
}
}
return none
}
// pop removes the first job for the given architecture that's ready to be
// executed from the queue and returns it, if present.
pub fn (mut q BuildJobQueue) pop(arch string) ?BuildJob {
lock q.mutex {
if arch !in q.queues {
return none
}
q.pop_invalid(arch)
mut job := q.queues[arch].peek() or { return none }
if job.timestamp < time.now() {
job = q.queues[arch].pop() or { return none }
if !job.single {
q.reschedule(job, arch)
}
return job
}
}
return none
}
// pop_n tries to pop at most n available jobs for the given architecture.
pub fn (mut q BuildJobQueue) pop_n(arch string, n int) []BuildJob {
lock q.mutex {
if arch !in q.queues {
return []
}
mut out := []BuildJob{}
for out.len < n {
q.pop_invalid(arch)
mut job := q.queues[arch].peek() or { break }
if job.timestamp < time.now() {
job = q.queues[arch].pop() or { break }
if !job.single {
q.reschedule(job, arch)
}
out << job
} else {
break
}
}
return out
}
return []
}
// invalidate a target's old build jobs.
pub fn (mut q BuildJobQueue) invalidate(target_id int) {
q.invalidated[target_id] = time.now()
}

Some files were not shown because too many files have changed in this diff Show More