-
Notifications
You must be signed in to change notification settings - Fork 65
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
Support multiple remotes for projects to support forking workflow #104
Comments
Maybe something like: spec:
projects:
- name: project
git:
branch: foo
remote: upstream # optional, defaults to origin
remotes:
origin: "https://github.com/amisevsk/web-nodejs-sample.git"
upstream: "https://github.com/che-samples/web-nodejs-sample.git"
gh-collaborator: "https://github.com/gh-collaborator/web-nodejs-sample.git" |
👍 LGTM |
what happens when we fork a repository with a devfile in it ? looks like paths/remotes won't follow. could we have an option to automatically grab the remotes when it's github ? because we know with github if a repo is a fork from another one, etc. so I just need to have a very simple devfile in the main repo and all forks will have this info automatically provided for github ? |
One feature that we currently use in Che is that project can be left blank, which is taken to mean "import the repository this devfile belongs to". This allows us to have one devfile that will work for all forks automatically (which I think is partly what @benoitf is getting at). I don't know if this belongs in the devfile spec or should be left to implementation, as it has the downside of making devfiles technically not standalone. For full context, Che will accept either a) a devfile.yaml that is used to create a workspace or b) a link to a git(hub) repo from which it'll search for a devfile and fill the project with the git repo linked. If we want to include this functionality in the spec, of the three proposals above, it's is easiest to do with Option 1: we could treat If we want to leave this up to implementation, option 3 works well, as we could potentially have the semantic
or something similar. Either way, I think having some sort of feature in devfiles where the same devfile can be used to work on a fork of a project naturally would be very useful. I'm currently maintaining devfiles separately from the main project's devfile to support working from my fork. |
@metacosm If it a valid yaml? spec:
projects:
- name: project
git:
init: # parameters that defined repository state after clonning
branch: foo # optional, defaults to default branch
remote: upstream # optional, defaults to origin Some validators say no, some yes. {
"spec": {
"projects": [
{
"name": "project",
"git": {
"branch": "foo\nremote: upstream",
"remotes": {
"origin": "https://github.com/amisevsk/web-nodejs-sample.git",
"upstream": "https://github.com/che-samples/web-nodejs-sample.git",
"gh-collaborator": "https://github.com/gh-collaborator/web-nodejs-sample.git"
}
}
}
]
}
} |
@sleshchenko indeed, it might not be… spec:
projects:
- name: project
git:
init: # parameters that defined repository state after cloning
branch: # optional, defaults to default branch
name: foo # if a branch child is provided then a name for it must be provided as well
remote: upstream # optional, defaults to origin A little bit more verbose but more valid :) |
I would set remote: upstream # optional,
# defaults to origin if remotes are not specified or origin in the remotes list.
# otherwise ??? (could be the first remote or required) |
Final format to discuss: spec:
projects:
- name: project
git:
remotes:
origin: "https://github.com/amisevsk/web-nodejs-sample.git" Multiple remotes spec:
projects:
- name: project
git:
remotes:
origin: "https://github.com/amisevsk/web-nodejs-sample.git"
upstream: "https://github.com/che-samples/web-nodejs-sample.git"
gh-collaborator: "https://github.com/gh-collaborator/web-nodejs-sample.git"
cloneFrom: # mandatory if there is more than one remote
branch: foo # mandatory
remote: upstream # mandatory if there is more than one remote |
Git and github project source format is changed in the #120 to the following projects:
- name: project
git:
remotes:
origin: "https://github.com/amisevsk/web-nodejs-sample.git"
upstream: "https://github.com/che-samples/web-nodejs-sample.git"
gh-collaborator: "https://github.com/gh-collaborator/web-nodejs-sample.git"
checkoutFrom: # mandatory if there is more than one remote
revision: foo # The revision that should be used checked out. May be branch name, tag or commit id.
# Default branch should be checked out if missing.
remote: upstream # The remote name should be used as init. Required if there are more than one remote configured |
Is your feature request related to a problem? Please describe.
It's not very common to work on git projects with a single remote; at the very least, a common flow is to have
but it's further useful to add close collaborators' forks as remotes in your local copy as well.
It would be useful if the devfile supported assigning multiple remotes to a project.
Describe the solution you'd like
Option 1
Add remotes section
Option 2
Support multiple locations instead of a plain string:
Option 3
(added from #104 (comment) below)
Additional context
Discussion in Eclipse Che issues: eclipse-che/che#17449
The text was updated successfully, but these errors were encountered: