ara icon indicating copy to clipboard operation
ara copied to clipboard

Search for task warnings

Open watsonb opened this issue 4 years ago • 6 comments

What is the idea ?

When selecting a particular playbook run, I'd like to be able to search (filter) for all tasks that yielded a warning (e.g. deprecation warnings). I think this would be useful for playbook/role maintainers to quickly find tasks that need to be updated for future versions of Ansible.

Bonus points if you can search for task warnings across multiple playbook runs (e.g. in combination with a label, path, name).

watsonb avatar Sep 03 '20 14:09 watsonb

Hey @watsonb and thanks for the issue.

This would be a great idea although I am not sure at this time what the implementation would look like.

We could argue that this is already possible with the help of the API but it's certainly not as efficient as database-level full-text indexing/searching that I think would be appropriate for this kind of feature. A potential blocker for proper full-text indexing is that we currently compress/gzip the results' contents for the sake of storage efficiency.

In the past I hacked something together with the python API client to "grep" for a password/certificate that had leaked through the task results -- I basically iterated through a list of results (ex: https://api.demo.recordsansible.org/api/v1/results) and then for each result, retrieved a detailed version of it which includes the result content (ex: https://api.demo.recordsansible.org/api/v1/results/47145) and then "grep" that for the string.

With the new CLI landing in 1.5, we could do that in bash instead of python -- something roughly like:

for playbook in $(ara playbook list --limit 1000 --path "some/path" -f value -c id); do
    for result in (ara result list --limit 10000 --playbook $playbook -f value -c id); do
        ara result show -f json --with-content $result | egrep -qi "deprecated|deprecation"
        if [ $? == 0 ]; then
            echo "result ${result} from playbook ${playbook} has a deprecation notice"
        fi
    done
done

This works but it's not fast and doesn't scale very well for large playbooks.

I'll leave this issue opened while we figure this out. Thanks !

dmsimard avatar Sep 03 '20 14:09 dmsimard

Thanks for looking at this and offering some alternatives.

watsonb avatar Sep 03 '20 17:09 watsonb

I second the need for this. I miss it from the old ARA.

Screenshot 2020-09-23 at 10 19 30

stefan-marc avatar Sep 23 '20 08:09 stefan-marc

Hey @smarcu92,

I'm not sure if we are talking about the same thing but in 1.5 there is a new result search feature that isn't a 1:1 reproduction from 0.x but based on your screenshot should help, for example: https://api.demo.recordsansible.org/playbooks/1035.html?changed=True#results

dmsimard avatar Sep 23 '20 12:09 dmsimard

Hey @dmsimard,

Thanks for your feedback!

It wold be great to search for a specific string, but what is provided in v1.5 is awesome as well! Really good job!

Any ETA on v1.5? I'm waiting it's release with great enthusiasm! :P

Thanks again!

stefan-marc avatar Sep 23 '20 13:09 stefan-marc

It wold be great to search for a specific string

Yeah, hence why I'll keep this issue opened for now.

Any ETA on v1.5? I'm waiting it's release with great enthusiasm! :P

Today :)

dmsimard avatar Sep 23 '20 16:09 dmsimard