Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions playground/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,14 @@ func NewOutput(dst string) (*output, error) {
if dst == "" {
// Use the $HOMEDIR/devnet as the default output
dst = filepath.Join(homeDir, "devnet")
} else {
// Convert relative paths to absolute paths
if !filepath.IsAbs(dst) {
dst, err = filepath.Abs(dst)
if err != nil {
return nil, fmt.Errorf("failed to convert relative path to absolute: %w", err)
}
}
}

out := &output{dst: dst, homeDir: homeDir}
Expand All @@ -548,10 +556,6 @@ func (o *output) Read(path string) (string, error) {
return string(data), nil
}

func (o *output) AbsoluteDstPath() (string, error) {
return filepath.Abs(o.dst)
}

func (o *output) Exists(path string) bool {
_, err := os.Stat(filepath.Join(o.dst))
return err == nil
Expand Down
6 changes: 2 additions & 4 deletions playground/components_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,8 @@ func (tt *testFramework) test(component ComponentGen, args []string) *Manifest {
t.Fatal(err)
}

o := &output{
dst: e2eTestDir,
homeDir: filepath.Join(e2eTestDir, "artifacts"),
}
o, err := NewOutput(e2eTestDir)
require.NoError(t, err)

exCtx := &ExContext{
Output: o,
Expand Down
5 changes: 1 addition & 4 deletions playground/local_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,7 @@ func (d *LocalRunner) toDockerComposeService(s *Service) (map[string]interface{}

// The containers have access to the full set of artifacts on the /artifacts folder
// so, we have to bind it as a volume on the container.
outputFolder, err := d.out.AbsoluteDstPath()
if err != nil {
return nil, nil, fmt.Errorf("failed to get absolute path for output folder: %w", err)
}
outputFolder := d.out.Dst()

// Validate that the image exists
imageName := fmt.Sprintf("%s:%s", s.Image, s.Tag)
Expand Down