Skip to content

Commit

Permalink
fix(cli): changes file paths to relative paths for the registry client
Browse files Browse the repository at this point in the history
Since the build path is in a disposable directory, it cannot be included
in the "title" annotation on the artifacts. To fix this, relative paths within
the workspace are passed to the oras client and the directory is changed before
processing.

Closes #10

Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
  • Loading branch information
jpower432 committed Jun 1, 2022
1 parent 80a297c commit 0413080
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions cli/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,26 @@ func (o *BuildOptions) Run(ctx context.Context) error {
}

if info.Mode().IsRegular() {
p := renderSpace.Path(path)
files = append(files, p)
files = append(files, path)
}
return nil
})
if err != nil {
return err
}

// To allow the files to be loaded relative to the render
// workspace, change to the render directory. This is required
// to get path correct in the description annotations.
cwd, err := os.Getwd()
if err != nil {
return err
}
if err := os.Chdir(renderSpace.Path()); err != nil {
return err
}
defer os.Chdir(cwd)

descs, err := client.GatherDescriptors("", files...)
if err != nil {
return err
Expand Down

0 comments on commit 0413080

Please sign in to comment.