在 travis 中处理加密数据
Working with encrypted data in travis
我已经创建了一个网络服务,并且正在处理我想要加密的敏感数据(一个 yandel 密钥)。我在路径 src/main/resources/application.properties
中有此数据,内容为 yandex.api_key=valueOfMyKey
.
我执行命令 travis encrypt-file application.properties
并获得编码的文件 application.properties.enc
。此外,我得到了这个输出,我明白了它的意思(我将构建脚本添加到我的.travis.yml
)
storing secure env variables for decryption
Please add the following to your build script (before_install stage in your .travis.yml, for instance):
openssl aes-256-cbc -K $encrypted_b21eaa919621_key -iv $encrypted_b21eaa919621_iv -in application.properties.enc -out application.properties -d
Pro Tip: You can add it automatically by running with --add.
Make sure to add application.properties.enc to the git repository.
Make sure not to add application.properties to the git repository.
Commit all changes to your .travis.yml.
我执行了命令travis lint .travis.yml
,我得到了一个有效的输出。我的 travis 文件现在有这个内容:
language: java
jdk:
- oraclejdk8
before_install:
- openssl aes-256-cbc -K $encrypted_b21eaa919621_key -iv $encrypted_b21eaa919621_iv
-in src/main/resources/application.properties.enc -out src/main/resources/application.properties -d
但是,我没有通过 travis 测试。我得到以下输出:
你可以在this public repo中查看我的代码。
我解决了。我在加密我的文件之前没有激活 travis,所以 travis 没有这两个值。我刚刚激活它并再次加密。
我已经创建了一个网络服务,并且正在处理我想要加密的敏感数据(一个 yandel 密钥)。我在路径 src/main/resources/application.properties
中有此数据,内容为 yandex.api_key=valueOfMyKey
.
我执行命令 travis encrypt-file application.properties
并获得编码的文件 application.properties.enc
。此外,我得到了这个输出,我明白了它的意思(我将构建脚本添加到我的.travis.yml
)
storing secure env variables for decryption
Please add the following to your build script (before_install stage in your .travis.yml, for instance):
openssl aes-256-cbc -K $encrypted_b21eaa919621_key -iv $encrypted_b21eaa919621_iv -in application.properties.enc -out application.properties -d
Pro Tip: You can add it automatically by running with --add.
Make sure to add application.properties.enc to the git repository.
Make sure not to add application.properties to the git repository.
Commit all changes to your .travis.yml.
我执行了命令travis lint .travis.yml
,我得到了一个有效的输出。我的 travis 文件现在有这个内容:
language: java
jdk:
- oraclejdk8
before_install:
- openssl aes-256-cbc -K $encrypted_b21eaa919621_key -iv $encrypted_b21eaa919621_iv
-in src/main/resources/application.properties.enc -out src/main/resources/application.properties -d
但是,我没有通过 travis 测试。我得到以下输出:
你可以在this public repo中查看我的代码。
我解决了。我在加密我的文件之前没有激活 travis,所以 travis 没有这两个值。我刚刚激活它并再次加密。