Skip to content

librarian: librarian release init creates an unnecessary nested "output" directory within the path specified by --output #2014

@jinseopkim0

Description

@jinseopkim0

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions