diff --git a/earthfile2llb/converter.go b/earthfile2llb/converter.go index 5875d512..fc718b8e 100644 --- a/earthfile2llb/converter.go +++ b/earthfile2llb/converter.go @@ -144,8 +144,12 @@ func NewConverter(ctx context.Context, target domain.Target, bc *buildcontext.Da ovVars = append(ovVars, fmt.Sprintf("%s=%s", k, v)) } logbusTarget, err := opt.Logbus.Run().NewTarget( - sts.ID, target.String(), target.StringCanonical(), ovVars, - opt.PlatformResolver.Current().String(), opt.Runner) + sts.ID, + target, + ovVars, + opt.PlatformResolver.Current().String(), + opt.Runner, + ) if err != nil { return nil, errors.Wrap(err, "new logbus target") } diff --git a/go.mod b/go.mod index ccad4f86..569cdc13 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/docker/distribution v2.8.2+incompatible github.com/docker/go-connections v0.4.0 github.com/dustin/go-humanize v1.0.1 - github.com/earthly/cloud-api v1.0.1-0.20230914190823-c58662fdabd8 + github.com/earthly/cloud-api v1.0.1-0.20231027183434-d79534194d95 github.com/earthly/earthly/ast v0.0.0-00010101000000-000000000000 github.com/earthly/earthly/util/deltautil v0.0.0-00010101000000-000000000000 github.com/elastic/go-sysinfo v1.9.0 diff --git a/go.sum b/go.sum index 668d55a9..68379b1e 100644 --- a/go.sum +++ b/go.sum @@ -187,6 +187,10 @@ github.com/earthly/buildkit v0.0.0-20231025204852-d5e9d257c398 h1:Zco4CmxV7h1lds github.com/earthly/buildkit v0.0.0-20231025204852-d5e9d257c398/go.mod h1:AJ3nMleWpsh6L06n2sFkT70+zGjnD9+rtsdmyw5YHLU= github.com/earthly/cloud-api v1.0.1-0.20230914190823-c58662fdabd8 h1:8EW/AMPNtzOcExSV7Dk1weQGK/XqbAuhvLs062xlBH4= github.com/earthly/cloud-api v1.0.1-0.20230914190823-c58662fdabd8/go.mod h1:rU/tYJ7GFBjdKAITV2heDbez++glpGSbtJaZcp73rNI= +github.com/earthly/cloud-api v1.0.1-0.20231026202759-f8644c3705ad h1:F5gQOTQ1KtzkiSLRMpw5C05dJw//OUcBehMZpoAdLYc= +github.com/earthly/cloud-api v1.0.1-0.20231026202759-f8644c3705ad/go.mod h1:rU/tYJ7GFBjdKAITV2heDbez++glpGSbtJaZcp73rNI= +github.com/earthly/cloud-api v1.0.1-0.20231027183434-d79534194d95 h1:stFmLhGY7dbf4UhBtbMIN+oaIMEDZez/epwHt7g6MqM= +github.com/earthly/cloud-api v1.0.1-0.20231027183434-d79534194d95/go.mod h1:rU/tYJ7GFBjdKAITV2heDbez++glpGSbtJaZcp73rNI= github.com/earthly/fsutil v0.0.0-20230530182746-82567e6e2a92 h1:dy3w3B4OiDyQS+iHi/beUgMDJ1+fAAgbtr7OZ0d9ks0= github.com/earthly/fsutil v0.0.0-20230530182746-82567e6e2a92/go.mod h1:q1CxMSzcAbjUkVGHoZeQUcCaALnaE4XdWk+zJcgMYFw= github.com/elastic/go-sysinfo v1.9.0 h1:usICqY/Nw4Mpn9f4LdtpFrKxXroJDe81GaxxUlCckIo= diff --git a/logbus/run.go b/logbus/run.go index ca5f8a44..f4f6b72e 100644 --- a/logbus/run.go +++ b/logbus/run.go @@ -7,6 +7,7 @@ import ( "github.com/earthly/cloud-api/logstream" "github.com/earthly/earthly/ast/spec" + "github.com/earthly/earthly/domain" ) // Run is a run logstream delta generator for a run. @@ -39,7 +40,7 @@ func (run *Run) Generic() *Generic { } // NewTarget creates a new target printer. -func (run *Run) NewTarget(targetID, shortTargetName, canonicalTargetName string, overrideArgs []string, initialPlatform string, runner string) (*Target, error) { +func (run *Run) NewTarget(targetID string, target domain.Target, overrideArgs []string, initialPlatform string, runner string) (*Target, error) { run.mu.Lock() defer run.mu.Unlock() mainTargetID := "" @@ -56,17 +57,21 @@ func (run *Run) NewTarget(targetID, shortTargetName, canonicalTargetName string, MainTargetId: mainTargetID, Targets: map[string]*logstream.DeltaTargetManifest{ targetID: { - Name: shortTargetName, - CanonicalName: canonicalTargetName, + Name: target.String(), // Includes "+" prefix (e.g., "+target-name"). + CanonicalName: target.StringCanonical(), + GitUrl: target.GetGitURL(), + LocalPath: target.GetLocalPath(), + Tag: target.GetTag(), + ImportRef: target.GetImportRef(), OverrideArgs: overrideArgs, InitialPlatform: initialPlatform, Runner: runner, }, }, }) - target := newTarget(run.b, targetID) - run.targets[targetID] = target - return target, nil + t := newTarget(run.b, targetID) + run.targets[targetID] = t + return t, nil } // Target returns the target printer for the given target ID. diff --git a/util/deltautil/apply.go b/util/deltautil/apply.go index 28796c08..fef185ce 100644 --- a/util/deltautil/apply.go +++ b/util/deltautil/apply.go @@ -112,6 +112,18 @@ func setManifestFields(dm *pb.DeltaManifest, ret *pb.RunManifest) { if t2.GetEndedAtUnixNanos() != 0 { t.EndedAtUnixNanos = t2.GetEndedAtUnixNanos() } + if t2.GetGitUrl() != "" { + t.GitUrl = t2.GetGitUrl() + } + if t2.GetTag() != "" { + t.Tag = t2.GetTag() + } + if t2.GetImportRef() != "" { + t.ImportRef = t2.GetImportRef() + } + if t2.GetLocalPath() != "" { + t.LocalPath = t2.GetLocalPath() + } } for commandID, c2 := range f.GetCommands() { c := ensureCommandExists(ret, commandID) diff --git a/util/deltautil/go.mod b/util/deltautil/go.mod index a22ac482..87c098e1 100644 --- a/util/deltautil/go.mod +++ b/util/deltautil/go.mod @@ -3,7 +3,7 @@ module github.com/earthly/earthly/util/deltautil go 1.21 require ( - github.com/earthly/cloud-api v1.0.1-0.20221201210730-b407492c9901 + github.com/earthly/cloud-api v1.0.1-0.20231027183434-d79534194d95 google.golang.org/protobuf v1.30.0 ) diff --git a/util/deltautil/go.sum b/util/deltautil/go.sum index 51f97353..8104790a 100644 --- a/util/deltautil/go.sum +++ b/util/deltautil/go.sum @@ -1,5 +1,7 @@ github.com/earthly/cloud-api v1.0.1-0.20221201210730-b407492c9901 h1:HBmy3zsOcRrZzL6uCJKgENXvHFfcFIyXZyrLvYoYtR4= github.com/earthly/cloud-api v1.0.1-0.20221201210730-b407492c9901/go.mod h1:38rj6sccWnuk+C981DeFFomBmAtwuuvchoPrXdKXi2I= +github.com/earthly/cloud-api v1.0.1-0.20231027183434-d79534194d95 h1:stFmLhGY7dbf4UhBtbMIN+oaIMEDZez/epwHt7g6MqM= +github.com/earthly/cloud-api v1.0.1-0.20231027183434-d79534194d95/go.mod h1:rU/tYJ7GFBjdKAITV2heDbez++glpGSbtJaZcp73rNI= github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=