Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to "Back My Stack" as an organization member #183

Open
znarf opened this issue Jul 4, 2019 · 3 comments
Open

Ability to "Back My Stack" as an organization member #183

znarf opened this issue Jul 4, 2019 · 3 comments
Assignees
Labels

Comments

@znarf
Copy link
Member

znarf commented Jul 4, 2019

Story

As an authenticated user, I want to detect dependencies from the GitHub repositories of my organization and "Back My Stack" using the special Open Collective Tier.

Scenario

  1. Go on https://backyourstack.com/
  2. Sign In with GitHub
  3. Go to one of your organization profile, ie: https://backyourstack.com/airbnb
  4. Customize the profile
  • Add more dependency files
  • Select/Unselect repositories
  1. Click on a "Save Profile" button
  • The system needs to check that I'm allowed to do that as a member of the GitHub organization
  • The files will be persisted to s3 under the organization identifier, ie: "airbnb"
  • The backing.jsonwill be available at https://backyourstack.com/airbnb/backing.json
  1. Click on a "Back My Stack" button
  2. A confirmation page will explain in plain english what "Backing My Stack" means, the main action is a button that
    redirect to http://staging.opencollective.com/backyourstack2/contribute/level-1-9912/checkout?data={%22jsonUrl%22:%22http:\/\/backyourstack.com\/Pi9vF3knlTIwKcFtmBvzX4NHGmAfbeNr\/backing.json%22}
  3. On success from the Open Collective flow, I'm redirected on a BackYourStack page confirming what happened and what I can do next
@flickz flickz self-assigned this Aug 15, 2019
@flickz
Copy link
Collaborator

flickz commented Aug 15, 2019

Phase 1 - BackMyStack

Saving on S3

  • Add BackMyStack component to profile page
  • Create a new handler method for BackMyStack onClick button
  • Create a new server api endpoint /profile/save, the endpoint should:
Approach 1 (Public Repo)
  • Modify the getProfileData method to provide package file urls in repo object as dependencies_file_urls if the repo.
  • Get reposfrom getProfileData method
  • Iterate through the repos, access dependencies_file_urls property and construct a files object similar to the one below.
{
 "profile": true,
  "files": {
       "opencollective-api":{
          "url": [ "https://raw.githubusercontent.com/frontend/blob/master/pacakge.json"],
           "public": true
         }
       }
}
  • This object would be saved as [profile id]/dependencies.json on s3.
Approach 2 (Private Repo)
  • During the process of fetching and parsing repository dependencies, in lib/dependencies/data.js, getFirstMatchingFiles method, cache the content of repository file before it is parsed, save the cache key as repo_dependencies_[id]_content.
  • Create a new method in lib/data.js, getRepoDependencies that takes the id of the repository file and get it's dependencies content from the cache.
  • The content will be saved as [profile id]/[uuid].json,
  • The file meta data will be saved as [profile id]/dependencies.json similar to the anonymous upload.

Getting the organization backing.json file.

  • Create a new endpoint /:profile id/backing.json

Phase 2 - Customize profile

  • Add the Upload component to the left side bar to be able to manually add package file along with it.
  • Add a checkbox to each repositories (a new first column in the table maybe) in "Analyzed Repositories tab" to be able to select and unselect tab.
  • Add a "Re-analyzed button" in the "Analyzed Repositories tab" disabled by default and only enabled when a repository is selected or unselected.

@znarf
Copy link
Member Author

znarf commented Aug 15, 2019

The specification should actually be updated, we should merge 5) and 6) like we decided to do in the anonymous scenario.

@znarf
Copy link
Member Author

znarf commented Nov 8, 2019

The system needs to check that I'm allowed to do that as a member of the GitHub organization

@flickz That was not implemented :-/

@znarf znarf added the priority label Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants