woodpecker-ci / woodpecker

Woodpecker is a simple, yet powerful CI/CD engine with great extensibility.
https://woodpecker-ci.org
Apache License 2.0
4.16k stars 360 forks source link

Sometimes settings not passed to plugin #1678

Open wenerme opened 1 year ago

wenerme commented 1 year ago

Component

server, agent

Describe the bug

Pipeline like

variables:
- &node_image 'wener/node:docker'
- &notify_image 'wener/woodpecker-feishu-bot'

pipeline:
  Notify Start:
    image: *notify_image
    settings:
      feishu_bot_url:
        from_secret: feishu_bot_url
      feishu_bot_secret:
        from_secret: feishu_bot_secret
      text: |
        Hello
      markdown: |
        🏗️ 开始构建 <%= env.CI_REPO_NAME %> #<%= env.CI_BUILD_NUMBER %>

        - <%= $.link(env.CI_COMMIT,env.CI_COMMIT_LINK) %> <%=env.CI_COMMIT_MESSAGE.replaceAll(/\n/g,';')%>

        📦️ <%=$.link(env.CI_REPO_NAME,env.CI_BUILD_LINK)%>

  Notify Done:
    image: *notify_image
    settings:
      feishu_bot_url:
        from_secret: feishu_bot_url
      feishu_bot_secret:
        from_secret: feishu_bot_secret
      markdown: |
        <%= env.CI_PIPELINE_STATUS === 'success' ? '✅' : '❌' %> 构建完成 <%= env.CI_REPO_NAME %> #<%= env.CI_BUILD_NUMBER %>

        - <%= env.CI_COMMIT_MESSAGE %>

        📦️ <%= $.link(env.CI_REPO_NAME, env.CI_BUILD_LINK) %> · ⏳<%= env.CI_PIPELINE_FINISHED - env.CI_PIPELINE_STARTED %>
    when:
      status: [ success, failure ]

But

image

sometimes missing part of settings(url exists)

image

sometime missing all

image

multi pipeline, some is ok, some is not

image

If I use detach, no one will get the env

image

Noting changed, just restart will get different result

System Info

- 0.15.7
- k8s manifest https://github.com/wenerme/kube-stub-cluster/tree/main/dev-system/services/woodpecker

Additional context

next version has the problem too, my workaround

  Notify Done:
    image: *notify_image
    failure: ignore
    settings:
      feishu_bot_url:
        from_secret: feishu_bot_url
    environment:
      PLUGIN_MARKDOWN: |
        <%= env.CI_PIPELINE_STATUS === 'success' ? '✅' : '❌' %> 构建完成 <%= env.CI_REPO_NAME %> #<%= env.CI_BUILD_NUMBER %>

        - <%= $.link(env.CI_COMMIT_SHA.slice(0,6),env.CI_COMMIT_LINK) %> <%=env.CI_COMMIT_MESSAGE.replaceAll(/\n/g,';')%>

        📦️ <%= $.link(env.CI_REPO_NAME, env.CI_BUILD_LINK) %> · ⏳<%= env.CI_PIPELINE_FINISHED - env.CI_PIPELINE_STARTED %>
    when:
      status: [ success, failure ]

Validations

ajoneil commented 1 year ago

I'm also running into issues with plugin settings not being passed through intermittently, see: https://codeberg.org/woodpecker-plugins/docker-buildx/issues/56

smainz commented 1 year ago

I observed the same problem with

Mayby notable: I saw this behaviour with PRs (gitea) only.

Workaround is to specify the parameters as environment variables.