加密令牌时如何覆盖 Travis-CI 通知中的 Slack 通道?
How to override Slack channels in Travis-CI notification when encrypting the token?
Slack 上 Travis-CI 通知的在线文档说:
Overriding the channel is also possible, just add it to the configuration with a # separating them from account and token.
notifications:
slack: '<account>:<token>#development'
但是,如果我想按照建议的方式加密凭据:
travis encrypt "<account>:<token>" --add notifications.slack
会很好用。但是当我尝试时:
travis encrypt "<account>:<token>#development" --add notifications.slack
我得到了一个新的加密令牌,但通知来自集成时设置的默认通道。我做错了什么?
注意:我们使用企业版的一切(Slack、Travis、GitHub),以防这可能起作用。
加密命令正确:
travis encrypt "account:token#channel" --add notifications.slack
但是 .travis.yml 中的结果将是(错误的,这就是问题所在):
notifications:
slack:
secure: xxxxxxxxxxxxxxxxxxxxxx
you have to edit the .travis.yml manually after the encrypt command and add rooms, so correct is:
notifications:
slack:
rooms:
secure: xxxxxxxxxxxxxx
命令 不 正确,它缺少末尾的 .rooms
属性。应该是
travis encrypt "account:token#channel" --add notifications.slack.rooms
对于要包含在通知中的每个松弛通道,您需要 运行 以下加密命令。 确保您保留每条安全加密消息的副本,因为该命令会在每次 运行 时覆盖您的 travis.yml
。
travis encrypt "account:token#channel1" --add notifications.slack.rooms
travis encrypt "account:token#channel2" --add notifications.slack.rooms
最后按以下格式为每个频道添加令牌:
notifications:
slack:
rooms:
- secure: secure_token_for_channel1
- secure: secure_token_for_channel2
Slack 上 Travis-CI 通知的在线文档说:
Overriding the channel is also possible, just add it to the configuration with a # separating them from account and token.
notifications:
slack: '<account>:<token>#development'
但是,如果我想按照建议的方式加密凭据:
travis encrypt "<account>:<token>" --add notifications.slack
会很好用。但是当我尝试时:
travis encrypt "<account>:<token>#development" --add notifications.slack
我得到了一个新的加密令牌,但通知来自集成时设置的默认通道。我做错了什么?
注意:我们使用企业版的一切(Slack、Travis、GitHub),以防这可能起作用。
加密命令正确:
travis encrypt "account:token#channel" --add notifications.slack
但是 .travis.yml 中的结果将是(错误的,这就是问题所在):
notifications:
slack:
secure: xxxxxxxxxxxxxxxxxxxxxx
you have to edit the .travis.yml manually after the encrypt command and add rooms, so correct is:
notifications:
slack:
rooms:
secure: xxxxxxxxxxxxxx
命令 不 正确,它缺少末尾的 .rooms
属性。应该是
travis encrypt "account:token#channel" --add notifications.slack.rooms
对于要包含在通知中的每个松弛通道,您需要 运行 以下加密命令。 确保您保留每条安全加密消息的副本,因为该命令会在每次 运行 时覆盖您的 travis.yml
。
travis encrypt "account:token#channel1" --add notifications.slack.rooms
travis encrypt "account:token#channel2" --add notifications.slack.rooms
最后按以下格式为每个频道添加令牌:
notifications:
slack:
rooms:
- secure: secure_token_for_channel1
- secure: secure_token_for_channel2