From c875c3e9922da64824f9485dd753e3f5520e6ea9 Mon Sep 17 00:00:00 2001 From: mdrakos Date: Tue, 26 Sep 2023 09:52:41 -0700 Subject: [PATCH] We are not interested in step sources --- pkg/platform/runtime/buildplan/buildplan.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/pkg/platform/runtime/buildplan/buildplan.go b/pkg/platform/runtime/buildplan/buildplan.go index d316b96b19..fce2d8c230 100644 --- a/pkg/platform/runtime/buildplan/buildplan.go +++ b/pkg/platform/runtime/buildplan/buildplan.go @@ -323,13 +323,6 @@ func BuildtimeArtifacts(build *model.Build) (artifact.Map, error) { logging.Debug("Terminal Targets: %v", terminalTargetIDs) result := make(artifact.Map) - // TODO: How can we calculate the build time closure from the terminal targets? - // From the terminal targets we iterate through the runtime dependencies as we - // normall do but this time when we get to a step we also include it's dependencies. - // This will include the builder artifacts. - // We also need to inspect each dependencies to ensure that it was generated by a step - // and not a source. If the depenedency was generated by a source then it will not - // be built so we don't need to worry about events from it. for _, id := range terminalTargetIDs { err = buildBuildClosureMap(id, lookup, result) if err != nil { @@ -355,8 +348,8 @@ func buildBuildClosureMap(baseID strfmt.UUID, lookup map[strfmt.UUID]interface{} // deps here refer to the dependencies of the artifact itself. // This includes the direct dependencies, which we get through - // the RuntimeDependencies field, as well as the inputs of the - // step that generated the artifact. + // the RuntimeDependencies field, as well as the inputs AND + // dependencies of the step that generated the artifact. deps := make(map[strfmt.UUID]struct{}) for _, depID := range currentArtifact.RuntimeDependencies { // Add our current dependency to the map of dependencies @@ -373,6 +366,8 @@ func buildBuildClosureMap(baseID strfmt.UUID, lookup map[strfmt.UUID]interface{} deps[a] = struct{}{} } + // For each runtime dependency we need to add its dependencies + // to the result map. err = buildBuildClosureMap(depID, lookup, result) if err != nil { return errs.Wrap(err, "Could not build map for runtime dependency %s", currentArtifact.NodeID) @@ -460,6 +455,10 @@ func generateBuildtimeDependencies(artifactID strfmt.UUID, lookup map[strfmt.UUI // artifact and recursively add all of the dependencies and builders // of those artifacts. for _, input := range step.Inputs { + if input.Tag != model.TagDependency || input.Tag != model.TagBuilder { + continue + } + for _, id := range input.NodeIDs { _, err := generateBuildtimeDependencies(id, lookup, result) if err != nil {