-
Notifications
You must be signed in to change notification settings - Fork 874
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
Docker - Load images fix #7533
Docker - Load images fix #7533
Conversation
ide/docker.api/src/org/netbeans/modules/docker/api/DockerAction.java
Outdated
Show resolved
Hide resolved
This will fail. The class From my understanding "Virtual Size" never made sense for images, just for containers, as the image are the readonly portion and only a running container has a writable part. So wouldn't it make sense to use |
I only took a quick look at this yesterday but the API seemed to be only exported to netbeans/ide/docker.api/nbproject/project.xml Lines 130 to 133 in 7216834
so its essentially internal since I don't think it can leak out of docker.ui. Not saying that we should remove it but I don't think there is anything preventing removal. |
For me doing a compatible change is just easier. API breakage should always raise concerns and be treated with respect. It also requires bumping major version of the affected module, updating the using module and raising the specification version of that module. It is just messy. "friend only" dependencies are APIs being stabilized. If you don't want an API, you can use an implementation dependency in the IDE and be done with it. |
@matthiasblaesing, would you suggest another alternative? Taking into account the API break, I even thought about putting zero in the virtual size parameter, but it seems like an improvised solution. I'm here to learn. |
@lukaz-sampaio the alternative from my perspective would be to keep the attribute and fill it on a best-effort basis. If @SuppressWarnings("unchecked")
public List<DockerImage> getImages() {
try {
JSONArray value = (JSONArray) doGetRequest("/images/json",
Collections.singleton(HttpURLConnection.HTTP_OK));
List<DockerImage> ret = new ArrayList<>(value.size());
for (Object o : value) {
JSONObject json = (JSONObject) o;
JSONArray repoTags = (JSONArray) json.get("RepoTags");
String id = (String) json.get("Id");
long created = (long) json.getOrDefault("Created", 0L);
long size = (long) json.getOrDefault("Size", 0L);
long virtualSize = (long) json.getOrDefault("VirtualSize", size);
ret.add(new DockerImage(instance, repoTags, id, created, size, virtualSize));
}
return ret;
} catch (DockerException ex) {
LOGGER.log(Level.INFO, null, ex);
}
return Collections.emptyList();
} Callers now get the closest thing to the right size, without breaking compatibility. |
I had read an explanation about the difference between "Size" and "VirtualSize" in the docker repository itself. From the explanation, it seems to me that |
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.
Assuming you tested, that this actually works (I don't have a new enough docker system), the change looks sane to me.
Would you please squash the commits into a single one?
we could deprecate it isn't used anywhere: I would be also ok with removal and spec bump if needed, whatever is easier. |
@lukaz-sampaio the suggestion from @mbien sounds good to me. Would you mind adding the deprecation and note when you squash? |
aebdd4c
to
d98cbf0
Compare
/** | ||
* @deprecated Removed from Docker Engine in v1.44. Return size value. | ||
* @return | ||
*/ | ||
public long getVirtualSize() { |
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.
In addition to the @deprecated
javadoc tag please also add the @Deprecated
annotation (see: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Deprecated.html)
Docker images don't load because `VirtualSize` attribute was removed from Docker Engine in v1.44. --- Using `getOrDefault` for the `Created`, `Size` and `VirtualSize` attributes. Using `Size` as default value to `VirtualSize`. Annotating the `VirtualSize` attribute as deprecated
Lets get this in. Thank you for your contribution @lukaz-sampaio |
@matthiasblaesing and @mbien thank you very much for the support and help. |
Docker's images don't load because attribute "VirtualSize" was removed from docker engine.
Removing docker's attribute "VirtualSize" that was removed from docker engine.