使用 drone-email 插件时,Drone CI 看不到秘密变量

Drone CI does not see secret variables when using drone-email plugin

我正在使用 drone-ci (0.8.0-rc.5) as CI tool and drone-email 插件发送电子邮件。如果构建成功或失败,我想发送通知。我使用 Gmail SMTP 服务器发送电子邮件。

我的 .drone.yml 文件:

notify:
  image: drillster/drone-email
  host: ${EMAIL_HOST}
  port: ${EMAIL_PORT}
  username: ${EMAIL_USERNAME}
  password: ${EMAIL_PASSWORD}
  from: test@test.com
  recipients: [ user@test.com ]

密文配置如下图所示: 构建完成后,我收到以下异常:

time="2017-09-20T02:14:10Z" level=error msg="Error while dialing SMTP server: dial tcp :587: getsockopt: connection refused" dial tcp :587: getsockopt: connection refused

当我在 yml 文件中硬编码值时,通知有效。所以我想知道我在 secrets 上做错了什么或者如何解决这个问题?

您正在使用的语法 ${secret} 在 drone 0.6 中已弃用并替换为以下语法:

pipeline:
  notify:
    image: drillster/drone-email
    from: test@test.com
    recipients: [ user@test.com ]
    secrets: [EMAIL_HOST, EMAIL_PORT, EMAIL_USERNAME, EMAIL_PASSWORD]

以上语法指示无人机向插件提供请求的秘密。这些机密作为环境变量暴露在容器中并由插件使用。

进一步阅读