From a6098d39a0c6f66945bac579dcde84386254a6f6 Mon Sep 17 00:00:00 2001 From: Kexy Biscuit Date: Wed, 31 Jul 2024 18:32:56 +0800 Subject: [PATCH] feat: allow setting extra pushpkg options from environment variable --- README.md | 6 +++--- worker/src/build.rs | 1 + worker/src/lib.rs | 9 +++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0fb4249..e99d1a3 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,11 @@ Steps (as root): 2. `cd /buildroots/buildit && git clone https://github.com/AOSC-Dev/buildit` 3. `cd /buildroots/buildit && ciel new` with maintainer called `AOSC OS Maintainers `, making sure to create an instance named "main" when asked 4. `cp /buildroots/buildit/buildit/systemd/buildit-worker.service /etc/systemd/system` -5. `$EDITOR /etc/systemd/system/buildit-worker.service`:update ARCH -6. `$EDITOR /buildroots/buildit/buildit/.env`: set BUILDIT_SERVER, BUILDIT_WORKER_SECRET BUILDIT_SSH_KEY and BUILDIT_WORKER_PERFORMANCE; for workers in China, optionally update BUILDIT_RSYNC_HOST to repo-cn.aosc.io +5. `$EDITOR /etc/systemd/system/buildit-worker.service`:update `ARCH` +6. `$EDITOR /buildroots/buildit/buildit/.env`: set `BUILDIT_SERVER`, `BUILDIT_WORKER_SECRET` `BUILDIT_SSH_KEY` and `BUILDIT_WORKER_PERFORMANCE`; for workers in China, optionally update `BUILDIT_RSYNC_HOST` to `repo-cn.aosc.io`; for workers with special network environments, optionally set `BUILDIT_PUSHPKG_OPTIONS` 7. `systemctl enable --now buildit-worker` 8. `chmod 600 /buildroots/buildit/buildit/.env` -9. Generate a new SSH key at the location of BUILDIT_SSH_KEY, and setup authorized_keys on repo.aosc.io (contact infra team) +9. Generate a new SSH key at the location of `BUILDIT_SSH_KEY`, and setup `authorized_keys` on repo.aosc.io (contact infra team) 10. Add SSH known hosts from repo.aosc.io, repo-cn.aosc.io and github.com: `ssh-keyscan repo.aosc.io >> ~/.ssh/known_hosts && ssh-keyscan repo-cn.aosc.io >> ~/.ssh/known_hosts && ssh-keyscan github.com >> ~/.ssh/known_hosts` Arch-specific notes: diff --git a/worker/src/build.rs b/worker/src/build.rs index 03550bb..b11f531 100644 --- a/worker/src/build.rs +++ b/worker/src/build.rs @@ -293,6 +293,7 @@ async fn build( &args.rsync_host, "-i", upload_ssh_key, + &args.pushpkg_options, "maintainers", &job.git_branch, ]; diff --git a/worker/src/lib.rs b/worker/src/lib.rs index cb1855c..183c627 100644 --- a/worker/src/lib.rs +++ b/worker/src/lib.rs @@ -47,6 +47,15 @@ pub struct Args { )] pub rsync_host: String, + /// pushpkg extra options + #[arg( + short, + long, + default_value = "", + env = "BUILDIT_PUSHPKG_OPTIONS" + )] + pub pushpkg_options: String, + /// Performance number of the worker (smaller is better) #[arg(short = 'p', long, env = "BUILDIT_WORKER_PERFORMANCE")] pub worker_performance: Option,