quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.73k stars 2.67k forks source link

Version check interprets port as version number for image-name of dev-services #37227

Closed bannert1337 closed 11 months ago

bannert1337 commented 11 months ago

Describe the bug

The company uses its own registry. Several registries are provided under different ports, which is why the port must be specified. If a port with a colon is specified in the image name, the port is interpreted as a version number and a version mismatch occurs. To validate the version number, Quarkus uses Testcontainers. The image name is split at the first colon, and the second substring is interpreted as the version number.

public DockerImageName(String fullImageName) {
        this.rawName = fullImageName;
        final int slashIndex = fullImageName.indexOf('/');

        String remoteName;
        if (
            slashIndex == -1 ||
            (
                !fullImageName.substring(0, slashIndex).contains(".") &&
                !fullImageName.substring(0, slashIndex).contains(":") &&
                !fullImageName.substring(0, slashIndex).equals("localhost")
            )
        ) {
            registry = "";
            remoteName = fullImageName;
        } else {
            registry = fullImageName.substring(0, slashIndex);
            remoteName = fullImageName.substring(slashIndex + 1);
        }

        if (remoteName.contains("@sha256:")) {
            repository = remoteName.split("@sha256:")[0];
            versioning = new Sha256Versioning(remoteName.split("@sha256:")[1]);
        } else if (remoteName.contains(":")) {
            repository = remoteName.split(":")[0];
            versioning = new TagVersioning(remoteName.split(":")[1]);
        } else {
            repository = remoteName;
            versioning = Versioning.ANY;
        }

        compatibleSubstituteFor = null;
    }

Source

Expected behavior

Version number is correctly identified.

Actual behavior

The version number is wrongly identified, causing a version mismatch error.

How to Reproduce?

Use a registry with port in the image name.

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

quarkus-bot[bot] commented 11 months ago

/cc @geoand (devservices), @stuartwdouglas (devservices)

melloware commented 11 months ago

But isn't this a bug in TestContainers? Your source link is to TestContainers?

geoand commented 11 months ago

Closing as per @melloware 's comment