pipeline icon indicating copy to clipboard operation
pipeline copied to clipboard

pipelinerun-with-when-expressions

Open ForcemCS opened this issue 6 months ago • 2 comments

I don't understand why my finally task isn't executing:

root@master01:~/v1.30/12-tekton/clone-build-helm# kubectl get   pods  
NAME                                             READY   STATUS      RESTARTS       AGE
clone-build-helm-fqwfv-build-push-pod            0/2     Completed   0              4m14s
clone-build-helm-fqwfv-fetch-source-pod          0/1     Completed   0              4m24s
clone-build-helm-fqwfv-helm-install-middle-pod   0/1     Completed   0              42s

root@master01:~/v1.30/12-tekton/clone-build-helm# cat   01-pipeline.yaml 
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
  name: clone-build-helm
spec:
  description: |
    This pipeline clones a git repo, builds a Docker image with Kaniko and
    pushes it to a registry    
  params:
  - name: repo-url
    type: string
    description: GitLab的项目地址
  - name: subdirectory
    type: string
  - name: gitrevision-tag
    type: string
    description: 项目分支名称
   ....
  finally:
  - name: send-wechat-notification  # when expression using execution status, evaluates to false		  
    when:
      - input: "$(tasks.status)"
        operator: in
        values: ["Completed"]
    taskSpec:
      steps:
        - name: send-notification
          image: curlimages/curl
          script: |
            #!/usr/bin/env sh
              curl 'https://qyapi.weixin.qq.com/xxxxxxxxxxxx' \
                                 -H 'Content-Type: application/json' \
                                 -d '
                                  {
                                      "msgtype": "text",
                                      "text": {
                                          "content": "中台前端发布完成",
                                                  "mentioned_list":["WuKui","@all"]
                                      }
                                  }'


ForcemCS avatar Jul 30 '24 01:07 ForcemCS