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

Expression cycle detected #2101

Closed
vanpeter7 opened this issue Mar 27, 2023 · 4 comments · Fixed by #2109
Closed

Expression cycle detected #2101

vanpeter7 opened this issue Mar 27, 2023 · 4 comments · Fixed by #2109
Assignees
Labels
bug Something isn't working
Milestone

Comments

@vanpeter7
Copy link

Describe the bug

We have 2 variables in our pom.xml:

  • git.build.version.tag (generated by git-commit-id-plugin with generateGitPropertiesFile and injectAllReactorProjects)
  • image.tag referencing git.build.version.tag (like <image.tag>${git.build.version.tag}</image.tag>)

When using variable image.tag in our Dockerfile like ${image.tag}, kubernetes-maven-plugin gives the error "Expression cycle detected". There is no cycle though.

Eclipse JKube version

1.9.1

Component

Kubernetes Maven Plugin

Apache Maven version

3.8.1

Gradle version

None

Steps to reproduce

  1. use 2 variables in your pom.xml like
  • git.build.version.tag (generated by git-commit-id-plugin with generateGitPropertiesFile and injectAllReactorProjects)
  • image.tag referencing git.build.version.tag (like <image.tag>${git.build.version.tag}</image.tag>)
  1. use ${image.tag} variable in Dockerfile
  2. build the Dockerfile

Expected behavior

image.tag should be resolved to the value of git.build.version.tag

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

1.25.3

Environment

macOS

Eclipse JKube Logs

Caused by: java.lang.IllegalArgumentException: Expression cycle detected, aborting.
    at org.eclipse.jkube.kit.common.JKubeFileInterpolator.checkPropertyWithDelimiters (JKubeFileInterpolator.java:137)
    at org.eclipse.jkube.kit.common.JKubeFileInterpolator.checkForPropertiesInLine (JKubeFileInterpolator.java:96)
    at org.eclipse.jkube.kit.common.JKubeFileInterpolator.interpolate (JKubeFileInterpolator.java:72)
    at org.eclipse.jkube.kit.common.JKubeFileInterpolator.interpolate (JKubeFileInterpolator.java:60)
    at org.eclipse.jkube.kit.build.api.helper.DockerFileUtil.extractLines (DockerFileUtil.java:111)
    at org.eclipse.jkube.kit.build.api.helper.DockerFileUtil.extractBaseImages (DockerFileUtil.java:67)
    at org.eclipse.jkube.kit.build.service.docker.BuildService.extractBaseFromDockerfile (BuildService.java:278)
    at org.eclipse.jkube.kit.build.service.docker.BuildService.autoPullBaseImage (BuildService.java:257)
    at org.eclipse.jkube.kit.build.service.docker.BuildService.buildImage (BuildService.java:75)

Sample Reproducer Project

No response

Additional context

No response

@vanpeter7 vanpeter7 added the bug Something isn't working label Mar 27, 2023
@BgaborBP
Copy link

We're also struggling with the same issue, and it's not really a cyclic dependency in our case, just a variable reference.

@manusa manusa added this to the 1.12.0 milestone Mar 28, 2023
@manusa
Copy link
Member

manusa commented Mar 28, 2023

We've prioritized this issue, we'll try to provide a fix for v1.12.0

@rohanKanojia
Copy link
Member

@PavelItel228 : Could you please add a comment here so that I can assign this issue to you?

@pavel1tel
Copy link
Contributor

@rohanKanojia sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
5 participants