#2551 RFE: add --status option for koji search command
Closed: Invalid by tkopecek. Opened by jiyin.

by default, command 'koji search build namepattern' will return all build names matched, but some of them are are FAILED.

we want only get the builds that is COMPLETE.


What is the usecase? Isn't list-builds better for you?

Metadata Update from @tkopecek:
- Custom field Size adjusted to None

Hi

our usecase:
get latest upstream kernel build

'''
$ koji search build r '^kernel[0-9].*eln' | sort -V -r | head -n1
kernel-5.10.0-0.rc0.20201021git071a0578b0ce.49.eln104
$ koji buildinfo kernel-5.10.0-0.rc0.20201021git071a0578b0ce.49.eln104 | gr=
ep State:
State: FAILED <<<--- but sometimes the latest one is unavailable
'''

Thanks
Jianhong

----- =E5=8E=9F=E5=A7=8B=E9=82=AE=E4=BB=B6 -----

=E5=8F=91=E4=BB=B6=E4=BA=BA: "Tomas Kopecek" pagure@pagure.io
=E6=94=B6=E4=BB=B6=E4=BA=BA: jiyin@redhat.com
=E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: =E6=98=9F=E6=9C=9F=E4=BA=94, 2020=
=E5=B9=B4 10 =E6=9C=88 23=E6=97=A5 =E4=B8=8B=E5=8D=88 3:25:17
=E4=B8=BB=E9=A2=98: [koji] Issue #2551: RFE: add --status option for koji=
search command
=20
=20
tkopecek added a new comment to an issue you are following:
What is the usecase? Isn'tlist-buildsbetter for you?
=20
To reply, visit the link below or just reply to this email
https://pagure.io/koji/issue/2551
=20

Hi

our usecase:
get latest upstream kernel build

'''
$ koji search build r '^kernel[0-9].*eln' | sort -V -r | head -n1
kernel-5.10.0-0.rc0.20201021git071a0578b0ce.49.eln104
$ koji buildinfo kernel-5.10.0-0.rc0.20201021git071a0578b0ce.49.eln104 | gr=
ep State:
State: FAILED <<<--- but sometimes the latest one is unavailable
'''

Thanks
Jianhong

----- =E5=8E=9F=E5=A7=8B=E9=82=AE=E4=BB=B6 -----

=E5=8F=91=E4=BB=B6=E4=BA=BA: "Tomas Kopecek" pagure@pagure.io
=E6=94=B6=E4=BB=B6=E4=BA=BA: jiyin@redhat.com
=E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: =E6=98=9F=E6=9C=9F=E4=BA=94, 2020=
=E5=B9=B4 10 =E6=9C=88 23=E6=97=A5 =E4=B8=8B=E5=8D=88 3:25:17
=E4=B8=BB=E9=A2=98: [koji] Issue #2551: RFE: add --status option for koji=
search command
=20
=20
tkopecek added a new comment to an issue you are following:
What is the usecase? Isn'tlist-buildsbetter for you?
=20
To reply, visit the link below or just reply to this email
https://pagure.io/koji/issue/2551
=20

So, you want latest 'eln' kernel. In such case you're looking for different command: koji latest-build eln kernel

..or `koji eln-updates-candidate kernel --depends on if you want candidate build or final one.

So, you want latest 'eln' kernel. In such case you're looking for different command: koji latest-build eln kernel

cool, I didn't know there's just a latest-build command :)
that's great, thanks tkopecek!

Metadata Update from @tkopecek:
- Issue close_status updated to: Invalid
- Issue status updated to: Closed (was: Open)

I'm thinking if we don't know the tag name, just know the build name looks like(pattern)
we still need --state option to filter out the FAILED build,,

for example want get latest kerenl build "kernel-..el8" "kernel-..el8.dt.*"

You can try this API call with json result like this

koji call listBuilds --kwargs="{'state': 1, 'prefix': 'kernel', 'queryOpts': {'limit': 10, 'order': '-build_id'}}" --json | jq '.[].nvr' -r | grep dt | head -1

'state': 1 is COMPLETE - https://pagure.io/koji/blob/master/f/koji/init.py#_195

Filed https://pagure.io/koji/issue/2554 for list-builds enhancement

----- =E5=8E=9F=E5=A7=8B=E9=82=AE=E4=BB=B6 -----

=E5=8F=91=E4=BB=B6=E4=BA=BA: "Yuming Zhu" pagure@pagure.io
=E6=94=B6=E4=BB=B6=E4=BA=BA: jiyin@redhat.com
=E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: =E6=98=9F=E6=9C=9F=E4=BA=94, 2020=
=E5=B9=B4 10 =E6=9C=88 23=E6=97=A5 =E4=B8=8B=E5=8D=88 6:02:39
=E4=B8=BB=E9=A2=98: [koji] Issue #2551: RFE: add --status option for koji=
search command
=20
=20
julian8628 added a new comment to an issue you are following:
``
You can try this API call wich json result like this
call listBuilds --kwargs=3D"{'state': 1, 'prefix': 'kernel', 'queryOpts': {'limit': 10, 'order': '-build_id'}}" --json | jq '.[].nvr' -r | grep dt = | head -1

It works, but requiring users to manually edit json (or yml, xml) is
not a good user experience..

=20
'state': 1 is COMPLETE -
https://pagure.io/koji/blob/master/f/koji/init.py#_195
``
=20
To reply, visit the link below or just reply to this email
https://pagure.io/koji/issue/2551
=20

Not knowing tag looks like a disaster candidate. Why would anyone want to know latest build in koji? It doesn't say anything. You don't know if it is a valid build for any product, if it was even meant to be a regular build or if it is a mistake. Only properly tagged builds make sense to be used for anything.

Not knowing tag looks like a disaster candidate. Why would anyone want to know latest build in koji? It doesn't say anything. You don't know if it is a valid build for any product, if it was even meant to be a regular build or if it is a mistake. Only properly tagged builds make sense to be used for anything.

I think there is a subtle reason that our tag naming is too random and too long. On the contrary, the suffix of the build name is simpler and easier to remember. That is why we prefer to use the build name pattern to search for packages. (kernel.-4..el8$ kernel-[0-9]..elrdy$ ,,,)

If prefer to search with tags, it’s better to have a specific page to explain the meaning of each tag, or the naming rules of tags.

Why would anyone want to know latest build in koji?
for QE team, they use latest build to do early test.

Why would anyone want to know latest build in koji?
for QE team, they use latest build to do early test.

Yes, but "latest build" is a non-sense in a way you are using it. Logic of "latest" in koji is not the latest by time or by NVR. Latest is the latest tagged into given tag. Latest built != latest confirmed to be used. So, you'll probably end with the right build in most cases but not deterministically and not every time.

There is not many active targets in koji (https://koji.fedoraproject.org/koji/buildtargets) if you ignore all those *-side-\d+ which are sidetags for personal use. I don't know what product or workflow are you focusing on.

/just wanting to help with better workflow, you can of course use your approach, but it looks to be error-prone/

Why would anyone want to know latest build in koji?
for QE team, they use latest build to do early test.

Yes, but "latest build" is a non-sense in a way you are using it. Logic of "latest" in koji is not the latest by time or by NVR. Latest is the latest tagged into given tag. Latest built != latest confirmed to be used. So, you'll probably end with the right build in most cases but not deterministically and not every time.

There is not many active targets in koji (https://koji.fedoraproject.org/koji/buildtargets) if you ignore all those *-side-\d+ which are sidetags for personal use. I don't know what product or workflow are you focusing on.

We are focusing on RHEL kernel test workflow (and use brew /koji in intranet/)
there are many(8200+) targets in brew (https://brewweb.engineering.redhat.com/brew/buildtargets)

/just wanting to help with better workflow, you can of course use your approach, but it looks to be error-prone/
I understand what you mean and thank you very much for your suggestions.
and will recommend the build team to improve the management of tag naming.

This issue has been migrated to Fedora Forge:
https://forge.fedoraproject.org/koji/koji/issues/2551

Please continue any further discussion there.

Metadata