Class ManagedFileMarker

java.lang.Object
io.github.duckasteroid.gradle.versioning.releaseflow.ManagedFileMarker

public final class ManagedFileMarker extends Object
The "# duckasteroid-managed: componentId version sha256:hash" marker comment that a ManagedFileInstaller.install(...) call stamps as the first line of every file it installs, and that a matching ManagedFileChecker.check(...) call later re-parses to detect staleness/tampering. The hash covers everything BELOW the marker line (the templated body), never the marker line itself - a self-attestation, not a tamper-proof checksum: it only needs to catch the realistic accident (editing a step without touching the marker comment), not someone deliberately recomputing a matching hash.

componentId namespaces the marker by whichever plugin/feature installed the file (e.g. "release-flow") - installReleaseWorkflows is the only caller today, but namespacing from the start means a second installer can never have its file misread as belonging to a different component, or vice versa.

  • Field Details

  • Constructor Details

    • ManagedFileMarker

      public ManagedFileMarker(String componentId, String version, String sha256)
  • Method Details

    • getComponentId

      public String getComponentId()
    • getVersion

      public String getVersion()
    • getSha256

      public String getSha256()
    • render

      public String render()
    • matchesBody

      public boolean matchesBody(String body)
    • forBody

      public static ManagedFileMarker forBody(String componentId, String version, String body)
    • sha256Of

      public static String sha256Of(String body)
    • parse

      public static ManagedFileMarker parse(String firstLine)
      Parses a marker line, or returns null if it isn't one (foreign/hand-written file).