Tekton CICD demo 5

参考

https://github.com/tektoncd/triggers/tree/main/examples

https://www.arthurkoziel.com/tutorial-tekton-triggers-with-github-integration/

本例中将设置一个trigger,用来从 github 触发构建

首先创建 rbac, 这里官网的 rbac我没有跑通,所以偷个懒直接给了 cluster 级别的 admin 权限

apiVersion: v1
kind: ServiceAccount
metadata:
  name: tekton-triggers-lizhe-sa
  namespace: lizhe
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: tekton-triggers-lizhe-sa-binding
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
  - kind: ServiceAccount
    name: tekton-triggers-lizhe-sa
    namespace: lizhe

官方文档里给出需要一个 github 的 secret token,不过实际上我没有用上,因为我是 secret + service account 绑定的,不过还是列在这里仅供参考

==================参考项目开始======================

apiVersion: v1
kind: Secret
metadata:
  name: github-secret
type: Opaque
stringData:
  secretToken: "123456"

在 your profile 中,找到 developer settings

==================参考项目结束======================

创建binding ,实际上binding 并不是用来绑定什么,而更像是用来传递参数的

不过这里我没用参数,所以都注释掉了,之所以留下helloworld 是因为如果一个参数都不写的话,dashboard会报错

apiVersion: triggers.tekton.dev/v1alpha1
kind: TriggerBinding
metadata:
  name: github-pr-binding
  namespace: lizhe
spec:
  params:
    - name: hello
    - value: world
    # - name: gitrepositoryurl
    #   value: https://github.com/zl86790/tektongolang.git
    # - name: gitrevision
    #   value: master

创建 trigger template

apiVersion: triggers.tekton.dev/v1beta1
kind: TriggerTemplate
metadata:
  name: pipeline-template
  namespace: lizhe
spec:
  params:
  - name: hello
    description: useless param
    default: world
  # - name: gitrevision
  #   description: The git revision
  #   default: master
  # - name: gitrepositoryurl
  #   description: The git repository url
  resourcetemplates:
    - apiVersion: tekton.dev/v1beta1
      kind: PipelineRun
      metadata:
        generateName: pipeline-demo-run-
        namespace: lizhe
      spec:
        serviceAccountName: build-bot-sa
        pipelineRef:
          name: pipeline-demo
        resources:
          - name: source-repo
            resourceRef:
              name: tektongolang-git
          - name: tektongolang-image
            resourceRef:
              name: tektongolang-image
          - name: dep-repo
            resourceRef:
              name: tektongolang-dep-git
        workspaces:
          - name: build-workspace # this workspace name must be declared in the Pipeline
            volumeClaimTemplate:
              spec:
                storageClassName: "local-path"
                accessModes:
                  - ReadWriteOnce # access mode may affect how you can use this volume in parallel tasks
                resources:
                  requests:
                    storage: 1Gi

这里如果你不像上面那样使用 resourceRef,就可以通过参数来构建 git repo, tt 指的是 trigger template,是内置的

      spec:
        pipelineRef:
          name: github-pr-pipeline
        resources:
          - name: source
            resourceSpec:
              type: git
              params:
                - name: revision
                  value: $(tt.params.gitrevision)
                - name: url
                  value: $(tt.params.gitrepositoryurl)

最后通过 eventlistener 把 trigger template 和 triggerbinding 绑定在一起

apiVersion: triggers.tekton.dev/v1alpha1
kind: EventListener
metadata:
  name: github-pr
  namespace: lizhe
spec:
  serviceAccountName: tekton-triggers-lizhe-sa
  triggers:
    - name: github-listener
      interceptors:
      #   - ref:
      #       name: "github"
      #     params:
      #       - name: "secretRef"
      #         value:
      #           secretName: github-secret
      #           secretKey: secretToken
      #       - name: "eventTypes"
      #         value: ["pull_request"]
        - ref:
            name: "cel"
          params:
            - name: "filter"
              value: "body.action in ['opened', 'synchronize', 'reopened','closed']"
      bindings:
        - ref: github-pr-binding
      template:
        ref: pipeline-template

这里的 interceptor 用来过滤 webhook 的request,例如这里写到 body.action 有4种,那么我们使用的request为

{
  "action": "closed",
  "number": 1,
  "pull_request": {
    "url": "https://api.github.com/repos/zl86790/tektongolang/pulls/1",
    "id": 700932179,
    "node_id": "MDExOlB1bGxSZXF1ZXN0NzAwOTMyMTc5",
    "html_url": "https://github.com/zl86790/tektongolang/pull/1",
    "diff_url": "https://github.com/zl86790/tektongolang/pull/1.diff",
    "patch_url": "https://github.com/zl86790/tektongolang/pull/1.patch",
    "issue_url": "https://api.github.com/repos/zl86790/tektongolang/issues/1",
    "number": 1,
    "state": "closed",
    "locked": false,
    "title": "Update helloworld.txt",
    "user": {
      "login": "zl86790",
      "id": 18146284,
      "node_id": "MDQ6VXNlcjE4MTQ2Mjg0",
      "avatar_url": "https://avatars.githubusercontent.com/u/18146284?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/zl86790",
      "html_url": "https://github.com/zl86790",
      "followers_url": "https://api.github.com/users/zl86790/followers",
      "following_url": "https://api.github.com/users/zl86790/following{/other_user}",
      "gists_url": "https://api.github.com/users/zl86790/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/zl86790/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/zl86790/subscriptions",
      "organizations_url": "https://api.github.com/users/zl86790/orgs",
      "repos_url": "https://api.github.com/users/zl86790/repos",
      "events_url": "https://api.github.com/users/zl86790/events{/privacy}",
      "received_events_url": "https://api.github.com/users/zl86790/received_events",
      "type": "User",
      "site_admin": false
    },
    "body": "",
    "created_at": "2021-08-01T15:34:25Z",
    "updated_at": "2021-08-01T15:34:33Z",
    "closed_at": "2021-08-01T15:34:33Z",
    "merged_at": "2021-08-01T15:34:33Z",
    "merge_commit_sha": "b91a315e0f44b30898c0072021984fd9fd0479a5",
    "assignee": null,
    "assignees": [

    ],
    "requested_reviewers": [

    ],
    "requested_teams": [

    ],
    "labels": [

    ],
    "milestone": null,
    "draft": false,
    "commits_url": "https://api.github.com/repos/zl86790/tektongolang/pulls/1/commits",
    "review_comments_url": "https://api.github.com/repos/zl86790/tektongolang/pulls/1/comments",
    "review_comment_url": "https://api.github.com/repos/zl86790/tektongolang/pulls/comments{/number}",
    "comments_url": "https://api.github.com/repos/zl86790/tektongolang/issues/1/comments",
    "statuses_url": "https://api.github.com/repos/zl86790/tektongolang/statuses/7c0ede4fbdb7859c375f49002534b95af18dac18",
    "head": {
      "label": "zl86790:feature-1",
      "ref": "feature-1",
      "sha": "7c0ede4fbdb7859c375f49002534b95af18dac18",
      "user": {
        "login": "zl86790",
        "id": 18146284,
        "node_id": "MDQ6VXNlcjE4MTQ2Mjg0",
        "avatar_url": "https://avatars.githubusercontent.com/u/18146284?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/zl86790",
        "html_url": "https://github.com/zl86790",
        "followers_url": "https://api.github.com/users/zl86790/followers",
        "following_url": "https://api.github.com/users/zl86790/following{/other_user}",
        "gists_url": "https://api.github.com/users/zl86790/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/zl86790/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/zl86790/subscriptions",
        "organizations_url": "https://api.github.com/users/zl86790/orgs",
        "repos_url": "https://api.github.com/users/zl86790/repos",
        "events_url": "https://api.github.com/users/zl86790/events{/privacy}",
        "received_events_url": "https://api.github.com/users/zl86790/received_events",
        "type": "User",
        "site_admin": false
      },
      "repo": {
        "id": 390909760,
        "node_id": "MDEwOlJlcG9zaXRvcnkzOTA5MDk3NjA=",
        "name": "tektongolang",
        "full_name": "zl86790/tektongolang",
        "private": true,
        "owner": {
          "login": "zl86790",
          "id": 18146284,
          "node_id": "MDQ6VXNlcjE4MTQ2Mjg0",
          "avatar_url": "https://avatars.githubusercontent.com/u/18146284?v=4",
          "gravatar_id": "",
          "url": "https://api.github.com/users/zl86790",
          "html_url": "https://github.com/zl86790",
          "followers_url": "https://api.github.com/users/zl86790/followers",
          "following_url": "https://api.github.com/users/zl86790/following{/other_user}",
          "gists_url": "https://api.github.com/users/zl86790/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/zl86790/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/zl86790/subscriptions",
          "organizations_url": "https://api.github.com/users/zl86790/orgs",
          "repos_url": "https://api.github.com/users/zl86790/repos",
          "events_url": "https://api.github.com/users/zl86790/events{/privacy}",
          "received_events_url": "https://api.github.com/users/zl86790/received_events",
          "type": "User",
          "site_admin": false
        },
        "html_url": "https://github.com/zl86790/tektongolang",
        "description": null,
        "fork": false,
        "url": "https://api.github.com/repos/zl86790/tektongolang",
        "forks_url": "https://api.github.com/repos/zl86790/tektongolang/forks",
        "keys_url": "https://api.github.com/repos/zl86790/tektongolang/keys{/key_id}",
        "collaborators_url": "https://api.github.com/repos/zl86790/tektongolang/collaborators{/collaborator}",
        "teams_url": "https://api.github.com/repos/zl86790/tektongolang/teams",
        "hooks_url": "https://api.github.com/repos/zl86790/tektongolang/hooks",
        "issue_events_url": "https://api.github.com/repos/zl86790/tektongolang/issues/events{/number}",
        "events_url": "https://api.github.com/repos/zl86790/tektongolang/events",
        "assignees_url": "https://api.github.com/repos/zl86790/tektongolang/assignees{/user}",
        "branches_url": "https://api.github.com/repos/zl86790/tektongolang/branches{/branch}",
        "tags_url": "https://api.github.com/repos/zl86790/tektongolang/tags",
        "blobs_url": "https://api.github.com/repos/zl86790/tektongolang/git/blobs{/sha}",
        "git_tags_url": "https://api.github.com/repos/zl86790/tektongolang/git/tags{/sha}",
        "git_refs_url": "https://api.github.com/repos/zl86790/tektongolang/git/refs{/sha}",
        "trees_url": "https://api.github.com/repos/zl86790/tektongolang/git/trees{/sha}",
        "statuses_url": "https://api.github.com/repos/zl86790/tektongolang/statuses/{sha}",
        "languages_url": "https://api.github.com/repos/zl86790/tektongolang/languages",
        "stargazers_url": "https://api.github.com/repos/zl86790/tektongolang/stargazers",
        "contributors_url": "https://api.github.com/repos/zl86790/tektongolang/contributors",
        "subscribers_url": "https://api.github.com/repos/zl86790/tektongolang/subscribers",
        "subscription_url": "https://api.github.com/repos/zl86790/tektongolang/subscription",
        "commits_url": "https://api.github.com/repos/zl86790/tektongolang/commits{/sha}",
        "git_commits_url": "https://api.github.com/repos/zl86790/tektongolang/git/commits{/sha}",
        "comments_url": "https://api.github.com/repos/zl86790/tektongolang/comments{/number}",
        "issue_comment_url": "https://api.github.com/repos/zl86790/tektongolang/issues/comments{/number}",
        "contents_url": "https://api.github.com/repos/zl86790/tektongolang/contents/{+path}",
        "compare_url": "https://api.github.com/repos/zl86790/tektongolang/compare/{base}...{head}",
        "merges_url": "https://api.github.com/repos/zl86790/tektongolang/merges",
        "archive_url": "https://api.github.com/repos/zl86790/tektongolang/{archive_format}{/ref}",
        "downloads_url": "https://api.github.com/repos/zl86790/tektongolang/downloads",
        "issues_url": "https://api.github.com/repos/zl86790/tektongolang/issues{/number}",
        "pulls_url": "https://api.github.com/repos/zl86790/tektongolang/pulls{/number}",
        "milestones_url": "https://api.github.com/repos/zl86790/tektongolang/milestones{/number}",
        "notifications_url": "https://api.github.com/repos/zl86790/tektongolang/notifications{?since,all,participating}",
        "labels_url": "https://api.github.com/repos/zl86790/tektongolang/labels{/name}",
        "releases_url": "https://api.github.com/repos/zl86790/tektongolang/releases{/id}",
        "deployments_url": "https://api.github.com/repos/zl86790/tektongolang/deployments",
        "created_at": "2021-07-30T02:53:21Z",
        "updated_at": "2021-08-01T07:00:27Z",
        "pushed_at": "2021-08-01T15:34:33Z",
        "git_url": "git://github.com/zl86790/tektongolang.git",
        "ssh_url": "git@github.com:zl86790/tektongolang.git",
        "clone_url": "https://github.com/zl86790/tektongolang.git",
        "svn_url": "https://github.com/zl86790/tektongolang",
        "homepage": null,
        "size": 1,
        "stargazers_count": 0,
        "watchers_count": 0,
        "language": "Go",
        "has_issues": true,
        "has_projects": true,
        "has_downloads": true,
        "has_wiki": true,
        "has_pages": false,
        "forks_count": 0,
        "mirror_url": null,
        "archived": false,
        "disabled": false,
        "open_issues_count": 0,
        "license": null,
        "forks": 0,
        "open_issues": 0,
        "watchers": 0,
        "default_branch": "master",
        "allow_squash_merge": true,
        "allow_merge_commit": true,
        "allow_rebase_merge": true,
        "delete_branch_on_merge": false
      }
    },
    "base": {
      "label": "zl86790:master",
      "ref": "master",
      "sha": "9b95a9b2f4cd791717af1f19a4c3bf9825c2a601",
      "user": {
        "login": "zl86790",
        "id": 18146284,
        "node_id": "MDQ6VXNlcjE4MTQ2Mjg0",
        "avatar_url": "https://avatars.githubusercontent.com/u/18146284?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/zl86790",
        "html_url": "https://github.com/zl86790",
        "followers_url": "https://api.github.com/users/zl86790/followers",
        "following_url": "https://api.github.com/users/zl86790/following{/other_user}",
        "gists_url": "https://api.github.com/users/zl86790/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/zl86790/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/zl86790/subscriptions",
        "organizations_url": "https://api.github.com/users/zl86790/orgs",
        "repos_url": "https://api.github.com/users/zl86790/repos",
        "events_url": "https://api.github.com/users/zl86790/events{/privacy}",
        "received_events_url": "https://api.github.com/users/zl86790/received_events",
        "type": "User",
        "site_admin": false
      },
      "repo": {
        "id": 390909760,
        "node_id": "MDEwOlJlcG9zaXRvcnkzOTA5MDk3NjA=",
        "name": "tektongolang",
        "full_name": "zl86790/tektongolang",
        "private": true,
        "owner": {
          "login": "zl86790",
          "id": 18146284,
          "node_id": "MDQ6VXNlcjE4MTQ2Mjg0",
          "avatar_url": "https://avatars.githubusercontent.com/u/18146284?v=4",
          "gravatar_id": "",
          "url": "https://api.github.com/users/zl86790",
          "html_url": "https://github.com/zl86790",
          "followers_url": "https://api.github.com/users/zl86790/followers",
          "following_url": "https://api.github.com/users/zl86790/following{/other_user}",
          "gists_url": "https://api.github.com/users/zl86790/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/zl86790/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/zl86790/subscriptions",
          "organizations_url": "https://api.github.com/users/zl86790/orgs",
          "repos_url": "https://api.github.com/users/zl86790/repos",
          "events_url": "https://api.github.com/users/zl86790/events{/privacy}",
          "received_events_url": "https://api.github.com/users/zl86790/received_events",
          "type": "User",
          "site_admin": false
        },
        "html_url": "https://github.com/zl86790/tektongolang",
        "description": null,
        "fork": false,
        "url": "https://api.github.com/repos/zl86790/tektongolang",
        "forks_url": "https://api.github.com/repos/zl86790/tektongolang/forks",
        "keys_url": "https://api.github.com/repos/zl86790/tektongolang/keys{/key_id}",
        "collaborators_url": "https://api.github.com/repos/zl86790/tektongolang/collaborators{/collaborator}",
        "teams_url": "https://api.github.com/repos/zl86790/tektongolang/teams",
        "hooks_url": "https://api.github.com/repos/zl86790/tektongolang/hooks",
        "issue_events_url": "https://api.github.com/repos/zl86790/tektongolang/issues/events{/number}",
        "events_url": "https://api.github.com/repos/zl86790/tektongolang/events",
        "assignees_url": "https://api.github.com/repos/zl86790/tektongolang/assignees{/user}",
        "branches_url": "https://api.github.com/repos/zl86790/tektongolang/branches{/branch}",
        "tags_url": "https://api.github.com/repos/zl86790/tektongolang/tags",
        "blobs_url": "https://api.github.com/repos/zl86790/tektongolang/git/blobs{/sha}",
        "git_tags_url": "https://api.github.com/repos/zl86790/tektongolang/git/tags{/sha}",
        "git_refs_url": "https://api.github.com/repos/zl86790/tektongolang/git/refs{/sha}",
        "trees_url": "https://api.github.com/repos/zl86790/tektongolang/git/trees{/sha}",
        "statuses_url": "https://api.github.com/repos/zl86790/tektongolang/statuses/{sha}",
        "languages_url": "https://api.github.com/repos/zl86790/tektongolang/languages",
        "stargazers_url": "https://api.github.com/repos/zl86790/tektongolang/stargazers",
        "contributors_url": "https://api.github.com/repos/zl86790/tektongolang/contributors",
        "subscribers_url": "https://api.github.com/repos/zl86790/tektongolang/subscribers",
        "subscription_url": "https://api.github.com/repos/zl86790/tektongolang/subscription",
        "commits_url": "https://api.github.com/repos/zl86790/tektongolang/commits{/sha}",
        "git_commits_url": "https://api.github.com/repos/zl86790/tektongolang/git/commits{/sha}",
        "comments_url": "https://api.github.com/repos/zl86790/tektongolang/comments{/number}",
        "issue_comment_url": "https://api.github.com/repos/zl86790/tektongolang/issues/comments{/number}",
        "contents_url": "https://api.github.com/repos/zl86790/tektongolang/contents/{+path}",
        "compare_url": "https://api.github.com/repos/zl86790/tektongolang/compare/{base}...{head}",
        "merges_url": "https://api.github.com/repos/zl86790/tektongolang/merges",
        "archive_url": "https://api.github.com/repos/zl86790/tektongolang/{archive_format}{/ref}",
        "downloads_url": "https://api.github.com/repos/zl86790/tektongolang/downloads",
        "issues_url": "https://api.github.com/repos/zl86790/tektongolang/issues{/number}",
        "pulls_url": "https://api.github.com/repos/zl86790/tektongolang/pulls{/number}",
        "milestones_url": "https://api.github.com/repos/zl86790/tektongolang/milestones{/number}",
        "notifications_url": "https://api.github.com/repos/zl86790/tektongolang/notifications{?since,all,participating}",
        "labels_url": "https://api.github.com/repos/zl86790/tektongolang/labels{/name}",
        "releases_url": "https://api.github.com/repos/zl86790/tektongolang/releases{/id}",
        "deployments_url": "https://api.github.com/repos/zl86790/tektongolang/deployments",
        "created_at": "2021-07-30T02:53:21Z",
        "updated_at": "2021-08-01T07:00:27Z",
        "pushed_at": "2021-08-01T15:34:33Z",
        "git_url": "git://github.com/zl86790/tektongolang.git",
        "ssh_url": "git@github.com:zl86790/tektongolang.git",
        "clone_url": "https://github.com/zl86790/tektongolang.git",
        "svn_url": "https://github.com/zl86790/tektongolang",
        "homepage": null,
        "size": 1,
        "stargazers_count": 0,
        "watchers_count": 0,
        "language": "Go",
        "has_issues": true,
        "has_projects": true,
        "has_downloads": true,
        "has_wiki": true,
        "has_pages": false,
        "forks_count": 0,
        "mirror_url": null,
        "archived": false,
        "disabled": false,
        "open_issues_count": 0,
        "license": null,
        "forks": 0,
        "open_issues": 0,
        "watchers": 0,
        "default_branch": "master",
        "allow_squash_merge": true,
        "allow_merge_commit": true,
        "allow_rebase_merge": true,
        "delete_branch_on_merge": false
      }
    },
    "_links": {
      "self": {
        "href": "https://api.github.com/repos/zl86790/tektongolang/pulls/1"
      },
      "html": {
        "href": "https://github.com/zl86790/tektongolang/pull/1"
      },
      "issue": {
        "href": "https://api.github.com/repos/zl86790/tektongolang/issues/1"
      },
      "comments": {
        "href": "https://api.github.com/repos/zl86790/tektongolang/issues/1/comments"
      },
      "review_comments": {
        "href": "https://api.github.com/repos/zl86790/tektongolang/pulls/1/comments"
      },
      "review_comment": {
        "href": "https://api.github.com/repos/zl86790/tektongolang/pulls/comments{/number}"
      },
      "commits": {
        "href": "https://api.github.com/repos/zl86790/tektongolang/pulls/1/commits"
      },
      "statuses": {
        "href": "https://api.github.com/repos/zl86790/tektongolang/statuses/7c0ede4fbdb7859c375f49002534b95af18dac18"
      }
    },
    "author_association": "OWNER",
    "auto_merge": null,
    "active_lock_reason": null,
    "merged": true,
    "mergeable": null,
    "rebaseable": null,
    "mergeable_state": "unknown",
    "merged_by": {
      "login": "zl86790",
      "id": 18146284,
      "node_id": "MDQ6VXNlcjE4MTQ2Mjg0",
      "avatar_url": "https://avatars.githubusercontent.com/u/18146284?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/zl86790",
      "html_url": "https://github.com/zl86790",
      "followers_url": "https://api.github.com/users/zl86790/followers",
      "following_url": "https://api.github.com/users/zl86790/following{/other_user}",
      "gists_url": "https://api.github.com/users/zl86790/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/zl86790/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/zl86790/subscriptions",
      "organizations_url": "https://api.github.com/users/zl86790/orgs",
      "repos_url": "https://api.github.com/users/zl86790/repos",
      "events_url": "https://api.github.com/users/zl86790/events{/privacy}",
      "received_events_url": "https://api.github.com/users/zl86790/received_events",
      "type": "User",
      "site_admin": false
    },
    "comments": 0,
    "review_comments": 0,
    "maintainer_can_modify": false,
    "commits": 1,
    "additions": 1,
    "deletions": 1,
    "changed_files": 1
  },
  "repository": {
    "id": 390909760,
    "node_id": "MDEwOlJlcG9zaXRvcnkzOTA5MDk3NjA=",
    "name": "tektongolang",
    "full_name": "zl86790/tektongolang",
    "private": true,
    "owner": {
      "login": "zl86790",
      "id": 18146284,
      "node_id": "MDQ6VXNlcjE4MTQ2Mjg0",
      "avatar_url": "https://avatars.githubusercontent.com/u/18146284?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/zl86790",
      "html_url": "https://github.com/zl86790",
      "followers_url": "https://api.github.com/users/zl86790/followers",
      "following_url": "https://api.github.com/users/zl86790/following{/other_user}",
      "gists_url": "https://api.github.com/users/zl86790/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/zl86790/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/zl86790/subscriptions",
      "organizations_url": "https://api.github.com/users/zl86790/orgs",
      "repos_url": "https://api.github.com/users/zl86790/repos",
      "events_url": "https://api.github.com/users/zl86790/events{/privacy}",
      "received_events_url": "https://api.github.com/users/zl86790/received_events",
      "type": "User",
      "site_admin": false
    },
    "html_url": "https://github.com/zl86790/tektongolang",
    "description": null,
    "fork": false,
    "url": "https://api.github.com/repos/zl86790/tektongolang",
    "forks_url": "https://api.github.com/repos/zl86790/tektongolang/forks",
    "keys_url": "https://api.github.com/repos/zl86790/tektongolang/keys{/key_id}",
    "collaborators_url": "https://api.github.com/repos/zl86790/tektongolang/collaborators{/collaborator}",
    "teams_url": "https://api.github.com/repos/zl86790/tektongolang/teams",
    "hooks_url": "https://api.github.com/repos/zl86790/tektongolang/hooks",
    "issue_events_url": "https://api.github.com/repos/zl86790/tektongolang/issues/events{/number}",
    "events_url": "https://api.github.com/repos/zl86790/tektongolang/events",
    "assignees_url": "https://api.github.com/repos/zl86790/tektongolang/assignees{/user}",
    "branches_url": "https://api.github.com/repos/zl86790/tektongolang/branches{/branch}",
    "tags_url": "https://api.github.com/repos/zl86790/tektongolang/tags",
    "blobs_url": "https://api.github.com/repos/zl86790/tektongolang/git/blobs{/sha}",
    "git_tags_url": "https://api.github.com/repos/zl86790/tektongolang/git/tags{/sha}",
    "git_refs_url": "https://api.github.com/repos/zl86790/tektongolang/git/refs{/sha}",
    "trees_url": "https://api.github.com/repos/zl86790/tektongolang/git/trees{/sha}",
    "statuses_url": "https://api.github.com/repos/zl86790/tektongolang/statuses/{sha}",
    "languages_url": "https://api.github.com/repos/zl86790/tektongolang/languages",
    "stargazers_url": "https://api.github.com/repos/zl86790/tektongolang/stargazers",
    "contributors_url": "https://api.github.com/repos/zl86790/tektongolang/contributors",
    "subscribers_url": "https://api.github.com/repos/zl86790/tektongolang/subscribers",
    "subscription_url": "https://api.github.com/repos/zl86790/tektongolang/subscription",
    "commits_url": "https://api.github.com/repos/zl86790/tektongolang/commits{/sha}",
    "git_commits_url": "https://api.github.com/repos/zl86790/tektongolang/git/commits{/sha}",
    "comments_url": "https://api.github.com/repos/zl86790/tektongolang/comments{/number}",
    "issue_comment_url": "https://api.github.com/repos/zl86790/tektongolang/issues/comments{/number}",
    "contents_url": "https://api.github.com/repos/zl86790/tektongolang/contents/{+path}",
    "compare_url": "https://api.github.com/repos/zl86790/tektongolang/compare/{base}...{head}",
    "merges_url": "https://api.github.com/repos/zl86790/tektongolang/merges",
    "archive_url": "https://api.github.com/repos/zl86790/tektongolang/{archive_format}{/ref}",
    "downloads_url": "https://api.github.com/repos/zl86790/tektongolang/downloads",
    "issues_url": "https://api.github.com/repos/zl86790/tektongolang/issues{/number}",
    "pulls_url": "https://api.github.com/repos/zl86790/tektongolang/pulls{/number}",
    "milestones_url": "https://api.github.com/repos/zl86790/tektongolang/milestones{/number}",
    "notifications_url": "https://api.github.com/repos/zl86790/tektongolang/notifications{?since,all,participating}",
    "labels_url": "https://api.github.com/repos/zl86790/tektongolang/labels{/name}",
    "releases_url": "https://api.github.com/repos/zl86790/tektongolang/releases{/id}",
    "deployments_url": "https://api.github.com/repos/zl86790/tektongolang/deployments",
    "created_at": "2021-07-30T02:53:21Z",
    "updated_at": "2021-08-01T07:00:27Z",
    "pushed_at": "2021-08-01T15:34:33Z",
    "git_url": "git://github.com/zl86790/tektongolang.git",
    "ssh_url": "git@github.com:zl86790/tektongolang.git",
    "clone_url": "https://github.com/zl86790/tektongolang.git",
    "svn_url": "https://github.com/zl86790/tektongolang",
    "homepage": null,
    "size": 1,
    "stargazers_count": 0,
    "watchers_count": 0,
    "language": "Go",
    "has_issues": true,
    "has_projects": true,
    "has_downloads": true,
    "has_wiki": true,
    "has_pages": false,
    "forks_count": 0,
    "mirror_url": null,
    "archived": false,
    "disabled": false,
    "open_issues_count": 0,
    "license": null,
    "forks": 0,
    "open_issues": 0,
    "watchers": 0,
    "default_branch": "master"
  },
  "sender": {
    "login": "zl86790",
    "id": 18146284,
    "node_id": "MDQ6VXNlcjE4MTQ2Mjg0",
    "avatar_url": "https://avatars.githubusercontent.com/u/18146284?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/zl86790",
    "html_url": "https://github.com/zl86790",
    "followers_url": "https://api.github.com/users/zl86790/followers",
    "following_url": "https://api.github.com/users/zl86790/following{/other_user}",
    "gists_url": "https://api.github.com/users/zl86790/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/zl86790/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/zl86790/subscriptions",
    "organizations_url": "https://api.github.com/users/zl86790/orgs",
    "repos_url": "https://api.github.com/users/zl86790/repos",
    "events_url": "https://api.github.com/users/zl86790/events{/privacy}",
    "received_events_url": "https://api.github.com/users/zl86790/received_events",
    "type": "User",
    "site_admin": false
  }
}

通过端口映射就可以使用 postman 来 dummy webhook了

访问dashboard

kubectl --namespace tekton-pipelines port-forward svc/tekton-dashboard 9097:9097

访问trigger

kubectl port-forward --address 0.0.0.0 service/el-github-pr 8080 -n lizhe

最后是截屏

Send a Message