Skip to content
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

Parsing OCI image names that are invalid due to the use of upper case letters is very slow #35657

Closed
mfarsikov opened this issue May 26, 2023 · 4 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@mfarsikov
Copy link

I'm using Spring boot plugin 3.1.0
build.gradle.kts:

tasks.named<BootBuildImage>("bootBuildImage") {
    tags.add("europe-west1-docker.pkg.dev/my-project/my-docker-registry/${project.name}:$version")
    imageName.set("europe-west1-docker.pkg.dev/my-project/my-docker-registry/${project.name}:$version")
}

during the run, it hangs for several minutes and fails:

* What went wrong:
Execution failed for task ':bootBuildImage'.
> Unable to parse image reference "europe-west1-docker.pkg.dev/my-project/my-docker-registry/app:9.9.9". Image reference must be in the form '[domainHost:port/][path/]name[:tag][@digest]', with 'path' and 'name' containing only [a-z0-9][.][_][-]

It is strange enough, but it fails only if this is configured in a gradle script, but it works fine if the same tag is passed as a parameter:

./gradlew bootBuildImage --image-name=europe-west1-docker.pkg.dev/my-project/my-docker-registry/app:9.9.9
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 26, 2023
@scottfrederick
Copy link
Contributor

I can't reproduce what you are describing with a trivial application generated by start.spring.io and configured as you've shown.
Please provide a complete minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it and attaching it to this issue.

@scottfrederick scottfrederick added the status: waiting-for-feedback We need additional information before we can continue label May 27, 2023
@mfarsikov
Copy link
Author

Reproducible repo: https://github.com/mfarsikov/bootBuildImage-reproduce

It is really strange, it highly depends on any change in a string.
I have found an error in my script: I was using $name (instead of ${project.name}) which resolves to task name bootBuildImage (which is still a valid name for a container). Using ${project.name} it does not reproduce.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 27, 2023
@scottfrederick
Copy link
Contributor

Thanks for the reproducer. I see that it takes some time to show the failure message with the bootBuildImage in the name.

I was using $name (instead of ${project.name}) which resolves to task name bootBuildImage (which is still a valid name for a container).

bootBuildImage is not a valid name. From the Docker reference:

PATH: The path consists consists of slash-separated components. Each component may contain lowercase letters, digits and separators.

The upper-case letters are not valid, which is reflected in the error message from the Spring Boot plugin (Image reference must be in the form '[domainHost:port/][path/]name[:tag][@digest]', with 'path' and 'name' containing only [a-z0-9][.][_][-]).

We can look at what is causing the delay (I suspect it has to do with the regular expressions we use for parsing) but I assume things are working OK for you when the image name is valid, so this is not preventing you from building images?

@scottfrederick scottfrederick added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels May 27, 2023
@mfarsikov
Copy link
Author

You are right, after giving it the correct name it works fine. Thank you

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 29, 2023
@scottfrederick scottfrederick changed the title bootBuildImage fails if configured imageName or tags compliant with Google Artifact Registry Parsing invalid OCI image names with upper case letters is very slow May 30, 2023
@scottfrederick scottfrederick added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels May 30, 2023
@scottfrederick scottfrederick added this to the 2.7.x milestone May 30, 2023
@wilkinsona wilkinsona changed the title Parsing invalid OCI image names with upper case letters is very slow Parsing OCI image names that are invalid due to the use of upper case letters is very slow Sep 4, 2023
@wilkinsona wilkinsona self-assigned this Sep 4, 2023
@wilkinsona wilkinsona modified the milestones: 2.7.x, 2.7.16 Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants