eclipse-che / che

Kubernetes based Cloud Development Environments for Enterprise Teams
http://eclipse.org/che
Eclipse Public License 2.0
6.96k stars 1.19k forks source link

Use Github repository language statistics to detect preferred stack for GitHub factories without devfile #15868

Closed skabashnyuk closed 3 years ago

skabashnyuk commented 4 years ago

Is your task related to a problem? Please describe.

At this moment if we are using a factory that points to github repository and this repository doesn't contain devfile which explains what is the workspace setup we are using default empty workspace with basic language capabilities.

Describe the solution you'd like

Github can provide a statistic about the code that is used in repository. We can use it to provide smarter defaults.

Знімок екрана  о 12 28 36 Знімок екрана  о 12 46 30

For example: if the percentage is grater 60% we can be sure which language to select

Describe alternatives you've considered

Do not autodetect the environment.

Additional context

https://github.com/eclipse/che/issues/14547

benoitf commented 4 years ago

api.github.com will require a token no ?

skabashnyuk commented 4 years ago

api.github.com will require a token no ?

@benoitf As far as I can see no. However, we might hit some token-less limits.

curl https://api.github.com/repos/eclipse/che/languages                                          ✔  7753  10:08:28
{
  "Java": 8761634,
  "JavaScript": 2477653,
  "TypeScript": 1957177,
  "HTML": 474145,
  "CSS": 379435,
  "Shell": 148933,
  "TSQL": 65818,
  "Groovy": 33116,
  "SQLPL": 30977,
  "FreeMarker": 22132,
  "Dockerfile": 11379,
  "Go": 2240,
  "C++": 2025,
  "Python": 1772,
  "C#": 1735,
  "Smarty": 1574,
  "PHP": 1180,
  "C": 407,
  "Makefile": 22
}
benoitf commented 4 years ago

@skabashnyuk yes I was more referencing the limits

using curl -v

< X-RateLimit-Limit: 60
< X-RateLimit-Remaining: 59
< X-RateLimit-Reset: 1580304687

there is only 60 requests available per hour (when not authenticated)

skabashnyuk commented 4 years ago

there is only 60 requests available per hour (when not authenticated)

Which is not that bad. + We can try to use the user's github token if available or remember some previous decisions.

benoitf commented 4 years ago

setting p1 as it's a big step forward to UX

tsmaeder commented 4 years ago

I also think having auto-configuration would be really cool. We might use a number of indicators to help with creating a devfile by looking at a project: presence of configuration files (pom.xml, gradle.properties, package.json, etc.). But just knowing the language will not get us very far. What about Quarkus project, for example? I think two points would be good for implementation:

  1. Make this a separate module that could be reused in the UI, for example (not just factories).
  2. Make it extensible
tsmaeder commented 4 years ago

Come to think of it: why not use the activation event contributions for "workspaceContains" and "onLanguages" to match plugins to projects?

maxandersen commented 4 years ago

I just want to highlight google lang statistics are fairly bad at guessing in many cases so I think thiis should a a last fallback situation.

Could consider using github repo labels as a way to guess too.

But nothing will beat a basic introspection of files layout and content.

skabashnyuk commented 4 years ago

@maxandersen yeh. That is potentially possible.

curl -H "Accept: application/vnd.github.mercy-preview+json"   https://api.github.com/repos/mgubaidullin/karamel/topics  
{
  "names": [
    "java",
    "quarkus",
    "camel",
    "qute",
    "websockets",
    "patternfly",
    "kafka",
    "strimzi",
    "strimzi-operators"
  ]
}
skabashnyuk commented 4 years ago

Devfile 2.0 version https://github.com/devfile/kubernetes-api/issues/40

che-bot commented 3 years ago

Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.

Mark the issue as fresh with /remove-lifecycle stale in a new comment.

If this issue is safe to close now please do so.

Moderators: Add lifecycle/frozen label to avoid stale mode.

skabashnyuk commented 3 years ago

won't fix