Tekton 任务结果作为空传递给下游任务

Tekton Task result passed as empty to a downstream task

我正在创建一个部署管道,它将包作为 Python 包部署到 Pypi 或 Docker 容器。我想通过处理 workspace 的内容并通过判决("Python" 或 [=14] 来确保正确部署 Task =]) 到下游任务中的 when 块。

问题是,当我将结果传递给 when 块时,它与值不匹配,即使我认为它应该匹配,就像我在创建它的任务中记录结果时一样,甚至将其分配给参数并将其记录在具有预期内容的下游任务中。

没有 when 块的管道执行没有问题。

系统信息:

$ tkn version
Client version: 0.15.0
Pipeline version: v0.24.1
Triggers version: v0.8.1

$ k version --short
Client Version: v1.19.0
Server Version: v1.19.0+b00ba52

管道中的相关任务:

- name: check-appropriate-build-task
  taskRef:
    kind: Task
    name: check-build-type
  workspaces:
    - name: source
      workspace: shared-workspace
  runAfter:
    - fetch-repository

- name: build-and-upload-python-package
  params:
    - name: TWINE_REPOSITORY_URL
      value: $(params.twine-url)
  when:
    - input: $(tasks.check-appropriate-build-task.results.build-type)
      operator: in
      values: 
        - "Python"
  taskRef:
    kind: Task
    name: upload-pypi
  workspaces:
    - name: source
      workspace: shared-workspace
  runAfter:
    - check-appropriate-build-task

检查构建类型任务:

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: check-build-type
spec:
  results:
    - name: build-type
  workspaces:
    - name: source
  steps:
    - name: check-build-type
      image: alpine
      script: |
        if test -f "$(workspaces.source.path)/setup.cfg"; then
          if grep -q Python "$(workspaces.source.path)/setup.cfg"; then
              echo "Python" > $(results.build-type.path)
          fi
        elif test -f "$(workspaces.source.path)/Dockerfile"; then
            echo "Docker" > $(results.build-type.path)
        fi
        cat $(results.build-type.path)

提前致谢。

由于尾随 \n,检查似乎失败了。

我们可以修复检查构建类型的任务,将 echo 替换为 echo -n