feat(besadii): Propagate Gerrit change ID & patchset to Buildkite
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>
This commit is contained in:
parent
1397cbce52
commit
0bb24ed700
1 changed files with 9 additions and 4 deletions
|
@ -51,13 +51,17 @@ type Build struct {
|
|||
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,
|
||||
|
|
Loading…
Reference in a new issue