diff options
author | Vincent Ambo <mail@tazj.in> | 2020-06-29T01·16+0100 |
---|---|---|
committer | tazjin <mail@tazj.in> | 2020-06-29T01·19+0000 |
commit | 0bb24ed70013a7f9cfa4eed612decdf4715effba (patch) | |
tree | ede9a29b16b8394ad81740b45a6a74f73437cb6f | |
parent | 1397cbce522d8b0876e1854848b650980211c8c4 (diff) |
feat(besadii): Propagate Gerrit change ID & patchset to Buildkite r/1122
I previously implemented this in a CL that ended up being abandoned, but it turns out we need it for the hook setup, anyways. These environment variables become available during the build and, crucially, to the post-build hooks. Change-Id: Id6c1657947995e8bae1fa7b76184dd8be4c01525 Reviewed-on: https://cl.tvl.fyi/c/depot/+/739 Reviewed-by: Kane York <rikingcoding@gmail.com>
-rw-r--r-- | ops/besadii/main.go2 | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/ops/besadii/main.go2 b/ops/besadii/main.go2 index bbbecda85d8a..3acc8d8da8ff 100644 --- a/ops/besadii/main.go2 +++ b/ops/besadii/main.go2 @@ -47,17 +47,21 @@ type Author struct { // Build is the representation of a Buildkite build as described on // https://buildkite.com/docs/apis/rest-api/builds#create-a-build type Build struct { - Commit string `json:"commit"` - Branch string `json:"branch"` - Message string `json:"message"` - Author Author `json:"author"` + Commit string `json:"commit"` + Branch string `json:"branch"` + Message string `json:"message"` + Author Author `json:"author"` + Env map[string]string `json:"env"` } // Trigger a build of a given branch & commit on Buildkite func triggerBuild(log *syslog.Writer, token string, update *refUpdated) error { var message string + env := make(map[string]string) if update.changeId != nil && update.patchset != nil { + env["GERRIT_CHANGE_ID"] = *update.changeId + env["GERRIT_PATCHSET"] = *update.patchset message = fmt.Sprintf(":llama: depot @ https://cl.tvl.fyi/c/depot/+/%s/%s", *update.changeId, *update.patchset) } else { message = fmt.Sprintf(":llama: depot @ %s", update.commit) @@ -67,6 +71,7 @@ func triggerBuild(log *syslog.Writer, token string, update *refUpdated) error { Commit: update.commit, Branch: update.ref, Message: message, + Env: env, Author: Author{ Name: update.submitter, Email: update.email, |