/ busybox / sh:语法错误:用Tekton替代错误

问题描述

我正在尝试从Github中提取代码,然后使用Tekton管道和Kubernetes集群上的Knative将docker映像构建并推送到docker hub。 我正在跟踪此链接以进行Tekton的安装和设置: https://www.ibm.com/cloud/blog/build-a-knative-service-with-tekton-and-apache-openwhisk-nodejs-runtime

task-build.yaml

apiVersion: tekton.dev/v1alpha1
kind: Task
Metadata:
  name: task-build
spec:
  inputs:
    resources:
      - name: docker-source
        type: git
    params:
      - name: TARGET_IMAGE_NAME
        description: name of the image to be tagged and pushed
      - name: TARGET_IMAGE_TAG
        description: tag the image before pushing
        default: "latest"
      - name: DOCKERFILE
        description: name of the dockerfile
      - name: OW_RUNTIME_DEBUG
        description: flag to indicate debug mode should be on/off
        default: "false"
      - name: OW_RUNTIME_PLATFORM
        description: flag to indicate the platform,one of ["openwhisk","knative",... ]
        default: "knative"
      - name: OW_ACTION_NAME
        description: name of the action
        default: "foo"
      - name: OW_ACTION_CODE
        description: JavaScript source code to be evaluated
        default: ""
      - name: OW_ACTION_MAIN
        description: name of the function in the "__OW_ACTION_CODE" to call as the action handler
        default: "main"
      - name: OW_ACTION_BINARY
        description: flag to indicate zip function,for zip actions,"__OW_ACTION_CODE" must be base64 encoded string
        default: "false"
      - name: OW_HTTP_METHODS
        description: list of HTTP methods,any combination of [GET,POST,PUT,and DELETE],default is [POST]
        default: "[POST]"
      - name: OW_ACTION_RAW
        description: flag to indicate raw HTTP handling,interpret and process an incoming HTTP body directly
        default: "false"
  outputs:
    resources:
      - name: builtimage
        type: image
  steps:
    - name: add-ow-env-to-dockerfile
      image: "gcr.io/kaniko-project/executor:debug"
      command:
      - /busyBox/sh
      args:
      - -c
      - |
        cat <<EOF >> ${inputs.params.DOCKERFILE}
          ENV __OW_RUNTIME_DEBUG "${inputs.params.OW_RUNTIME_DEBUG}"
          ENV __OW_RUNTIME_PLATFORM "${inputs.params.OW_RUNTIME_PLATFORM}"
          ENV __OW_ACTION_NAME "${inputs.params.OW_ACTION_NAME}"
          ENV __OW_ACTION_CODE "${inputs.params.OW_ACTION_CODE}"
          ENV __OW_ACTION_MAIN "${inputs.params.OW_ACTION_MAIN}"
          ENV __OW_ACTION_BINARY "${inputs.params.OW_ACTION_BINARY}"
          ENV __OW_HTTP_METHODS "${inputs.params.OW_HTTP_METHODS}"
          ENV __OW_ACTION_RAW "${inputs.params.OW_ACTION_RAW}"
        EOF
    - name: adapt-dockerfile-to-tekton
      image: "gcr.io/kaniko-project/executor:debug"
      command:
      - sed
      args:
      - -i
      - -e
      - 's/copY ./copY .\/docker-source/g'
      - ${inputs.params.DOCKERFILE}
    - name: build-openwhisk-nodejs-runtime
      image: "gcr.io/kaniko-project/executor:latest"
      args: ["--destination=${inputs.params.TARGET_IMAGE_NAME}:${inputs.params.TARGET_IMAGE_TAG}","--dockerfile=${inputs.params.DOCKERFILE}"]

尝试构建和推送图像时,出现错误

conditions:
  - lastTransitionTime: "2020-09-24T07:33:11Z"
"step-add-ow-env-to-dockerfile" exited with code 2 (image: "docker-pullable://gcr.io/kaniko-project/executor@sha256:0f27b0674797b56db08010dff799c8926c4e9816454ca56cc7844df228c53485"); for logs run: kubectl -n default logs task-run-helloworld-pod-5bbkx -c step-add-ow-env-to-dockerfile
    reason: Failed
    status: "False"
    type: Succeeded

当检查日志中是否有错误消息时,我得到:

错误:/ busyBox / sh:语法错误:替换错误

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)