Skip to content

Commit

Permalink
Merge pull request #60 from okurz/feature/investigate_filter_poo80830
Browse files Browse the repository at this point in the history
openqa-investigate: Allow to filter out by name, job group, parent group, no group
  • Loading branch information
okurz committed Dec 11, 2020
2 parents db5fdeb + 9d8a4fd commit 519a6dc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions openqa-investigate
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ scheme="${scheme:-"https"}"
host_url="$scheme://$host"
dry_run="${dry_run:-"0"}"
prio_add="${prio_add:-"100"}"
exclude_name_regex="${exclude_name_regex:-":investigate:"}"
exclude_no_group="${exclude_no_group:-"true"}"
# exclude_group_regex checks a combined string "<parent job group name> / <job group name>"
exclude_group_regex="${exclude_group_regex:-"Development.*/ "}"
client_args="--json-output --host $host_url"
echoerr() { echo "$@" >&2; }

Expand Down Expand Up @@ -98,6 +102,10 @@ investigate() {
[[ $? != 0 ]] && echoerr "unable to query job data for $id: $job_data" && return 1
old_name="$(echo "$job_data" | jq -r '.job.test')"
[[ "$old_name" =~ ":investigate:" ]] && echo "Job is ':investigate:' already, skipping investigation" && return 0
[[ "$old_name" =~ $exclude_name_regex ]] && echo "Job name '$old_name' matches \$exclude_name_regex '$exclude_name_regex', skipping investigation" && return 0
group="$(echo "$job_data" | jq -r '.job.group + " / " + .job.parent_group')"
[[ "$group" = " / " ]] && [[ "$exclude_no_group" = "true" ]] && echo "Job w/o job group, \$exclude_no_group is set, skipping investigation" && return 0
[[ "$group" =~ $exclude_group_regex ]] && echo "Job group '$group' matches \$exclude_group_regex '$exclude_group_regex', skipping investigation" && return 0

# Optionally we can find "first failed", could extend openQA investigation
# method instead for we are just working based on supplied job which can
Expand Down

0 comments on commit 519a6dc

Please sign in to comment.