about summary refs log tree commit diff
path: root/ops/besadii/main.go
AgeCommit message (Collapse)AuthorFilesLines
2021-12-14 r/3237 feat(besadii): Make Gerrit label configurableÅsmund Østvold1-5/+11
By default besadii will set the `Verified` label in Gerrit. This adds a config option to set a different label instead if desired. Co-authored-by: Vincent Ambo <mail@tazj.in> Change-Id: I254159e46994e01182987ed5e5e26e27c57f46ce
2021-12-07 r/3150 chore(besadii): Improve error messages on parse failureVincent Ambo1-2/+2
Change-Id: I3cc4637aca8a940a0fdeca2d8bd6ac620ea384c0
2021-12-07 r/3149 fix(ops/besadii): Unquote Gerrit's extra-quotes around emailsVincent Ambo1-0/+6
Gerrit wraps RFC5322 emails in another layer of quotes when passing them as flags, and this needs to be unquoted. Otherwise hook invocations fail with cryptic errors. Change-Id: Ieeb74c662873d99a4154f8cbc92da77b039cb88e
2021-12-06 r/3146 fix(ops/besadii): Pass Build.Author to BuildkiteVincent Ambo1-12/+47
Extracts author information from the flags passed by Gerrit and moves them along to Buildkite. This should display the owners of builds correctly in the UI, rather than marking everything as coming from me. Change-Id: If9efe5553a13f0dbdb8bf3936c1d341ae5922318
2021-12-02 r/3137 refactor(ops/besadii): Get config from home directory by defaultVincent Ambo1-1/+16
Slightly more ergonomic in some setups. Change-Id: I565f2d242852ffd299ef5d5740a47520187dd4b4
2021-12-02 r/3136 refactor(ops/besadii): Generalise for use with non-TVL URLsVincent Ambo1-46/+30
This makes it possible to use besadii for any TVL-ish setup using Gerrit and Buildkite, with the same hook functionality as for TVL. Change-Id: I1144b68d7ec01c4c8e34f7bee4da590f2ff8c53c
2021-12-02 r/3135 feat(ops/besadii): Add other missing configuration keysVincent Ambo1-0/+24
Adds configuration keys and rudimentary validation for all other besadii settings that are currently hardcoded. This adds the config options: * repository: Name of the repository in Gerrit. * branch: Name of the HEAD branch in the repository. * gerritUrl: Base URL of the Gerrit instance * gerritUser: Username of the Gerrit user * gerritPassword: Password of the Gerrit user * buildkiteOrg: Name of the Buildkite organisation * buildkiteProject: Name of the pipeline inside the Buildkite organisation * buildkiteToken: Auth token for Buildkite access All of these configuration options are required. Change-Id: Ie6b109de9cd8484a3773c6351d7fd140f39a49ed
2021-12-02 r/3133 refactor(ops/besadii): Move Sourcegraph config to a fileVincent Ambo1-20/+56
Initial step towards moving besadii away from hardcoded values and onto config files. This is required because I want to reuse besadii outside of the TVL context. Change-Id: Id4fa7a49c5d4f876a02b202f04a421ab5ba0dcc4
2021-12-01 r/3125 feat(besadii): Support invocation as different Gerrit hooksVincent Ambo1-67/+117
Removes besadii support for the previously used 'ref-updated' hook and instead introduces support for the 'change-merged' and 'patchset-created' hooks. These hooks more accurately capture the semantics of when besadii should trigger CI builds and using them will avoid problems such as skipping 'canon' builds if chains of CLs are submitted together. Change-Id: Ib90356c069780bf0c0250e56b927e46a5b31ce7f
2021-11-29 r/3105 refactor(besadii): Rename refUpdated -> buildTriggerVincent Ambo1-34/+40
We are changing the Gerrit hooks which invoke besadii, but this structure will be used for both kinds. Change-Id: Idb1cb0c640d2c42db8e7af39f3ab372a97bfef91
2021-11-28 r/3102 fix(ops/besadii): Trim whitespace of auth tokensVincent Ambo1-4/+7
This is causing failures when trying to update Sourcegraph at least, for good measure I've trimmed both. Change-Id: I40266ee83b4e266ffe50f16bb365eb2e51952513
2021-09-18 r/2888 feat(besadii): Link to started builds in CL commentsVincent Ambo1-5/+35
This makes it easier to click through to a build from Gerrit after submitting a CL. Change-Id: Ic5c6eeb81c87bc4ea23c5c5ca25704434b081fd0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3572 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi>
2021-09-18 r/2887 refactor(besadii): Extract logic for posting review commentsVincent Ambo1-42/+50
Currently besadii only posts comments when builds succeed, but it might be very useful to also have a link to a build when the build is started. This just shuffles code around. The only functional change is that the `labels` field in the review input is marked as `omitempty`, as this will not be needed when posting the build start comment. Change-Id: Id4a43fad8817c9a15da02f01ab2b781d48b46978 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3571 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi>
2021-08-24 r/2757 feat(besadii): Tag gerrit comments as autogeneratedGriffin Smith1-7/+10
This is a bit of an under-documented feature, but if the "tag" field for a gerrit review starts with the string "autogenerated:<something>~<something-else>", only the last comment per instance of <something> will be shown by default on the CL page (with the rest viewable by toggling the "Show all entries" switch). The idea behind the "<something-else>" tag is to be used for the "type" of comment within a particular system - gerrit's documentation gives the example of one tag for "the build is running" and another for "the build has finished, here's the result". Change-Id: I9199a6ed97beca1b3a51ec5d6230c6c8358ba2b3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3374 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2021-04-12 r/2494 chore(besadii): Stop passing explicit messages to BuildkiteVincent Ambo1-6/+0
Dropping the message field will make Buildkite use the commit messages instead, which makes for much more readable build logs. Change-Id: I1849f811632526893b700f117c9f6cf64888c329 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2949 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2021-01-30 r/2159 chore(3p|nix): Remove typed GoVincent Ambo1-0/+316
Nobody has actually done any experimentation with typed Go, so we're getting rid of it for now - it's causing annoying IFD during build graph generation. Change-Id: Ibac3dea98ebed1b3ee08acda184d24c500cf695d Reviewed-on: https://cl.tvl.fyi/c/depot/+/2458 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: Profpatsch <mail@profpatsch.de>
2020-06-18 r/1018 chore(besadii): Make besadii a Go2 projectVincent Ambo1-202/+0
Change-Id: Id5aef73b131252fb9c880dd95fc72bfe083f1b75
2020-06-13 r/931 feat(besadii): Adapt into a Gerrit ref-updated-hookVincent Ambo1-61/+60
Besadii was previously invoked as a git post-update hook, but Gerrit does not use these hooks and instead has its own concept of hooks. This change adapts besadii to be compatible with the way Gerrit hooks are invoked (arguments being passed as flags, rather than via stdin). Change-Id: I487b3a9e15810583bc5442fdc024ee2771c580cb
2020-06-12 r/916 feat(camden): Move cgit to code.tvl.fyiVincent Ambo1-5/+5
Moves the host at which cgit is served to 'code.tvl.fyi'. Also updates related projects that link to this, most importantly: * Hound's & Gerrit's cgit link bases have been updated * besadii is updated to request CI builds for the new location Change-Id: I44e3e584010ac29cc913ebb1a197c996eb024d80 Reviewed-on: https://cl.tvl.fyi/c/depot/+/71 Reviewed-by: lukegb <lukegb@tvl.fyi>
2020-02-21 r/574 fix(ops/besadii): Remove branch tag after checking for itVincent Ambo1-1/+2
... oops. The problem with working on besadii is that testing it always lags one commit behind.
2020-02-21 r/572 fix(ops/besadii): Do not trigger builds for deleted branchesVincent Ambo1-7/+12
2020-02-21 r/571 fix(ops/besadii): Include branch name in build noteVincent Ambo1-1/+1
2020-02-21 r/570 fix(ops/besadii): Clone from git.tazj.in, not git.camden.*Vincent Ambo1-1/+1
2020-02-21 fix(ops/besadii): Only trigger builds for branchesVincent Ambo1-1/+5
2020-02-21 fix(ops/besadii): Replace slashes in branch namesVincent Ambo1-5/+7
Submitting a build with a branch containing a slash (which is common for my branches) returns this error: Invalid tag name, tags must use lowercase alphanumeric characters, underscores, dashes, or dots This commit replaces all slashes with underscores to work around that.
2020-02-21 feat(ops/besadii): Run 'git update-server-info' at startupVincent Ambo1-1/+13
Since besadii is effectively the entire post-receive hook, it also needs to do the entire job of the hook.
2020-02-21 fix(ops/besadii): Send auth token in correct formatVincent Ambo1-1/+1
2020-02-21 refactor(ops/besadii): Log to syslog instead of stdoutVincent Ambo1-10/+19
2020-02-21 feat(ops/besadii): Use post-receive hook input to trigger buildsVincent Ambo1-2/+48
Parses the input passed to besadii from git to extract ref updates and trigger builds.
2020-02-21 feat(ops/besadii): Read sourcehut token from secrets file on diskVincent Ambo1-7/+7
2020-02-21 chore(ops/besadii): Fail if sourcehut token is unsetVincent Ambo1-2/+7
2020-02-21 feat(ops/besadii): Refactored tool to trigger sourcehut buildsVincent Ambo1-0/+119
Refactors //ops/sync-gcsr which was previously responsible for synchronising the git repository between GCSR and the git.tazj.in cgit instance to simply be responsible for triggering builds on sourcehut. This program is intended to run as a git post-update hook. Note: Not yet feature complete, as interpolation of concrete git values and also sourcehut secrets is missing.