Expand user home dir in client filesystem

Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
This commit is contained in:
Helder Correia
2022-03-25 11:50:47 -01:00
parent 2c137210a2
commit 770acd3ce2
5 changed files with 20 additions and 15 deletions

View File

@@ -2,7 +2,9 @@ package task
import (
"fmt"
"path/filepath"
"github.com/mitchellh/go-homedir"
"github.com/moby/buildkit/client/llb"
"go.dagger.io/dagger/compiler"
)
@@ -16,3 +18,11 @@ func vertexNamef(v *compiler.Value, format string, a ...interface{}) string {
func withCustomName(v *compiler.Value, format string, a ...interface{}) llb.ConstraintsOpt {
return llb.WithCustomName(vertexNamef(v, format, a...))
}
func clientFilePath(path string) (string, error) {
expanded, err := homedir.Expand(path)
if err != nil {
return "", err
}
return filepath.Abs(expanded)
}