-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
CODENVY-502 allow to create factories by providing custom parameters #1247
Conversation
FYI, in the JIRA issue there is a video |
-1 For the Factory Service. |
@skabashnyuk it can't be in github service as github is only deployed on workspace agent |
ok GithubFactoryService. |
GithubFactoryService with /factory/github mapping is ok ? |
Dont forget that github is a plugin. Some custom builds theoretically may not support it. UPD: we just allowed to create factories with any source type (and gihub too). See #1248 |
Not sure yet. BTW why you need that rest method? Why don't you create factory on client ? |
@skabashnyuk because logic is server side |
Can you describe a bit more desired parameters and desired behaviour of your rest method? What configuration of factory will be? |
@mshaposhnik it's related to pure git, not github. You don't need github plugin in the agent. |
@skabashnyuk parameter is listed in PR. It's to create a factory based on a github url |
-1 to include github specific features in common API |
} | ||
|
||
// use regexp to find repository details (repository name, project name and branch and subfolder) | ||
final Pattern GITHUB_PATTERN = Pattern.compile("^(?:http)(?:s)?(?:\\:\\/\\/)github.com/(.*?)/(.*?)(?:/tree/(.*?)(?:/(.*?))?)?$"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compilation of pattern can be improved by making it static
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW it will be moved to another class
BTW it should be POST |
@skabashnyuk I don't see why it should be more POST |
I thought it create new factory, NO? |
I don't think that we should allow such API for factory. This task should be done by client, not API. It can be done by Java client or Js, but it definitely should not be in the API |
@skabashnyuk it is indempotent |
-1 for this service. |
I have reworked to allow "pluggable" factory resolver. It's now based on plugins |
I don't get it. The whole picture how it will work is unclear for me. |
@skabashnyuk |
Sorry. Not for me. |
I can explain everything you want. |
I think solution should be more general like non-encoded factory. |
We do not have non encoded factory. We have this resolver. The comments should focus on the code readiness. What is left to be improved? |
it's a general solution. And it allows to plug server side logic which is required |
And this functionality has no github specific? |
it has specific part for github that will be provided by a plugin. ?url=https://github.com/ --> handle by github plugin (if enabled else it will provide error like today) |
I would like to understand the scope of this two PR Acceptance of A couple of thougts. What if we provide 3 types of factory? Realy realy simple. Jut to play with because with project type blank it's almoust useles. Allow to users specify external factory json with source authoreplacemet. Almoust identical to 1. In 2-3 cases during acceptance we will crate persistant factory and continue acceptance as usual. |
The goal is that we don't need persistent factory IN codenvy for 2 and 3. (if 100 users click on a url factory link it would create 100 dummy factories for nothing as persistent state is on the repository) |
ok. So 2-3 are just sending to dashboard and dashboard do the business. Correct? |
no business is done server side |
Not clear for me why. |
FactoryServlet checks if factory is valid before redirecting to dashboard so factory is checked first server side. |
So we just missing the part on dashboard how to get from 2-3 format to real Factory object ? |
it asks server side |
from concept point of view |
there is no missing part as it's implemented in my PR |
Not yet. I'm not get the whole picture. And you propose only github specific service. |
As I stated in email thread I need the big picture for factories, so we need a specs after that we discuss and consider this PR. |
Build # 628 - FAILED Please check console output at http://ci.codenvy-dev.com/jenkins/job/che-pullrequests-build/628/ to view the results. |
* @param callback | ||
* callback which return valid JSON object of factory or exception if occurred | ||
*/ | ||
void getFactory(@NotNull Map<String, String> factoryParameters, boolean validate, @NotNull AsyncRequestCallback<Factory> callback); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered usage of promises here? AFAIK it is default codestyle for IDE now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used the same pattern than FactoryServiceClient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For new code we prefer to use promises.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you prefer but this rule is not written anywhere
so, it can't be mandatory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MachineServiceClient
MachineServiceClientImpl
for example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also upgrade the other getFactory method to promise
Build # 660 - FAILED Please check console output at http://ci.codenvy-dev.com/jenkins/job/che-pullrequests-build/660/ to view the results. |
so we're good now ? |
LGTM |
ок |
… mechanism based on url parameters Change-Id: I0c9554ac6d767e110f9bc39c30e2fb2712ad413f Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
Change-Id: I0c9554ac6d767e110f9bc39c30e2fb2712ad413f
Signed-off-by: Florent BENOIT fbenoit@codenvy.com