-
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
CHE-3129 - Project can't be created without Z option #3130
Conversation
Can one of the admins verify this patch? |
ci-build |
Build # 1074 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/1074/ to view the results. |
@garagatyi |
@tolusha I think that #3129 needs code changing (in the default config the property is set). @snjeza I think you need do the same check for property |
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.
@@ -69,9 +71,15 @@ public void provision(Environment envConfig, CheServicesEnvironmentImpl internal | |||
// add bind-mount volume for projects in a workspace | |||
String projectFolderVolume; | |||
try { | |||
projectFolderVolume = format("%s:%s:%s", | |||
if (Strings.isNullOrEmpty(volumesOptions)) { |
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.
Let's form suffix in constructor. Then you won't need this clause in main code.
I have updated the patch. |
@@ -35,19 +38,23 @@ | |||
private final WorkspaceFolderPathProvider workspaceFolderPathProvider; | |||
private final WindowsPathEscaper pathEscaper; | |||
private final String projectFolderPath; | |||
private final String volumesOptions; | |||
private final String projectsVolumeOptions; |
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.
Please replace tab character with spaces. Someone put it here but it is not allowed for indentation in Che.
@@ -64,7 +67,11 @@ public String get() { | |||
} | |||
|
|||
private String getTargetOptions(final String path) { | |||
return path + CONTAINER_TARGET + ":" + volumeOptions; | |||
if (!Strings.isNullOrEmpty(agentVolumeOptions)) { |
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.
Please create constructor and put this code there as you did in LocalCheInfrastructureProvisioner
@@ -68,6 +71,10 @@ public String get() { | |||
} | |||
|
|||
private String getTargetOptions(final String path) { | |||
return path + CONTAINER_TARGET + ":" + volumeOptions; | |||
if (!Strings.isNullOrEmpty(agentVolumeOptions)) { |
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.
Please create constructor and put this code there as you did in LocalCheInfrastructureProvisioner
The patch updated. |
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.
Sorry that still asking you to change your PR, but there are few minor changes to be made.
private String agentVolumeOptions; | ||
|
||
public DockerExtConfBindingProvider() { | ||
if (!Strings.isNullOrEmpty(agentVolumeOptions)) { |
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.
Constructor is called before field injection in Guice. So here we will have null value always. Can you replace field injection with a constructor injection.
private String agentVolumeOptions; | ||
|
||
public TerminalVolumeProvider() { | ||
if (!Strings.isNullOrEmpty(agentVolumeOptions)) { |
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.
Constructor is called before field injection in Guice. So here we will have null value always. Can you replace field injection with a constructor injection.
private String agentVolumeOptions; | ||
|
||
public WsAgentVolumeProvider() { | ||
if (!Strings.isNullOrEmpty(agentVolumeOptions)) { |
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.
Constructor is called before field injection in Guice. So here we will have null value always. Can you replace field injection with a constructor injection.
Signed-off-by: Snjezana Peco <[email protected]>
The patch updated. |
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.
Good job, Snjezana!
@@ -43,8 +46,8 @@ | |||
private static final Logger LOG = LoggerFactory.getLogger(DockerExtConfBindingProvider.class); | |||
|
|||
@Inject | |||
@Named("che.docker.volumes_agent_options") | |||
private String volumeOptions; | |||
@Nullable @Named("che.docker.volumes_agent_options") |
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, then leave it as it is now, I'll fix that in one of my next PRs.
Looks like DockerExtConfBindingProvider shouldn't work correctly because instance is created with default constructor and requestInjection method is not invoked for it. Please make sure that it works correctly |
That's why I haven't injected the che.docker.volumes_agent_options option to the DockerExtConfBindingProvider constructor. |
If instance of class is created manually and injection is not requested it should not work if I understand how it works. Can you describe how did you test that? |
I have created che-server, started it with different che.properies, created a project, reviewed mounted volumes using "docker inspect". Everything works as expected. |
@sleshchenko correct me if I'm mistaken but looks like ws-agent configuration works in a different way. |
When excluding the Z option, the volumes are mounted in the following way:
|
@snjeza Please create folder plugin-conf in CHE_LOCAL_CONF_DIR. As far as I understand it can be empty. And then mounts should include extra one with |
The following are the mounted volumes:
with the Z option
|
It is interesting. We debugged DockerExtConfBindingProvider usage and guice injected dependencies between 1st and 2nd calls of get method of this class. Sorry that we asked you to check more and more but we missed that Guice behavior with singleton classes. |
ci-build |
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/1111/ |
Signed-off-by: Snjezana Peco <[email protected]>
What does this PR do?
It fixes #3129
What issues does this PR fix or reference?
#3129
Signed-off-by: Snjezana Peco [email protected]