GithubHelp home page GithubHelp logo

Comments (15)

akurtakov avatar akurtakov commented on August 16, 2024

I have just verified that build on Linux works.
image

If you open the docker perspective is the connection to the docker daemon working?

from org.eclipse.linuxtools.

cegeka-jd avatar cegeka-jd commented on August 16, 2024

Everything is working perfectly in the Docker perspective. I can also build images from a Local Terminal in Eclipse. It's just when I use a Run Configuration or Run As -> Build Docker Image, that the issue occurs.
image

from org.eclipse.linuxtools.

akurtakov avatar akurtakov commented on August 16, 2024

Could you please try using https://download.eclipse.org/linuxtools/updates-docker-nightly/ ? We have recently migrated to docker-client 5.x (for September release) so hopefully this makes a difference for you.

from org.eclipse.linuxtools.

cegeka-jd avatar cegeka-jd commented on August 16, 2024

image

from org.eclipse.linuxtools.

akurtakov avatar akurtakov commented on August 16, 2024

You may need https://download.eclipse.org/eclipse/downloads/drops4/I20230809-1800/ in order to get other 2023-09 content.

from org.eclipse.linuxtools.

cegeka-jd avatar cegeka-jd commented on August 16, 2024

Would you recommend to proceed with the proposed update below on my 2023-03 install (with the latest updates) or proceed with a fresh install using one of the downloads from https://download.eclipse.org/eclipse/downloads/drops4/I20230809-1800/ ? (which one?)
image

from org.eclipse.linuxtools.

akurtakov avatar akurtakov commented on August 16, 2024

Use a clean separate install for testing. As you're on Windows https://download.eclipse.org/eclipse/downloads/drops4/I20230809-1800/download.php?dropFile=eclipse-SDK-I20230809-1800-win32-x86_64.zip is probably best to start with.

from org.eclipse.linuxtools.

cegeka-jd avatar cegeka-jd commented on August 16, 2024

I've tried on fresh installs of

https://www.eclipse.org/downloads/download.php?file=/oomph/epp/2023-06/R/eclipse-inst-jre-win64.exe
with https://tools.jboss.org/downloads/jbosstools/2023-06/4.28.0.Final.html

"Run As -> Docker Build Image" fails with error log:

eclipse.buildId=4.28.0.20230608-1200
java.version=17.0.8
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=nl_BE
Framework arguments: -product org.eclipse.epp.package.jee.product -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product -data file:/C:/cegeka/workspaces/test2023-06/ -product org.eclipse.epp.package.jee.product

org.eclipse.core.jobs
Error
Thu Aug 10 15:25:22 CEST 2023
An internal error occurred during: "Building Docker Image".

java.lang.NullPointerException: configs value
at java.base/java.util.Objects.requireNonNull(Objects.java:235)
at org.mandas.docker.client.messages.ImmutableRegistryConfigs$Builder.addConfig(ImmutableRegistryConfigs.java:145)
at org.mandas.docker.client.messages.ImmutableRegistryConfigs$Builder.addConfig(ImmutableRegistryConfigs.java:116)
at org.mandas.docker.client.DockerConfigReader.authForAllRegistries(DockerConfigReader.java:140)
at org.mandas.docker.client.auth.ConfigFileRegistryAuthSupplier.authForBuild(ConfigFileRegistryAuthSupplier.java:107)
at org.mandas.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1413)
at org.eclipse.linuxtools.internal.docker.core.DockerConnection.buildImage(DockerConnection.java:1478)
at org.eclipse.linuxtools.internal.docker.ui.jobs.BuildDockerImageJob.run(BuildDockerImageJob.java:163)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

and

https://download.eclipse.org/eclipse/downloads/drops4/I20230809-1800/download.php?dropFile=eclipse-SDK-I20230809-1800-win32-x86_64.zip
with https://tools.jboss.org/downloads/jbosstools/2023-09/4.29.x.Nightly.html and https://download.eclipse.org/linuxtools/updates-docker-nightly/

"Run As -> Docker Build Image" also fails with error log:

eclipse.buildId=4.29.0.I20230809-1800
java.version=17.0.8
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=nl_BE
Command-line arguments: -os win32 -ws win32 -arch x86_64 -data file:/C:/cegeka/workspaces/test2023-09/

org.eclipse.core.jobs
Error
Thu Aug 10 15:55:18 CEST 2023
An internal error occurred during: "Building Docker Image".

java.lang.NullPointerException: configs value
at java.base/java.util.Objects.requireNonNull(Objects.java:235)
at org.mandas.docker.client.messages.ImmutableRegistryConfigs$Builder.addConfig(ImmutableRegistryConfigs.java:145)
at org.mandas.docker.client.messages.ImmutableRegistryConfigs$Builder.addConfig(ImmutableRegistryConfigs.java:116)
at org.mandas.docker.client.DockerConfigReader.authForAllRegistries(DockerConfigReader.java:141)
at org.mandas.docker.client.auth.ConfigFileRegistryAuthSupplier.authForBuild(ConfigFileRegistryAuthSupplier.java:107)
at org.mandas.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1224)
at org.eclipse.linuxtools.internal.docker.core.DockerConnection.buildImage(DockerConnection.java:1478)
at org.eclipse.linuxtools.internal.docker.ui.jobs.BuildDockerImageJob.run(BuildDockerImageJob.java:163)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

from org.eclipse.linuxtools.

akurtakov avatar akurtakov commented on August 16, 2024

So this issue is not fixed by docker-client update. Unfortunately, I don't have access to Windows machine to try it out thus would you please consider debugging the issue yourself.
I'll be happy to apply a PR or help as much as I can.

from org.eclipse.linuxtools.

cegeka-jd avatar cegeka-jd commented on August 16, 2024

Sure, here are already a few findings that may point to a solution. Could the buildParameters being empty, and dockerCredentialHelperAuth being null, somehow be related?

image

image

from org.eclipse.linuxtools.

jjohnstn avatar jjohnstn commented on August 16, 2024

@cegeka-jd You must have a.config.json file with "auths" entries.

Code in stack trace from: DockerConfigReader.authForAllRegistries()

    // If there are any objects in "auths", they could take two forms.
    // Older auths will map registry keys to objects with "auth" values, sometimes emails.
    // Newer auths will map registry keys to empty objects. They expect you
    // to use the credsStore to authenticate.
    if (hasAuths) {
      // We will use this empty RegistryAuth to check for empty auth values
      final RegistryAuth empty = RegistryAuth.builder().build();

      for (final Map.Entry<String, RegistryAuth> authEntry : auths.entrySet()) {
        final String registry = authEntry.getKey();
        if (addedRegistries.contains(registry)) {
          continue;
        }

        addedRegistries.add(registry);
        final RegistryAuth registryAuth = authEntry.getValue();
        if (registryAuth == null || registryAuth.equals(empty)) {
          // We have an empty object. Can we use credsStore?
          if (hasCredsStore) {
            registryConfigsBuilder.addConfig(registry,  // <--- this line is causing a null check failure
                authWithCredentialHelper(credsStore, registry));
          } // no else clause. If we can't fall back to credsStore, we can't auth.
        } else {
          // The auth object isn't empty.
          // We need to add the registry to its properties, then
          // add it to the RegistryConfigs
          registryConfigsBuilder.addConfig(registry,
              registryAuth.toBuilder().serverAddress(registry).build());
        }
      }
    }

The following for you is returning null for a registry in your "auths" specification.

  private RegistryAuth authWithCredentialHelper(final String credsStore,
                                                final String registry) throws IOException {
    final DockerCredentialHelperAuth dockerCredentialHelperAuth =
        DockerCredentialHelper.get(credsStore, registry);
    return dockerCredentialHelperAuth == null ? null : dockerCredentialHelperAuth.toRegistryAuth();
  }

The DockerCredentionalHelper code does an exec using the credsStore and passes the registry.

  public DockerCredentialHelperAuth get(final String credsStore, final String registry)
      throws IOException {
    final Process process = exec("get", credsStore);

    try (final Writer outStreamWriter =
             new OutputStreamWriter(process.getOutputStream(), StandardCharsets.UTF_8)) {
      try (final BufferedWriter writer = new BufferedWriter(outStreamWriter)) {
        writer.write(registry);
        writer.newLine();
        writer.flush();
      }
    }

    try (final InputStreamReader reader =
             new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8)) {
      try (BufferedReader input = new BufferedReader(reader)) {
        return readServerAuthDetails(input);
      }
    }
  }

It is not reading the server auth details and is returning null. Admittedly, the docker-client code could have failed more gracefully but there is something wrong with your configuration.

Please check your config.json file to ensure you have a proper credsStore specified and the "auths" specification does not have invalid registry specifications.

from org.eclipse.linuxtools.

cegeka-jd avatar cegeka-jd commented on August 16, 2024

Thanks Jeff, I noticed I was logged out in Docker Desktop, and after logging in with my pro tier account, and also storing some credentials in a different workspace to connect to a new project in Git, I can again build Docker images using Run Configurations.
I'm not sure what exactly solved it, but I'm guessing it's eighter something not being enabled in Docker Desktop when not logged in or not using a pro tier account, or the secure registry had an old incorrect credential that was replaced via the prompt when it asked for credentials to connect to Git in the new workspace. In any case, indeed, a more graceful handling of this exception may have helped to identify the cause.

from org.eclipse.linuxtools.

akurtakov avatar akurtakov commented on August 16, 2024

Is there a reason to keep this one open?

from org.eclipse.linuxtools.

jjohnstn avatar jjohnstn commented on August 16, 2024

I'm going to say it should be closed as the logic to handle this better is on the docker-client side so a bug should be opened there.

from org.eclipse.linuxtools.

akurtakov avatar akurtakov commented on August 16, 2024

And we are 2 major versions behind on it so it might even been improved already.

from org.eclipse.linuxtools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.