turbot/aws_insights

Query: codecommit_repositories_for_codebuild_project

Usage

powerpipe query aws_insights.query.codecommit_repositories_for_codebuild_project

SQL

select
distinct r.arn as codecommit_repository_arn
from
aws_codebuild_project as p
left join aws_codecommit_repository as r on r.clone_url_http in (
with code_sources as (
select
source,
secondary_sources
from
aws_codebuild_project
where
arn = $1
and account_id = split_part($1, ':', 5)
and region = split_part($1, ':', 4)
)
select source ->> 'Location' as "Location" from code_sources
union all
select s ->> 'Location' as "Location" from code_sources, jsonb_array_elements(secondary_sources) as s
)
where
r.arn is not null
and p.arn = $1
and p.account_id = split_part($1, ':', 5)
and p.region = split_part($1, ':', 4);