FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

awaitImageId() using BuildImageResultCallback issue · Issue #2184 · docker-java/docker-java · GitHub

Repository navigation

awaitImageId() using BuildImageResultCallback issue #2184

Closed

Description

We used the api to build a model that installs pip dependencies for a python application.

Running the pip install outputs "Sucessfully built <package" for packages that are built.
This caused the api to return the name due to the implementation of parsing the imageId in the BuildImageResultCallback class.

We fixed it by adding a lastStepDone boolean that waits for Step n/n done and then enables the imageId parsing by waiting for "Sucessfully built <...>"

Should I open a pr with our solution I think there is no disadvantage to wait for docker image build completion before parsing the image id?

Activity

  1. niloc132 commented on Feb 2, 2024

    Contributor

    Just ran into this via https://github.com/bmuschko/gradle-docker-plugin, also using pip. My proposed solution was going to be to tweak onNext to null out this.imageId when an error is received. It could make sense to not parse until the stream was finished, but since BuildImageResultCallback.getImageId is private and can't be called until the POST /build is completed, it might be just as simple to check for a error before checking for the imageId.

    private String getImageId() {
    if (imageId != null) {
    return imageId;
    }
    if (error == null) {
    throw new DockerClientException("Could not build image");
    }
    throw new DockerClientException("Could not build image: " + error);
    }

    could instead be

     private String getImageId() { 
         if (error != null) { 
             throw new DockerClientException("Could not build image: " + error); 
         } 
      
         if (imageId != null) { 
             return imageId; 
         } 
      
        throw new DockerClientException("Could not build image"); 
     } 
  2. added a commit that references this issue on Feb 2, 2024
    8fad77c
  3. added a commit that references this issue on Feb 26, 2024
    4d8c436
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL