more work on clonedev
This commit is contained in:
parent
d39af3d181
commit
b44a4bf7ef
2 changed files with 35 additions and 22 deletions
|
@ -11,24 +11,22 @@ lookups:
|
||||||
- "users/luca"
|
- "users/luca"
|
||||||
extra_headers:
|
extra_headers:
|
||||||
- "Authorization: token ${TOKEN}"
|
- "Authorization: token ${TOKEN}"
|
||||||
# - name: "github_starred_repos"
|
- name: "github_starred_repos"
|
||||||
# api_url: "https://api.github.com"
|
api_url: "https://api.github.com"
|
||||||
# endpoint: "starred"
|
endpoint: "starred"
|
||||||
# url_field: "ssh_url"
|
url_field: "ssh_url"
|
||||||
# token_cmd: "rbw get 'Github' -f 'Clonedev PAT'"
|
token_cmd: "rbw get 'Github' -f 'Clonedev PAT'"
|
||||||
# block_unsorted: true
|
block_unsorted: true
|
||||||
# targets:
|
targets:
|
||||||
# - "users/ssnailed"
|
- "users/ssnailed"
|
||||||
# extra_headers:
|
extra_headers:
|
||||||
# - "Authorization: Bearer ${TOKEN}"
|
- "Authorization: Bearer ${TOKEN}"
|
||||||
# - name: "tralios_gitlab"
|
# - name: "tralios_gitlab"
|
||||||
# api_url: "https://gitlab.tralios.de/api/v4/"
|
# api_url: "https://gitlab.tralios.de/api/v4"
|
||||||
# endpoint:
|
# endpoint: "projects"
|
||||||
# url_field: "ssh_url_to_repo"
|
# url_field: "ssh_url_to_repo"
|
||||||
# token_cmd: "rbw get 'Gitlab Tralios' -f 'Clonedev PAT'"
|
# token_cmd: "rbw get 'Gitlab Tralios' -f 'Clonedev PAT'"
|
||||||
# block_unsorted: true
|
# block_unsorted: true
|
||||||
# targets:
|
|
||||||
# -
|
|
||||||
# extra_headers:
|
# extra_headers:
|
||||||
# - "Authorization: Bearer ${TOKEN}"
|
# - "Authorization: Bearer ${TOKEN}"
|
||||||
|
|
||||||
|
|
|
@ -72,10 +72,12 @@ sub exec_multicurl() {
|
||||||
while ($active_requests) {
|
while ($active_requests) {
|
||||||
my $active_transfers = $curlm->perform;
|
my $active_transfers = $curlm->perform;
|
||||||
if ( $active_transfers != $active_requests ) {
|
if ( $active_transfers != $active_requests ) {
|
||||||
while ( my ( $handle, $return_value ) = $curlm->info_read ) {
|
while ( my ( $handle, $ret ) = $curlm->info_read ) {
|
||||||
if ($handle) {
|
if ($handle) {
|
||||||
$active_requests--;
|
$active_requests--;
|
||||||
exec_callbacks($handle);
|
exec_callbacks($handle);
|
||||||
|
# TODO: proper error checking
|
||||||
|
# $handles[$handle]{curl}->getinfo(CURLINFO_HTTP_CODE);
|
||||||
delete $handles[$handle];
|
delete $handles[$handle];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,6 +227,14 @@ sub read_conf() {
|
||||||
%conf = %$hashref;
|
%conf = %$hashref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub curl_pipeline($handle) {
|
||||||
|
add_callback( $handle, \&json_decode );
|
||||||
|
add_callback( $handle, \&url_filter );
|
||||||
|
add_callback( $handle, \&process_urls );
|
||||||
|
add_callback($handle, \&dump);
|
||||||
|
# add_callback( $handle, \&handle_repos );
|
||||||
|
}
|
||||||
|
|
||||||
# ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
# ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
||||||
# ░ ░░░░ ░░░ ░░░ ░░ ░░░ ░
|
# ░ ░░░░ ░░░ ░░░ ░░ ░░░ ░
|
||||||
# ▒ ▒▒ ▒▒ ▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒ ▒▒ ▒
|
# ▒ ▒▒ ▒▒ ▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒ ▒▒ ▒
|
||||||
|
@ -243,17 +253,22 @@ for my $i ( keys @{ $conf{lookups} } ) {
|
||||||
for ( $lookup{extra_headers} ) {
|
for ( $lookup{extra_headers} ) {
|
||||||
$_ = `printf "$_"`;
|
$_ = `printf "$_"`;
|
||||||
}
|
}
|
||||||
for my $j ( keys @{ $lookup{targets} } ) {
|
if ($lookup{targets}) {
|
||||||
|
for my $j ( keys @{ $lookup{targets} } ) {
|
||||||
|
$last_handle++;
|
||||||
|
$handles[$last_handle]{lookup} = $i;
|
||||||
|
set_curl( $last_handle,
|
||||||
|
"$lookup{api_url}/$lookup{targets}[$j]/$lookup{endpoint}",
|
||||||
|
$lookup{extra_headers} );
|
||||||
|
curl_pipeline($last_handle);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$last_handle++;
|
$last_handle++;
|
||||||
$handles[$last_handle]{lookup} = $i;
|
$handles[$last_handle]{lookup} = $i;
|
||||||
set_curl( $last_handle,
|
set_curl( $last_handle,
|
||||||
"$lookup{api_url}/$lookup{targets}[$j]/$lookup{endpoint}",
|
"$lookup{api_url}/$lookup{endpoint}",
|
||||||
$lookup{extra_headers} );
|
$lookup{extra_headers} );
|
||||||
add_callback( $last_handle, \&json_decode );
|
curl_pipeline($last_handle);
|
||||||
add_callback( $last_handle, \&url_filter );
|
|
||||||
add_callback( $last_handle, \&process_urls );
|
|
||||||
add_callback( $last_handle, \&dump );
|
|
||||||
# add_callback( $last_handle, \&handle_repos );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue