Skip to content

Commit

Permalink
feat: Enable build-source-image and prefetch-dependencies tasks
Browse files Browse the repository at this point in the history
Signed-off-by: Chenxiong Qi <[email protected]>
  • Loading branch information
tkdchen committed Jun 5, 2024
1 parent cb300d5 commit 7bb0ac5
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions magefiles/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,20 @@ func SetupMultiPlatformTests() error {
var lastBundle *tektonapi.Param
var lastName *tektonapi.Param
buildahTask := false
prefetchDepsTask := false
buildSourceImageTask := false
for i, param := range params {
if param.Name == "bundle" {
lastBundle = &t.TaskRef.Params[i]
} else if param.Name == "name" && param.Value.StringVal == "buildah" {
lastName = &t.TaskRef.Params[i]
buildahTask = true
} else if param.Name == "name" && param.Value.StringVal == "prefetch-dependencies" {
lastName = &t.TaskRef.Params[i]
prefetchDepsTask = true
} else if param.Name == "name" && param.Value.StringVal == "build-source-image" {
lastName = &t.TaskRef.Params[i]
buildSourceImageTask = true
}
}
if buildahTask {
Expand All @@ -598,6 +606,24 @@ func SetupMultiPlatformTests() error {
t.Params = append(t.Params, tektonapi.Param{Name: "PLATFORM", Value: *tektonapi.NewStructuredValues("$(params.PLATFORM)")})
dockerPipelineObject.Spec.Params = append(dockerPipelineObject.PipelineSpec().Params, tektonapi.ParamSpec{Name: "PLATFORM", Default: tektonapi.NewStructuredValues(platformType)})
dockerPipelineObject.Name = "buildah-remote-pipeline"
} else if prefetchDepsTask {
// Always run prefetch-dependencies task for prefetching RPMs
t.When = make([]tektonapi.WhenExpression, 0, 5)
// There is a test repo is used for testing including prefetched SRPMs
t.Params = make([]tektonapi.Param, 0, 5)
t.Params = append(t.Params, tektonapi.Param{Name: "input", Value: *tektonapi.NewStructuredValues(`{"type": "rpm"}`)})
} else if buildSourceImageTask {
// Enable source container build.
newWhenExpressions := make([]tektonapi.WhenExpression, 0, 5)
for _, expression := range t.When {
if expression.Input == "$(params.build-source-image)" {
continue
}
newWhenExpressions = append(newWhenExpressions, expression)
}
t.When = newWhenExpressions
}
if buildahTask && prefetchDepsTask && buildSourceImageTask {
break
}
}
Expand Down

0 comments on commit 7bb0ac5

Please sign in to comment.