feat(ops/besadii): Make branch key cl/XXXX

The branch key for buildkite builds isn't actually used to fetch if a
commit is given - instead, it's just a visual grouping of multiple
builds. This means we can just make the branch key cl/<cl number>, which
is the convention we already use to refer to CLs and gets us a nice
visual grouping of builds of successive patchsets of the same CL number,
even though the ref we're providing isn't a real ref.

Change-Id: Iaa9111297a88f965fda94cd8266240106f58a100
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4347
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Autosubmit: grfn <grfn@gws.fyi>
This commit is contained in:
Griffin Smith 2021-12-15 18:35:57 -05:00 committed by clbot
parent 7f593781f3
commit b075b1df9d

View file

@ -28,6 +28,7 @@ import (
"path"
"regexp"
"strconv"
"strings"
)
// Regular expression to extract change ID out of a URL
@ -202,9 +203,12 @@ func triggerBuild(cfg *config, log *syslog.Writer, trigger *buildTrigger) error
headBuild = false
}
// The branch doesn't have to be a real ref (it's just used to group builds), so make it the identifier for the CL
branch := fmt.Sprintf("cl/%v", strings.Split(trigger.ref, "/")[3])
build := Build{
Commit: trigger.commit,
Branch: trigger.ref,
Branch: branch,
Env: env,
Author: Author{
Name: trigger.author,