Closed vielmetti closed 2 years ago
Here's a thing you can do that isn't yet in the published mod.
First, add a variable. It can go into any of the .sp files because variables are scoped to the mod. Here's mine in issue.sp
.
variable "repo_name_regex" {
type = string
description = "A regex pattern to scope the set of repos to check. Press Enter to check all."
}
Then use it in the controls. Here's the only place where I've used it so far.
control "issue_older_30_days" {
title = "Issues should not be open longer than 30 days"
description = "Issues should be resolved or closed in a timely manner."
sql = <<-EOT
select
i.html_url as resource,
case
when i.created_at <= (current_date - interval '30' day) then 'alarm'
else 'ok'
end as status,
'#' || i.issue_number || ' ' || i.title || ' created ' || to_char(i.created_at , 'DD-Mon-YYYY') ||
' (' || extract(day from current_timestamp - i.created_at) || ' days).' as reason,
i.repository_full_name
from
github_my_repository as r
left join github_issue as i on r.full_name = i.repository_full_name
where
r.fork = ${local.include_forks} and i.state = 'open'
and r.full_name ~ '${var.repo_name_regex}' -- this is the new bit
EOT
}
Now when I do this:
steampipe check control.issue-older-30-day
Steampipe says:
Variables defined with no value set.
var.repo_name_regex
A regex pattern to scope the set of repos to check. Press Enter to check all.
Enter a value:
I say: turbot/steampipe-(plugin|mod)
Thanks! I'll try this next.
@vielmetti just wanting to know if you tried this and have any other issues faced? The "ERROR: context deadline exceeded" is addressed already. @judell anything we need to work out here or we close this issue?
Marking this closed, as the plugin is addressed with the latest SDK updates. Re-open if necessary.
Describe the bug
If you have way too many repos, eventually something will time out with "ERROR: context deadline exceeded" after about 12 minutes.
Steampipe version (
steampipe -v
)v0.8.4
Plugin version (
steampipe plugin list
)turbot/github@latest: v0.6.1
To reproduce
Get lots of repos that have lots of issues in them.
Run
steampipe check all
from this repo.Expected behavior
All checks complete.
Additional context
Command took 12 minutes 36 seconds to complete.