Shopify / Shopify/shipit-engine

The `or_create` for new GH teams does not create new teams

Open
#1,025 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
1.5k
Forks
154
Avg merge
2h 26m
Merged PRs (30d)
3

Description

Context

Given we have a Shipit instance that formerly only members of our orgs Github team admin had access to. We now added the handle myorg/developers to the github.oauth.teams config list.

Issue

All requests to Shipit now fail due to an exception raised:

NoMethodError (undefined method `each' for nil:NilClass)

Analysis

irb(main):005:0> team = Shipit::Team.find_or_create_by_handle('myorg/developers')
Traceback (most recent call last):
        1: from (irb):5
NoMethodError (undefined method `each' for nil:NilClass)


irb(main):006:0> team = Shipit::Team.find_or_create_by_handle('myorg/admins')
=> #<Shipit::Team id: 4, github_id: 54321, api_url: "https://api.github.com/organizations/12345/team/...", slug: "admins", name: "admins", organization: "myorg", created_at: "2020-02-21 09:35:32", updated_at: "2020-02-21 09:35:32">

Please note: The first case also seem to not reach out got Github, at least it returns instantly, too fast for a networked API call.

Workaround

Manually invoke

Shipit::Team.fetch_and_create_from_github('myorg','developers')

via rails console

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Shipit::Team.find_or_create_by_handle and compare its behavior for an existing team with the new-team case. Trace the related Shipit::Team.fetch_and_create_from_github('myorg','developers') entry point and determine why the first path raises NoMethodError without contacting GitHub. Done means a configured, previously unknown team can be found or created without the exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, ruby
Domain
authorization, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.