为什么我的构建会抱怨缺少环境变量,而我可以清楚地看到它存在?
Why does my build complain that an environment variable is missing when I can plainly see that it exists?
我有一个 travis-ci build 设置来构建一个 PHP 项目。当构建 运行s 时,它在测试 运行 期间失败并指出:
Environment var: GettyImagesApi_ApiKey was not found in the environment (Exception)
这在以前发生过,我删除了环境变量,重新创建它,然后重新运行 构建,它停止抛出异常。现在它又开始抛出异常,删除并重新创建环境变量也无济于事。
顺便说一下,这个环境变量是在 GUI 中设置的,而不是在 .travis.yml
文件中。
再进行几次构建后,我注意到 sometimes 我在构建日志中看到了这一点:
Setting environment variables from repository settings
$ export GettyImagesApi_ApiSecret=[secure]
$ export GettyImagesApi_UserName=[secure]
$ export GettyImagesApi_UserPassword=[secure]
$ export GettyImagesApi_ApiKey=[secure]
当然,环境变量是可用的。有时我看不到这些行,然后环境变量不存在。
什么会导致构建跳过导出环境变量?
我想通了。读书总是好的:
"...we do not expose these values to untrusted builds, triggered by pull requests from another repository."
失败的构建是拉取请求。从主回购构建获得适当的环境变量。
我有一个 travis-ci build 设置来构建一个 PHP 项目。当构建 运行s 时,它在测试 运行 期间失败并指出:
Environment var: GettyImagesApi_ApiKey was not found in the environment (Exception)
这在以前发生过,我删除了环境变量,重新创建它,然后重新运行 构建,它停止抛出异常。现在它又开始抛出异常,删除并重新创建环境变量也无济于事。
顺便说一下,这个环境变量是在 GUI 中设置的,而不是在 .travis.yml
文件中。
再进行几次构建后,我注意到 sometimes 我在构建日志中看到了这一点:
Setting environment variables from repository settings
$ export GettyImagesApi_ApiSecret=[secure]
$ export GettyImagesApi_UserName=[secure]
$ export GettyImagesApi_UserPassword=[secure]
$ export GettyImagesApi_ApiKey=[secure]
当然,环境变量是可用的。有时我看不到这些行,然后环境变量不存在。
什么会导致构建跳过导出环境变量?
我想通了。读书总是好的:
"...we do not expose these values to untrusted builds, triggered by pull requests from another repository."
失败的构建是拉取请求。从主回购构建获得适当的环境变量。