流水线是跑在member集群上,界面给出的链接是host集群的:

原本想通过上图所示链接触发流水线,但报错:

但是,我换成member集群的域名就能成功触发,这是bug 吗?还是设计如此?

  • 你上面的第一个图,访问的时候是host
    host集群吗?

    这个看起来是个缺陷,没有考虑到多集群的情况。我找到了对应的代码:

    `  get webhookUrl() {
        const { formTemplate } = this.props
        const url = get(formTemplate, `${this.scmPrefix}.url`, '')
        const api_uri = get(formTemplate, `${this.scmPrefix}.api_uri`, '')
        const owner = get(formTemplate, `${this.scmPrefix}.owner`, '')
        const repo = get(formTemplate, `${this.scmPrefix}.repo`, '')
        const bitbucket_url = `${api_uri}/scm/${owner}/${repo}.git`
    
        switch (this.sourceType) {
          case 'bitbucket_server':
            return `${window.location.protocol}//${window.location.host}/devops_webhook/git/?url=${bitbucket_url}`
          case 'github':
            return `${window.location.protocol}//${window.location.host}/devops_webhook/${this.sourceType}/`
          default:
            return `${window.location.protocol}//${window.location.host}/devops_webhook/git/?url=${url}`
        }
      }

    https://github.com/kubesphere/console/blob/a19ecdfe08ed4cf40d8869df1702590b525c4ec9/src/components/Forms/Pipelines/AdvanceSettings/index.jsx#L84

你上面的第一个图,访问的时候是host
host集群吗?

这个看起来是个缺陷,没有考虑到多集群的情况。我找到了对应的代码:

`  get webhookUrl() {
    const { formTemplate } = this.props
    const url = get(formTemplate, `${this.scmPrefix}.url`, '')
    const api_uri = get(formTemplate, `${this.scmPrefix}.api_uri`, '')
    const owner = get(formTemplate, `${this.scmPrefix}.owner`, '')
    const repo = get(formTemplate, `${this.scmPrefix}.repo`, '')
    const bitbucket_url = `${api_uri}/scm/${owner}/${repo}.git`

    switch (this.sourceType) {
      case 'bitbucket_server':
        return `${window.location.protocol}//${window.location.host}/devops_webhook/git/?url=${bitbucket_url}`
      case 'github':
        return `${window.location.protocol}//${window.location.host}/devops_webhook/${this.sourceType}/`
      default:
        return `${window.location.protocol}//${window.location.host}/devops_webhook/git/?url=${url}`
    }
  }

https://github.com/kubesphere/console/blob/a19ecdfe08ed4cf40d8869df1702590b525c4ec9/src/components/Forms/Pipelines/AdvanceSettings/index.jsx#L84

  • wjw 回复了此帖

    Rick 看起来是这个问题,这个是不是要等到下个版本修复了?

    我的理解是,上面的那个链接只是一个提示,还是需要在代码仓库中配置webhook地址的。如果是这样的话,那么这个问题不大了。就只是让人容易产生误解。

    为了方便大家对这个问题的修复进度的跟踪,我创建了一个issues。大家可以订阅(subscribe)这个issues。

    另外,如果你认为我的回答已经解决了你的疑惑(没有解决问题)的话,可以把当前帖子标记为已结束。

    • wjw 回复了此帖
      wjw 更改标题为「多集群下,webhook 链接无法触发jenkins流水线

      Rick 😅 我加不了标记,还是你来吧。

      • Rick 回复了此帖
        2 个月 后
        2 年 后
        20 天 后

        3.2.1的webhook地址有点儿问题。应该是 member集群主节点的地址;非kubesphere所在服务器的地址。-这个问题纠结了我好几天