amzn / oss-dashboard

A dashboard for viewing many GitHub organizations at once.
Apache License 2.0
159 stars 40 forks source link

`refresh-dashboard.rb` fails at `generate-dashboard/xml` for orgs #140

Closed jaeddy closed 4 years ago

jaeddy commented 4 years ago

I just came across this project today, and it seems super useful! After getting everything installed (I'll try to open a PR to the docs later for how I got system dependencies added on macOS...), the program is failing when it tries to output XML for organizations. I've tried a few modifications to the dashboard config, but no luck.

The error message I get is not particularly illuminating (though I admittedly know very little Ruby):

<path-to>/generate-dashboards.rb:225:in `add_org_xml': undefined method `[]' for nil:NilClass (NoMethodError)

I'm wondering if this is something you or others have encountered. Any advice would be much appreciated — and that includes pointing out any dumb mistake I've made in my config or execution. 🙂


My config file, for reference ```yaml dashboard: organizations: ['Sage-Bionetworks'] logins: [] repositories: [] data-directory: sage-data reports: [ 'DocsReporter', 'LicenseReporter', 'BinaryReporter' ] db-reports: [ 'UnknownCollaboratorsDbReporter', 'LeftEmploymentDbReporter', 'UnknownMembersDbReporter', 'WikiOnDbReporter', 'EmptyDbReporter', 'UnchangedDbReporter', 'NoIssueCommentsDbReporter', 'NoPrCommentsDbReporter', 'RepoUnownedDbReporter', 'LabelDbReporter', 'AverageIssueCloseDbReporter', 'AveragePrCloseDbReporter' ] www-directory: html private-access: ['Sage-Bionetworks'] database: engine: 'postgres' username: 'jaeddy' password: server: 'localhost' port: 5432 database: 'oss-dashboard' ```

Here's the full stdout from the run (note: I used the --light flag because our org has over 600 repos and I thought that could get messy...). I noticed there was an earlier error with github-sync/metadata, but it doesn't seemed to have stopped the command from continuing. In case it is relevant, I've included the backtrace from that error below.

ruby refresh-dashboard.rb --light --ghconfig .ossdash-auth.yaml .ossdash-config.yaml
Remaining GitHub Calls: 4997
User: jaeddy
GitHub rate limit reset: 2020-09-11 21:11:24 -0700
init-database
github-sync
 metadata
  Sage-Bionetworks Error during processing: GET https://api.github.com/repos/Sage-Bionetworks/aacr_interactome/collaborators?per_page=100: 403 - Must have push access to view repository collaborators. // See: https://docs.github.com/rest/reference/repos#list-repository-collaborators
<backtrace shown below>

  :filling-in-member-data
 reporting
  Sage-Bionetworks ...<many more dots>
generate-dashboard
 json-data
  Sage-Bionetworks

 xml
  repos
  organization-dashboards !
.
  team-dashboards
  custom: All Logins
  custom: All Organizations
Traceback (most recent call last):
    9: from refresh-dashboard.rb:197:in `<main>'
    8: from refresh-dashboard.rb:197:in `each'
    7: from refresh-dashboard.rb:252:in `block in <main>'
    6: from /Users/jaeddy/code/github/projects/oss-dashboard/generate-dashboard/generate-dashboards.rb:354:in `generate_tng_dashboards'
    5: from /Users/jaeddy/code/github/projects/oss-dashboard/generate-dashboard/generate-dashboards.rb:354:in `each'
    4: from /Users/jaeddy/code/github/projects/oss-dashboard/generate-dashboard/generate-dashboards.rb:355:in `block in generate_tng_dashboards'
    3: from /Users/jaeddy/code/github/projects/oss-dashboard/generate-dashboard/generate-dashboards.rb:472:in `generate_custom_dashboard'
    2: from /Users/jaeddy/code/github/projects/oss-dashboard/generate-dashboard/generate-dashboards.rb:472:in `each'
    1: from /Users/jaeddy/code/github/projects/oss-dashboard/generate-dashboard/generate-dashboards.rb:473:in `block in generate_custom_dashboard'
/Users/jaeddy/code/github/projects/oss-dashboard/generate-dashboard/generate-dashboards.rb:225:in `add_org_xml': undefined method `[]' for nil:NilClass (NoMethodError)

In case it's useful...

github-sync/metadata backtrace ``` Backtrace: /usr/local/lib/ruby/gems/2.7.0/gems/octokit-4.18.0/lib/octokit/response/raise_error.rb:16:in `on_complete' /usr/local/lib/ruby/gems/2.7.0/gems/faraday-1.0.1/lib/faraday/response.rb:12:in `block in call' /usr/local/lib/ruby/gems/2.7.0/gems/faraday-1.0.1/lib/faraday/response.rb:65:in `on_complete' /usr/local/lib/ruby/gems/2.7.0/gems/faraday-1.0.1/lib/faraday/response.rb:11:in `call' /usr/local/lib/ruby/gems/2.7.0/gems/octokit-4.18.0/lib/octokit/middleware/follow_redirects.rb:73:in `perform_with_redirection' /usr/local/lib/ruby/gems/2.7.0/gems/octokit-4.18.0/lib/octokit/middleware/follow_redirects.rb:61:in `call' /usr/local/lib/ruby/gems/2.7.0/gems/faraday-1.0.1/lib/faraday/request/retry.rb:148:in `call' /usr/local/lib/ruby/gems/2.7.0/gems/faraday-1.0.1/lib/faraday/rack_builder.rb:153:in `build_response' /usr/local/lib/ruby/gems/2.7.0/gems/faraday-1.0.1/lib/faraday/connection.rb:492:in `run_request' /usr/local/lib/ruby/gems/2.7.0/gems/faraday-1.0.1/lib/faraday/connection.rb:198:in `get' /usr/local/lib/ruby/gems/2.7.0/gems/sawyer-0.8.2/lib/sawyer/agent.rb:94:in `call' /usr/local/lib/ruby/gems/2.7.0/gems/octokit-4.18.0/lib/octokit/connection.rb:156:in `request' /usr/local/lib/ruby/gems/2.7.0/gems/octokit-4.18.0/lib/octokit/connection.rb:84:in `paginate' /usr/local/lib/ruby/gems/2.7.0/gems/octokit-4.18.0/lib/octokit/client/repositories.rb:331:in `collaborators' /Users/jaeddy/code/github/projects/oss-dashboard/github-sync/db_metadata/sync-metadata.rb:123:in `block in store_organization_members' /Users/jaeddy/code/github/projects/oss-dashboard/github-sync/db_metadata/sync-metadata.rb:122:in `each' /Users/jaeddy/code/github/projects/oss-dashboard/github-sync/db_metadata/sync-metadata.rb:122:in `store_organization_members' /Users/jaeddy/code/github/projects/oss-dashboard/github-sync/db_metadata/sync-metadata.rb:178:in `block (2 levels) in sync_metadata' /usr/local/lib/ruby/gems/2.7.0/gems/sequel-5.18.0/lib/sequel/database/transactions.rb:245:in `_transaction' /usr/local/lib/ruby/gems/2.7.0/gems/sequel-5.18.0/lib/sequel/database/transactions.rb:220:in `block in transaction' /usr/local/lib/ruby/gems/2.7.0/gems/sequel-5.18.0/lib/sequel/connection_pool/threaded.rb:92:in `hold' /usr/local/lib/ruby/gems/2.7.0/gems/sequel-5.18.0/lib/sequel/database/connecting.rb:270:in `synchronize' /usr/local/lib/ruby/gems/2.7.0/gems/sequel-5.18.0/lib/sequel/database/transactions.rb:186:in `transaction' /Users/jaeddy/code/github/projects/oss-dashboard/github-sync/db_metadata/sync-metadata.rb:171:in `block in sync_metadata' /Users/jaeddy/code/github/projects/oss-dashboard/github-sync/db_metadata/sync-metadata.rb:167:in `each' /Users/jaeddy/code/github/projects/oss-dashboard/github-sync/db_metadata/sync-metadata.rb:167:in `sync_metadata' /Users/jaeddy/code/github/projects/oss-dashboard/github-sync/sync.rb:52:in `github_sync' refresh-dashboard.rb:210:in `block in
' refresh-dashboard.rb:197:in `each' refresh-dashboard.rb:197:in `
' ```
hyandell commented 4 years ago

Hi James!

Being transparent - I've had a year out, so the project's been in a keep-the-lights-on mode in that time as it was always my baby. Back now though :)

Looking at your issue; your GitHub token doesn't have permission to fulfill the "private-access: ['Sage-Bionetworks']" setting. My suggestion is to remove that setting and try again. Later you could fix the token's permissions, but oss-dashboard should work on any public account as well as letting you dive deeper into ones you can see more on.

It's possible that the bug you hit later on isn't related, but my guess is that not having access meant the organization-data array wasn't setup properly so it's falling over when it tries to grab a url to the avatar:

file.puts " <organization name='#{org}' avatar='#{org_data_row[:avatar_url]}' type='#{account_type}'>"

Let me know how that goes :)

jaeddy commented 4 years ago

Ah OK, thanks! I'll give that a try!

jaeddy commented 4 years ago

That worked — thanks again! Nice tool. 🙂