Help us understand the problem. What is going on with this article?

Travis CIでsecret valueを扱う

More than 5 years have passed since last update.

Secure-environment-variablesのとおり。
やってみる。

準備

Travis Clientをインストールする。

$ gem install travis

Encrypt

公開鍵を使って暗号化するようです。ソース

$ cd my_project
$ travis encrypt MY_SECRET=super_secret
Please add the following to your .travis.yml file:

  secure: "Vl4wZ31VKVsF+w2Vowv1l/hC6p1a7BR8mwonSswcvpdbmz289dFE7oUW7gw3nwzE1lRe71Soh90YqMnGmMY6UASRWHMkDLbf4BACkt4jJKSfQyWRf+J1YmHS8l1lrhk6V+RUsQjNdGbOkuZ5PQVzpwsPzHut4UgrxuLfpW9SkIg="

Pro Tip: You can add it automatically by running with --add.

--add env.globalのようにaddオプションを使うと.travis.ymlに自動で更新してくれますが、インデント崩れたりする。

試してみる

https://github.com/arukoh/sandbox/commit/a9628184edc3bff153d465354fdacbf3c2d5adeb

.travis.yml
env:
  global:
    - secure: "Vl4wZ31VKVsF+w2Vowv1l/hC6p1a7BR8mwonSswcvpdbmz289dFE7oUW7gw3nwzE1lRe71Soh90YqMnGmMY6UASRWHMkDLbf4BACkt4jJKSfQyWRf+J1YmHS8l1lrhk6V+RUsQjNdGbOkuZ5PQVzpwsPzHut4UgrxuLfpW9SkIg="
test/env_test.rb
def test_secret
  assert_equal "super_secret", ENV['MY_SECRET']
end

result

https://travis-ci.org/arukoh/sandbox/jobs/10072765

jrits
信頼と魅力のある先進のITをもとに、お客様のワークスタイル・イノベーションの実現を目指します。
http://www.jrits.co.jp/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした