# extract buildinfo and save it to ES
todo from reproducible-build flow
```
after build rpm, and upload buildinfo.yaml, rpmbuild to server
|
v
$result_root/rpmbuild.yaml ---> rpmbuild.json ---> merge to stats.json
$result_root/rpmbuild_info.yaml ---> rpmbuild_info.json ---> merge to stats.json
|
v
save stats.json to ES db # 为compare, diifoscope 提供数据源
eg:
{
"id": xxx,
"os": "openeuler",
"arch": "aarch64"
"stats": {
"rpmbuild.hash_value": xxx,
```
## TODO1: improve compass-ci/sbin/result2stats, extract-stats service call it
support extract buildinfo
usage: result2stats $result_root
```
...
$result_root/rpmbuild ---> rpmbuild.json ---> merge to stats.json
$result_root/buildinfo.yaml ---> buildinfo.json ---> merge to stats.json
...
```
### input: result_root/buildinfo(buildinfo.yaml)
- e.g. samba_4.9.5+dfsg-5+deb10u2_arm64.buildinfo
```
Format: 1.0
Source: samba
Binary: samba samba-libs samba-common samba-common-bin smbclient samba-testsuite registry-tools samba-dev python-samba samba-dsdb-modules samba-vfs-modules libsmbclient libsmbclient-dev winbind libpam-winbind libnss-winbind libwbclient0 libwbclient-dev ctdb
Architecture: all arm64 source
Version: 2:4.9.5+dfsg-5+deb10u2
Checksums-Md5:
79ffac5466e2b36633e0f429644407d0 3211 samba_4.9.5+dfsg-5+deb10u2.dsc
d523774b75cc4d31dce4696d41d68b8f 536500 winbind_4.9.5+dfsg-5+deb10u2_arm64.deb
...
Checksums-Sha1:
b8c10499c1b6b7c5111c7f2d8d617ed8a2ff938e 3211 samba_4.9.5+dfsg-5+deb10u2.dsc
1569bfdb4399f92852863f67153cce046a0cbb38 536500 winbind_4.9.5+dfsg-5+deb10u2_arm64.deb
...
Checksums-Sha256:
c9094fcc63930f665707c596134ea64e44d433d3882b3de544c2a83f574aafb9 3211 samba_4.9.5+dfsg-5+deb10u2.dsc
3304c2fa4f7204682747bed70f7ce61b134b21f063f9ebab0aeb2e3af645b744 536500 winbind_4.9.5+dfsg-5+deb10u2_arm64.deb
...
Build-Origin: Debian
Build-Architecture: arm64
Build-Date: Sun, 30 Jan 2022 09:27:50 +0000
Installed-Build-Depends:
adduser (= 3.118),
zlib1g-dev (= 1:1.2.11.dfsg-1)
...
Environment:
DEB_BUILD_OPTIONS="parallel=128"
SOURCE_DATE_EPOCH="1638005690"
```
### output result_root/buildinfo.json
```
{
"Hash": "SHA512",
"Format": 1.0,
"Build-Architecture": "i386",
"Source": "fweb (1.62-12)",
"Binary": "fweb fweb-doc",
"Architecture": "all i386",
"Version": "1.62-12+b2",
"Binary-Only-Changes":
"fweb (1.62-12+b2) sid; urgency=low, binary-only=yes
.
* Binary-only non-maintainer upload for amd64; no source changes.
* Rebuild for multiarch sync
.
-- amd64 / i386 Build Daemon (brahms) <buildd_amd64-brahms(a)buildd.debian.org> Wed, 30 May 2012 09:48:12 +0200 18:37:51 +0000",
...
}
```
## TODO2: save buildinfo to job(ES)
extract-service load $result_root/buildinfo.json
- option1: merge job['buildinfo'](job['record']['buildinfo'])
meeting record:
job.record.build.xxx: v => possible solution option1
通用性好 (job['record']['buildinfo'][xxx])
结构较复杂
job.info.build.xxx: v
效果同上
value type:
- output binary hash
- info (xxx.rpm)
job['buildinfo']
结构简单,但只适用与构建任务,目前未发现其它类型的job有这种需求,如需使用buildinfo进行搜索,那这种方式更简单
**job like:**
```
{
"id": xxx,
"os": "openeuler",
...
"buildinfo": {
"Hash": "SHA512",
"Format": 1.0,
...
}
}
```
**advantage:**
1. reuse job['buildinfo'] to submit again # we can also merge it to job.yaml
2. 3rd tool such as: `diffoscope` get job['buildinfo']
**disadvantage:**
1. compare need get metric from buildinfo in addition
- option2: merge buildinfo to job['stats'], job like:
```
{
"id": xxx,
"os": "openeuler",
"stats": {
"buildinfo.Hash": "SHA512",
"buildinfo.Format": 1.0,
...
}
}
```
advantage / disadvantage: opposite of option1
job.stats.rpmbuild.xxx
job['stats']['rpmbuild.xxx']
compare 不好区分buildinfo 和 rpmbuild
需要变动lkp-tests/stats/rpmbuild,且buildinfo > result_root/rpmbuild
job.stats.buildinfo.xxx => possible solution option2
job['stats']['buildinfo.xxx']
extract-stats 已经支持,无需改动代码
仅仅将buildinfo信息输出未 result_root/buildinfo.yaml
compare 性能结果时忽略 buildinfo (可以新加perf-metric-ignore规则)
job.stats.message.xxx / job.stats.xxx.message
目前.message, .log 已经是perf-metric-ignore规则,可以考虑将buildinfo也加进去
job.stats.info.build.buildinfo.xhhhhhxx => possible solution
通用性更好,相当于对metric有个全面的分类
结构较多
job.buildinfo.xxx(in option1)
- option3: option1 + option2
job like:
```
{
"id": xxx,
"os": "openeuler",
...
"buildinfo": {
"Hash": "SHA512",
"Format": 1.0,
...
},
"stats": {
"buildinfo.Hash": "SHA512",
"buildinfo.Format": 1.0,
...
}
}
```
**advantage: opton1 + option2 **
**disadvantage:**
1. job bigger, --> save DB
2. extract-service does one more thing