我正在尝试将两个加密环境变量中的API密钥(其中两个)存储到Travis中,它说它们已经导入,然后无法识别它们。这两个变量是TWILIO_TOKEN
和TWILIO_ACCT
。我也将这些存储在Heroku的.env
变量中。我尝试过使用仪表板 - &gt;设置 - &gt; Travis-ci.org(公共存储库)上的环境变量,以及travis encrypt TWILIO_ACCT=<key> --add env.matrix
(其中两个)。发生了什么?
记录:
Using worker: worker-linux-docker-dce1945a.prod.travis-ci.org:travis-linux-2
Build system information
Build language: python
Build group: stable
Build dist: precise
Build image provisioning date and time
Thu Feb 5 15:09:33 UTC 2015
Operating System Details
Distributor ID: Ubuntu
Description: Ubuntu 12.04.5 LTS
Release: 12.04
Codename: precise
Linux Version
3.13.0-29-generic
Cookbooks Version
a68419e https://github.com/travis-ci/travis-cookbooks/tree/a68419e
GCC version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
LLVM version
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Pre-installed Ruby versions
ruby-1.9.3-p551
Pre-installed Node.js versions
v0.10.36
Pre-installed Go versions
1.4.1
Redis version
redis-server 2.8.19
riak version
2.0.2
MongoDB version
MongoDB 2.4.12
CouchDB version
couchdb 1.6.1
Neo4j version
1.9.4
RabbitMQ Version
3.4.3
ElasticSearch version
1.4.0
Installed Sphinx versions
2.0.10
2.1.9
2.2.6
Default Sphinx version
2.2.6
Installed Firefox version
firefox 31.0esr
PhantomJS version
1.9.8
ant -version
Apache Ant(TM) version 1.8.2 compiled on December 3 2011
mvn -version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: /usr/local/maven
Java version: 1.7.0_76, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.13.0-29-generic", arch: "amd64", family: "unix"
$ export DEBIAN_FRONTEND=noninteractive
W: Size of file /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise-backports_multiverse_source_Sources.gz is not what the server reported 5886 5888
W: Size of file /var/lib/apt/lists/ppa.launchpad.net_ubuntugis_ppa_ubuntu_dists_precise_main_binary-amd64_Packages.gz is not what the server reported 36669 36677
W: Size of file /var/lib/apt/lists/ppa.launchpad.net_ubuntugis_ppa_ubuntu_dists_precise_main_binary-i386_Packages.gz is not what the server reported 36729 36733
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
libc-bin libc-dev-bin libc6-dev
Suggested packages:
glibc-doc
The following packages will be upgraded:
libc-bin libc-dev-bin libc6 libc6-dev
4 upgraded, 0 newly installed, 0 to remove and 236 not upgraded.
Need to get 8,840 kB of archives.
After this operation, 14.3 kB disk space will be freed.
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc6-dev amd64 2.15-0ubuntu10.15 [2,943 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc-dev-bin amd64 2.15-0ubuntu10.15 [84.7 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc-bin amd64 2.15-0ubuntu10.15 [1,177 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc6 amd64 2.15-0ubuntu10.15 [4,636 kB]
Fetched 8,840 kB in 0s (34.2 MB/s)
Preconfiguring packages ...
(Reading database ... 72431 files and directories currently installed.)
Preparing to replace libc6-dev 2.15-0ubuntu10.10 (using .../libc6-dev_2.15-0ubuntu10.15_amd64.deb) ...
Unpacking replacement libc6-dev ...
Preparing to replace libc-dev-bin 2.15-0ubuntu10.10 (using .../libc-dev-bin_2.15-0ubuntu10.15_amd64.deb) ...
Unpacking replacement libc-dev-bin ...
Preparing to replace libc-bin 2.15-0ubuntu10.10 (using .../libc-bin_2.15-0ubuntu10.15_amd64.deb) ...
Unpacking replacement libc-bin ...
Processing triggers for man-db ...
Setting up libc-bin (2.15-0ubuntu10.15) ...
(Reading database ... 72430 files and directories currently installed.)
Preparing to replace libc6 2.15-0ubuntu10.10 (using .../libc6_2.15-0ubuntu10.15_amd64.deb) ...
Unpacking replacement libc6 ...
Setting up libc6 (2.15-0ubuntu10.15) ...
Setting up libc-dev-bin (2.15-0ubuntu10.15) ...
Setting up libc6-dev (2.15-0ubuntu10.15) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
$ git clone --depth=50 --branch=vincent https://github.com/YangVincent/yelp-and-chill.git YangVincent/yelp-and-chill
Cloning into 'YangVincent/yelp-and-chill'...
remote: Counting objects: 872, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 872 (delta 3), reused 0 (delta 0), pack-reused 864
Receiving objects: 100% (872/872), 2.51 MiB | 0 bytes/s, done.
Resolving deltas: 100% (119/119), done.
Checking connectivity... done.
$ cd YangVincent/yelp-and-chill
$ git checkout -qf 3508697c5e9c794706d8f20278d4925b86bf9747
This job is running on container-based infrastructure, which does not allow use of 'sudo', setuid and setguid executables.
If you require sudo, add 'sudo: required' to your .travis.yml
See https://docs.travis-ci.com/user/workers/container-based-infrastructure/ for details.
Setting environment variables from repository settings
$ export TWILIO_TOKEN=[secure]
$ export TWILIO_ACCT=[secure]
$ source ~/virtualenv/python3.4/bin/activate
$ python --version
Python 3.4.2
$ pip --version
pip 6.0.7 from /home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages (python 3.4)
$ pip install -r requirements.txt
Collecting pycparser==2.14 (from -r requirements.txt (line 1))
Downloading pycparser-2.14.tar.gz (223kB)
100% |################################| 225kB 1.1MB/s
Collecting requests==2.9.1 (from -r requirements.txt (line 2))
Downloading requests-2.9.1-py2.py3-none-any.whl (501kB)
100% |################################| 503kB 1.2MB/s
Collecting simplejson==3.8.2 (from -r requirements.txt (line 3))
Downloading simplejson-3.8.2.tar.gz (76kB)
100% |################################| 77kB 6.1MB/s
Collecting gunicorn==19.6.0 (from -r requirements.txt (line 4))
Downloading gunicorn-19.6.0-py2.py3-none-any.whl (114kB)
100% |################################| 114kB 4.5MB/s
Collecting Flask==0.11.1 (from -r requirements.txt (line 5))
Downloading Flask-0.11.1-py2.py3-none-any.whl (80kB)
100% |################################| 81kB 6.0MB/s
Collecting twilio==5.4.0 (from -r requirements.txt (line 6))
Downloading twilio-5.4.0.tar.gz (193kB)
100% |################################| 196kB 3.0MB/s
Collecting click>=2.0 (from Flask==0.11.1->-r requirements.txt (line 5))
Downloading click-6.6.tar.gz (283kB)
100% |################################| 286kB 2.0MB/s
Collecting itsdangerous>=0.21 (from Flask==0.11.1->-r requirements.txt (line 5))
Downloading itsdangerous-0.24.tar.gz (46kB)
100% |################################| 49kB 8.2MB/s
Collecting Werkzeug>=0.7 (from Flask==0.11.1->-r requirements.txt (line 5))
Downloading Werkzeug-0.11.10-py2.py3-none-any.whl (306kB)
100% |################################| 307kB 2.0MB/s
Collecting Jinja2>=2.4 (from Flask==0.11.1->-r requirements.txt (line 5))
Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB)
100% |################################| 266kB 3.1MB/s
Collecting httplib2>=0.7 (from twilio==5.4.0->-r requirements.txt (line 6))
Downloading httplib2-0.9.2.zip (210kB)
100% |################################| 212kB 1.0MB/s
Collecting six (from twilio==5.4.0->-r requirements.txt (line 6))
Downloading six-1.10.0-py2.py3-none-any.whl
Collecting pytz (from twilio==5.4.0->-r requirements.txt (line 6))
Downloading pytz-2016.4-py2.py3-none-any.whl (480kB)
100% |################################| 483kB 1.3MB/s
Collecting pysocks (from twilio==5.4.0->-r requirements.txt (line 6))
Downloading PySocks-1.5.7.tar.gz
Collecting MarkupSafe (from Jinja2>=2.4->Flask==0.11.1->-r requirements.txt (line 5))
Downloading MarkupSafe-0.23.tar.gz
Installing collected packages: MarkupSafe, pysocks, pytz, six, httplib2, Jinja2, Werkzeug, itsdangerous, click, twilio, Flask, gunicorn, simplejson, requests, pycparser
Running setup.py install for MarkupSafe
building 'markupsafe._speedups' extension
gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIC -I/opt/python/3.4.2/include/python3.4m -c markupsafe/_speedups.c -o build/temp.linux-x86_64-3.4/markupsafe/_speedups.o
gcc -pthread -shared -L/opt/python/3.4.2/lib -Wl,-rpath=/opt/python/3.4.2/lib build/temp.linux-x86_64-3.4/markupsafe/_speedups.o -L/opt/python/3.4.2/lib -lpython3.4m -o build/lib.linux-x86_64-3.4/markupsafe/_speedups.cpython-34m.so
Running setup.py install for pysocks
Running setup.py install for httplib2
Running setup.py install for itsdangerous
Running setup.py install for click
Running setup.py install for twilio
Running setup.py install for simplejson
building 'simplejson._speedups' extension
gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIC -I/opt/python/3.4.2/include/python3.4m -c simplejson/_speedups.c -o build/temp.linux-x86_64-3.4/simplejson/_speedups.o
gcc -pthread -shared -L/opt/python/3.4.2/lib -Wl,-rpath=/opt/python/3.4.2/lib build/temp.linux-x86_64-3.4/simplejson/_speedups.o -L/opt/python/3.4.2/lib -lpython3.4m -o build/lib.linux-x86_64-3.4/simplejson/_speedups.cpython-34m.so
Running setup.py install for pycparser
Build the lexing/parsing tables
Successfully installed Flask-0.11.1 Jinja2-2.8 MarkupSafe-0.23 Werkzeug-0.11.10 click-6.6 gunicorn-19.6.0 httplib2-0.9.2 itsdangerous-0.24 pycparser-2.14 pysocks-1.5.7 pytz-2016.4 requests-2.9.1 simplejson-3.8.2 six-1.10.0 twilio-5.4.0
$ nosetests --with-doctest
.E
======================================================================
ERROR: Failure: NameError (name 'TWILIO_ACCT' is not defined)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/nose/failure.py", line 39, in runTest
raise self.exc_val.with_traceback(self.tb)
File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/nose/loader.py", line 414, in loadTestsFromName
addr.filename, addr.module)
File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/travis/virtualenv/python3.4.2/lib/python3.4/imp.py", line 235, in load_module
return load_source(name, filename, file)
File "/home/travis/virtualenv/python3.4.2/lib/python3.4/imp.py", line 171, in load_source
module = methods.load()
File "<frozen importlib._bootstrap>", line 1220, in load
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/home/travis/build/YangVincent/yelp-and-chill/text.py", line 4, in <module>
account_sid = TWILIO_ACCT
NameError: name 'TWILIO_ACCT' is not defined
----------------------------------------------------------------------
Ran 2 tests in 0.200s
FAILED (errors=1)
The command "nosetests --with-doctest" exited with 1.
Done. Your build exited with 1.
答案 0 :(得分:0)
虽然我没弄清楚为什么,但我发现了什么是错的。首先,我决定通过UI存储API密钥。其次,我没有将变量用作bash环境变量。相反,我使用heroku的建议有一个.env文件。