【发布时间】:2012-12-14 21:39:39
【问题描述】:
背景:
我有 open-sourced a repository,这是由 Travis-CI 测试的。 Travis 为测试运行提供了build-notification 挂钩,因此您可以在 IRC、Flowdock、Campfire 和 HipChat 中获得通知。要配置这些挂钩,您必须将设置添加到您的 .travis.yml 配置文件中,该文件是公开的。对于 Hipchat,它看起来像这样:
notifications:
hipchat: [api token]@[room name]
如果我只是将我的令牌以纯文本形式放在那里,每个人都可以看到我的 API 令牌并访问/发送垃圾邮件我的聊天室。这也是 Travis 添加secure environemt variables 的原因。基本上,您可以使用您的密钥加密字符串并将它们专门绑定到存储库,以便 Travis 可以访问秘密 API 密钥。
你在本地做什么:
gem install travis
travis encrypt github-user/repo MY_SECRET_ENV=super_secret
您在.travis.yml 中输入的内容
secure: <encrypted string here>
问题:
不幸的是,文档并不过分冗长,谷歌没有帮助,stackoverflow 没有帮助还,我无法让它工作。
travis encrypt github-user/repo HIPCHAT=super_secret
secure: <encrypted string here>
notifications:
hipchat: <%= ENV['HIPCHAT'] %>@hipchat-room
由于这不起作用,我去了 freenode 上的 travis irc 和 that's what they suggested
travis encrypt github-user/repo key@hipchat-room
notifications:
hipchat:
secure: <encrypted string here>
正如您可能已经猜到的那样(我为什么要再次写这个问题?)这也不起作用。 我希望你能帮我解决这个问题。非常感谢
编辑:我很怀疑自己。我对 API 密钥进行了三次检查,它正在工作。这取决于特拉维斯。
2Edit:因为这似乎是一个错误,所以这里是对应的GitHub issue
【问题讨论】:
标签: encryption continuous-integration environment-variables yaml travis-ci