go x/build/cmd/retrybuilds: ignores -builder argument when -loghash is specified

kb5ga3dv  于 6个月前  发布在  Go
关注(0)|答案(2)|浏览(44)

对于以下每次调用:

go run retrybuilds.go -builder freebsd-arm-paulzhol -key ~/path/to/key -branch release-branch.go1.11 -loghash e46f527e53acd7ec0053e9bbcf5ade31024faa72
go run retrybuilds.go -builder host-freebsd-arm-paulzhol -key ~/path/to/key -branch release-branch.go1.11 -loghash e46f527e53acd7ec0053e9bbcf5ade31024faa72
go run retrybuilds.go -builder typo-host-freebsd-arm-paulzhol -key ~/path/to/key -branch release-branch.go1.11 -loghash e46f527e53acd7ec0053e9bbcf5ade31024faa72

Jmeter 板响应如下:

2018/08/17 13:51:51 Clearing freebsd-arm-paulzhol, hash 807e7f2420c683384dc9c6db498808ba1b7aab17
2018/08/17 13:51:52 Dashboard error: invalid key "XXXXXXXXXXXXXXXXXXXX" for builder "freebsd-arm-paulzhol"
exit status 1

认证失败的原因是 failures() 函数内部使用的 https://build.golang.org/?mode=failures&branch=release-branch.go1.11 端点返回了一个旧式构建器名称(freebsd-arm-paulzhol 而不是 host-freebsd-arm-paulzhol):

807e7f2420c683384dc9c6db498808ba1b7aab17 darwin-amd64-10_10 https://build.golang.org/log/5bb9038d7ab8345880bc9801458b11943ef360b4
807e7f2420c683384dc9c6db498808ba1b7aab17 freebsd-arm-paulzhol https://build.golang.org/log/e46f527e53acd7ec0053e9bbcf5ade31024faa72
807e7f2420c683384dc9c6db498808ba1b7aab17 linux-amd64-longtest https://build.golang.org/log/d33696be77944dc640a4b2e269e496f7f939e982
807e7f2420c683384dc9c6db498808ba1b7aab17 linux-amd64-nocgo https://build.golang.org/log/772e6432980b375acc5c1c56388f8beb22444039
807e7f2420c683384dc9c6db498808ba1b7aab17 linux-ppc64-buildlet https://build.golang.org/log/5b26c2423570dd4ef45a31c4c22181709dfa0552
807e7f2420c683384dc9c6db498808ba1b7aab17 windows-arm https://build.golang.org/log/90e43643ee340cb455cbf940cf25f738eb80652f
807e7f2420c683384dc9c6db498808ba1b7aab17 plan9-386 https://build.golang.org/log/8a8b44a262f70706831d9ca00d6f1adfb1be21f4

需要正确的构建器名称来验证密钥:
https://github.com/golang/build/blob/ef878539c7d7b3c385a0670fa85bad3878fcc879/app/appengine/handler.go#L1020-L1024
注意,如果没有使用 -loghash,而是直接指定了提交哈希值 -hash,则命令行参数 -builder 被正确使用,不会查询 /?mode=failures 端点。
/cc @bradfitz

hgtggwj0

hgtggwj01#

作为临时解决方案,将failures()返回的构建器名称替换为*builder应该有效。但是,可能需要在retrybuild客户端或Dashboard AuthHandler中调用类似于mapBuilderToHostType https://github.com/golang/build/blob/64a630379a90769340966d6de6b38db589132909/cmd/coordinator/reverse.go#L606 的功能。

相关问题