Skip to content
This repository was archived by the owner on Apr 28, 2020. It is now read-only.

Remove github.com requirement #197

Open
teddy-codes opened this issue May 23, 2019 · 17 comments · May be fixed by #226
Open

Remove github.com requirement #197

teddy-codes opened this issue May 23, 2019 · 17 comments · May be fixed by #226

Comments

@teddy-codes
Copy link
Contributor

Currently, there is a GitHub SDK within the code. If there is no .sail/Dockerfile, the base codercom/ubuntu-dev image should be used.

@teddy-codes
Copy link
Contributor Author

/cc @nathanpotter @ammario

What are your thoughts on this?
Re: #196

@nathanpotter
Copy link
Contributor

I think it'd be better to just verify that the repo host is github before making the call to the API

@teddy-codes
Copy link
Contributor Author

will throw together a PR tomorrow.

@coadler
Copy link
Contributor

coadler commented May 24, 2019

This might be tricky since you'll have to parse the .git folder in the project for the host

@teddy-codes
Copy link
Contributor Author

Can't we just add a regex for github.com?

@coadler
Copy link
Contributor

coadler commented May 24, 2019

I think that sets a bad precedent if we want to add logic based on the host

@teddy-codes
Copy link
Contributor Author

teddy-codes commented May 24, 2019

I think this will actually be kind of tricky now that you bring it up.

What are your thoughts on how to proceed?

@coadler
Copy link
Contributor

coadler commented May 24, 2019

I think a good first step would be to see how janky extracting the host from the .git folder would be

@teddy-codes
Copy link
Contributor Author

teddy-codes commented May 24, 2019

wouldn't we be able to just run:

git remote -v

This would display all of the hosts, we could split by \n, then use the endpoints there?

Note:
This would mean that if any of the repositories were on GitHub, this would happen. Although, it is likely that if it is, then there is no problem.

@deansheather
Copy link
Member

.git/config is where git stores all of the remotes in a format that seems ini-ish:

...
[remote "origin"]
        url = [email protected]:cdr/sail.git
        fetch = +refs/heads/*:refs/remotes/origin/*
...

I think it'd be much easier to just parse the output of git directly as roberthmiller pointed out, as if they're working with Git in the first place it's very likely that they have git installed on their system.

@teddy-codes
Copy link
Contributor Author

We could always check (although, a prerequisite to sail is git)

@coadler
Copy link
Contributor

coadler commented May 24, 2019 via email

@teddy-codes
Copy link
Contributor Author

So, what do you think that the solution should be? Should we have a regex for the remotes? If there is a GitHub* remote, we should use it. Is that an ideal solution? Although, this solution is not very good since you can have a remote that looks like git:cdr/sail and it would be aliased as github.com in the ssh config. What are your thoughts on this?

@deansheather
Copy link
Member

I think just parse the output of git remote -v if git is exists, and if it has a URL beginning with https://github.com/ or [email protected]: then try to get the language from GitHub. If people have aliased GitHub to something else it won't work, but I don't think many people do that anyways.

@teddy-codes
Copy link
Contributor Author

ok, I will put together a PR together when I get sail to work on my mac (since I am away from my desktop).

@teddy-codes
Copy link
Contributor Author

@kami1019 Not sure what your problem is... Can you elaborate a little bit?

@teddy-codes teddy-codes linked a pull request Jun 21, 2019 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@coadler @deansheather @nathanpotter @teddy-codes and others