Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: git事件触发插件支持第三方服务changeFiles值总是为null #10255

Open
mingshewhe opened this issue Apr 24, 2024 · 0 comments
Open
Assignees
Labels
area/ci/backend CI 后端issue for gray UAT environment in tencent has been deploy grayed uat环境测试通过/test passed for uat stage kind/bug 程序故障Bug,漏洞 todo todo

Comments

@mingshewhe
Copy link
Collaborator

mingshewhe commented Apr 24, 2024

关联需求: #7743

问题

发送的body中changeFiles的值总是为空

原因

image
第2步赋的值,在第三步并没有生效。

模拟代码:

@Test
  fun filter() {
      var pushChangeFiles: Set<String>? = null
      val pathFilter = object: WebhookFilter {
          override fun doFilter() {
              pushChangeFiles = setOf("1", "2")
              println(pushChangeFiles)
          }
      }
      val thirdFilter = ThirdFilter(changeFiles = pushChangeFiles)
      listOf(pathFilter, thirdFilter).forEach { filter ->
          filter.doFilter()
      }
  }

输出:

[1, 2]
null

对代码进行反编译
image

解决方案

changeFile不在匿名类中计算

val isGetChangeFiles = !excludePaths.isNullOrBlank() || !includePaths.isNullOrBlank() || 
                    enableThirdFilter == true
  val pushChangeFiles = if (isGetChangeFiles) {
      getPushChangeFiles(event)
  } else {
      null
  }
@mingshewhe mingshewhe added the kind/bug 程序故障Bug,漏洞 label Apr 24, 2024
@mingshewhe mingshewhe added the area/ci/backend CI 后端issue label Apr 24, 2024
@bkci-bot bkci-bot added the todo todo label Apr 24, 2024
@bkci-bot bkci-bot added for test Test environment in tencent has been deploy todo todo and removed todo todo labels May 11, 2024
@hejieehe hejieehe added the tested 测试环境通过/test patest passed for test stage label May 15, 2024
@bkci-bot bkci-bot added for gray UAT environment in tencent has been deploy and removed for test Test environment in tencent has been deploy tested 测试环境通过/test patest passed for test stage labels May 23, 2024
@hejieehe hejieehe added the grayed uat环境测试通过/test passed for uat stage label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci/backend CI 后端issue for gray UAT environment in tencent has been deploy grayed uat环境测试通过/test passed for uat stage kind/bug 程序故障Bug,漏洞 todo todo
Projects
None yet
Development

No branches or pull requests

3 participants