Skip to content

Commit

Permalink
We are not interested in step sources
Browse files Browse the repository at this point in the history
  • Loading branch information
MDrakos committed Sep 26, 2023
1 parent 4363c54 commit c875c3e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions pkg/platform/runtime/buildplan/buildplan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit c875c3e

Please sign in to comment.