The librarian release init command currently exhibits unexpected behavior regarding the --output flag. The --output flag is defined as an alias for the WorkRoot configuration in internal/librarian/flags.go and is used in internal/librarian/release_init.go.
When a path is provided via --output, the tool internally uses this path as the workRoot. However, it then creates a subdirectory named "output" within this workRoot, rather than using the workRoot directly as the base for container outputs.
This behavior stems from the run function in internal/librarian/release_init.go, specifically this line:
outputDir := filepath.Join(r.workRoot, "output")
Here, r.workRoot is the value from the --output flag. The code then appends another "output" segment to it before using it as the source for the container's /output volume mount.
Impact:
This causes the actual output path on the host to be different from the path specified in the --output flag, violating user expectations and complicating test setups. For instance, files written to /output inside the container will appear in <output_flag_value>/output on the host, not directly in <output_flag_value>.
Suggested Fix:
Modify the line in internal/librarian/release_init.go to use the workRoot directly as the base for the container's output mount:
outputDir := r.workRoot
This will ensure the path provided by the --output flag is the exact host path mapped to the container's /output volume.
The
librarian release initcommand currently exhibits unexpected behavior regarding the--outputflag. The--outputflag is defined as an alias for theWorkRootconfiguration ininternal/librarian/flags.goand is used ininternal/librarian/release_init.go.When a path is provided via
--output, the tool internally uses this path as theworkRoot. However, it then creates a subdirectory named "output" within thisworkRoot, rather than using theworkRootdirectly as the base for container outputs.This behavior stems from the
runfunction ininternal/librarian/release_init.go, specifically this line:outputDir := filepath.Join(r.workRoot, "output")Here,
r.workRootis the value from the--outputflag. The code then appends another "output" segment to it before using it as the source for the container's/outputvolume mount.Impact:
This causes the actual output path on the host to be different from the path specified in the
--outputflag, violating user expectations and complicating test setups. For instance, files written to/outputinside the container will appear in<output_flag_value>/outputon the host, not directly in<output_flag_value>.Suggested Fix:
Modify the line in
internal/librarian/release_init.goto use theworkRootdirectly as the base for the container's output mount:outputDir := r.workRootThis will ensure the path provided by the
--outputflag is the exact host path mapped to the container's/outputvolume.