Skip to content

Read an argument and an image name without rewrite-docker internals - #1220

Merged
timtebeek merged 1 commit into
mainfrom
tim/revert-upstream-8636-impact
Aug 24, 2026
Merged

Read an argument and an image name without rewrite-docker internals#1220
timtebeek merged 1 commit into
mainfrom
tim/revert-upstream-8636-impact

Conversation

@timtebeek

@timtebeek timtebeek commented Aug 24, 2026

Copy link
Copy Markdown
Member
  • Docker: revert rewrite-docker to its state before #8583 rewrite#8636 reverts rewrite-docker to its state before #8583, taking org.openrewrite.docker.internal.ArgumentContents and org.openrewrite.docker.trait.ImageName with it. UpgradeDockerImageVersion imports both, so main stops compiling the moment a snapshot carrying that revert lands. It merged this morning as 63b15b0b07, and this recipe is the only thing in this repository that touches rewrite-docker.

  • Both classes were thin. text, textWithVariables and containsVariable walk an argument's contents, and only getPath() and getRegistry() of ImageName were ever read, so they move into the recipe as private helpers, registry detection rule and all. Nothing else the recipe reaches for moves in the revert: the tree types, Docker.File.getGlobalArgs() and DockerFrom's getImageName, getTag, withImageReference and withTag all predate #8583.

  • That also finishes what Upgrade ARG default values used in Docker FROM instructions (hold for rewrite release) #1216 started. The recipe now links against no internal package and no trait helper, so the Moderne CLI classloader split that Revert "Upgrade ARG default values used in Docker FROM instructions" #1215 came from has nothing left to split on.

Two things the reverted grammar no longer does needed answering:

  • An ARG default value's quotes sit inside the text of its literal rather than in the literal's quote style, so ARG JAVA_VERSION="11" read back as "11" and matched no version. They are taken off on read and put back on write, both no-ops against a version that models the quotes, so this holds either way.
  • FROM eclipse-temurin: no longer round-trips, printing as FROM eclipse-temurin and failing the parser's own idempotency check. That is upstream and unrelated to this recipe, so the case leaves the no-change rows.

Verified against openrewrite/rewrite at 63b15b0b07, built and published locally: all 78 tests of UpgradeDockerImageVersionTest pass.

Reverting this

openrewrite/rewrite#8636 reverts `rewrite-docker` to its state before #8583,
taking `org.openrewrite.docker.internal.ArgumentContents` and
`org.openrewrite.docker.trait.ImageName` with it. This recipe imports both, so
main stops compiling the moment a snapshot carrying that revert lands.

Both were thin. `text`, `textWithVariables` and `containsVariable` walk an
argument's contents, and only `getPath()` and `getRegistry()` of `ImageName`
were ever read, so they move here as private helpers, registry detection rule
and all. Nothing else the recipe reaches for moves in the revert: the tree
types, `Docker.File.getGlobalArgs()` and `DockerFrom`'s `getImageName`,
`getTag`, `withImageReference` and `withTag` all predate #8583.

That also finishes what #1216 started. The recipe now links against no
`internal` package and no trait helper, so the Moderne CLI classloader split
that #1215 came from has nothing left to split on.

Two things the reverted grammar no longer does needed answering:

An `ARG` default value's quotes sit inside the text of its literal rather than
in the literal's quote style, so `ARG JAVA_VERSION="11"` read back as `"11"`
and matched no version. They are taken off on read and put back on write, both
no-ops against a version that models the quotes, so this holds either way.

`FROM eclipse-temurin:` no longer round-trips, printing as
`FROM eclipse-temurin` and failing the parser's own idempotency check. That is
upstream and unrelated to this recipe, so the case leaves the no-change rows.

Verified against openrewrite/rewrite at 63b15b0b07 built and published locally:
all 78 tests of `UpgradeDockerImageVersionTest` pass.
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Aug 24, 2026
@timtebeek
timtebeek merged commit 98b99c7 into main Aug 24, 2026
1 check passed
@timtebeek
timtebeek deleted the tim/revert-upstream-8636-impact branch August 24, 2026 08:46
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant