diff --git a/components/kueue/development/tekton-kueue/config.yaml b/components/kueue/development/tekton-kueue/config.yaml index 6a6aad05eb3..044966dc342 100644 --- a/components/kueue/development/tekton-kueue/config.yaml +++ b/components/kueue/development/tekton-kueue/config.yaml @@ -38,6 +38,10 @@ cel: # Set resource requests for multi platform pipelines which doesn't use the build-platforms parameter (old style) - | + !( + has(pipelineRun.spec.params) && + pipelineRun.spec.params.exists(p, p.name == 'build-platforms') + ) && has(pipelineRun.spec.pipelineSpec) && has(pipelineRun.spec.pipelineSpec.tasks) && pipelineRun.spec.pipelineSpec.tasks.size() > 0 ? @@ -53,6 +57,10 @@ cel: # Request AWS IP for AWS-based platforms which doesn't use the build-platforms parameter (old style) - | + !( + has(pipelineRun.spec.params) && + pipelineRun.spec.params.exists(p, p.name == 'build-platforms') + ) && has(pipelineRun.spec.pipelineSpec) && has(pipelineRun.spec.pipelineSpec.tasks) && pipelineRun.spec.pipelineSpec.tasks.size() > 0 ? diff --git a/components/kueue/staging/base/tekton-kueue/config.yaml b/components/kueue/staging/base/tekton-kueue/config.yaml index 6a6aad05eb3..044966dc342 100644 --- a/components/kueue/staging/base/tekton-kueue/config.yaml +++ b/components/kueue/staging/base/tekton-kueue/config.yaml @@ -38,6 +38,10 @@ cel: # Set resource requests for multi platform pipelines which doesn't use the build-platforms parameter (old style) - | + !( + has(pipelineRun.spec.params) && + pipelineRun.spec.params.exists(p, p.name == 'build-platforms') + ) && has(pipelineRun.spec.pipelineSpec) && has(pipelineRun.spec.pipelineSpec.tasks) && pipelineRun.spec.pipelineSpec.tasks.size() > 0 ? @@ -53,6 +57,10 @@ cel: # Request AWS IP for AWS-based platforms which doesn't use the build-platforms parameter (old style) - | + !( + has(pipelineRun.spec.params) && + pipelineRun.spec.params.exists(p, p.name == 'build-platforms') + ) && has(pipelineRun.spec.pipelineSpec) && has(pipelineRun.spec.pipelineSpec.tasks) && pipelineRun.spec.pipelineSpec.tasks.size() > 0 ? diff --git a/hack/test-tekton-kueue-config.py b/hack/test-tekton-kueue-config.py index 32a4cf4160c..6c94ae62e2d 100755 --- a/hack/test-tekton-kueue-config.py +++ b/hack/test-tekton-kueue-config.py @@ -590,6 +590,65 @@ def check_prerequisites(should_print: bool = True) -> Dict[str, TestConfig]: } }, + "prefer-new-parameters": { + "name": "Only use new platform parameters when both old and new parameters exist", + "pipelinerun": { + "apiVersion": "tekton.dev/v1", + "kind": "PipelineRun", + "metadata": { + "name": "prefer-new-platform-parameters", + "namespace": "default", + "labels": { + "pipelinesascode.tekton.dev/event-type": "push", + } + }, + "spec": { + "pipelineRef": {"name": "build-pipeline"}, + "params": [ + { + "name": "build-platforms", + "value": ["linux/amd64", "linux/arm64", "linux/s390x"] + }, + { + "name": "other-param", + "value": "test" + } + ], + "pipelineSpec": { + "tasks": [ + { + "name": "build-task-amd64", + "params": [{"name": "PLATFORM", "value": "linux/amd64"}], + "taskRef": {"name": "build-task"} + }, + { + "name": "build-task-arm64", + "params": [{"name": "PLATFORM", "value": "linux/arm64"}], + "taskRef": {"name": "build-task"} + }, + { + "name": "other-task", + "taskRef": {"name": "other-task"} + } + ] + }, + "workspaces": [{"name": "shared-workspace", "emptyDir": {}}] + } + }, + "expected": { + "annotations": { + "kueue.konflux-ci.dev/requests-linux-amd64": "1", + "kueue.konflux-ci.dev/requests-linux-s390x": "1", + "kueue.konflux-ci.dev/requests-linux-arm64": "1", + "kueue.konflux-ci.dev/requests-aws-ip": "2", + }, + "labels": { + "kueue.x-k8s.io/queue-name": "pipelines-queue", + "kueue.x-k8s.io/priority-class": "konflux-post-merge-build", + } + } + }, + } # Configuration combinations that can be applied to any PipelineRun @@ -660,6 +719,10 @@ def check_prerequisites(should_print: bool = True) -> Dict[str, TestConfig]: "pipelinerun_key": "mixed_platforms_excluded_included", "config_key": "development" }, + "prefer_new_parameters_dev": { + "pipelinerun_key": "prefer-new-parameters", + "config_key": "development" + }, # multiplatform_old edge cases "multiplatform_old_no_pipelineSpecTasks": { @@ -688,6 +751,10 @@ def check_prerequisites(should_print: bool = True) -> Dict[str, TestConfig]: "pipelinerun_key": "mintmaker", "config_key": "staging" }, + "prefer_new_parameters_staging": { + "pipelinerun_key": "prefer-new-parameters", + "config_key": "staging" + }, # Test key PipelineRuns with production config "multiplatform_new_production": {