Próbuję programowo wdrożyć do Amazon Elastic Beanstalk z pracy Jenkins. Na moim komputerze deweloperskim, jest to tak proste, jak:Jak wdrożyć aplikację Python do Amazon Elastic Beanstalk z Jenkins?
eb deploy $(AWS_ELASTIC_BEANSTALK_ENVIRONMENT)
na Jenkins, powinno być tak proste, jak konfigurowanie następujących jako polecenie Build:
virtualenv env && source env/bin/activate && pip install awsebcli
mkdir -p .elasticbeanstalk
cat <<EOF> .elasticbeanstalk/config.yml
branch-defaults:
master:
environment: myenv
global:
application_name: myapp
default_ec2_keyname: null
default_platform: 64bit Amazon Linux 2014.09 v1.0.9 running Python 2.7
default_region: us-west-2
profile: eb-cli
sc: git
EOF
eb deploy myenv
Jednak to nie z poniższego śladu :
[EnvInject] - Loading node environment variables.
Building remotely on standard Amazon Linux 2014.09 AMI (i-d39710df) (x) in workspace /media/ephemeral0/jenkins/workspace/My_Job
Fetching changes from the remote Git repository
Fetching upstream changes from [email protected]:myapp.git
Checking out Revision be45db94111f9ab49fe8031eb583307d2fb9921c (origin/master)
[My_Job] $ /bin/sh -xe /tmp/hudson8633484437962332339.sh
+ virtualenv env
New python executable in env/bin/python2.7
Not overwriting existing python script env/bin/python (you must use env/bin/python2.7)
Installing Setuptools..................................................................................................................done.
Installing Pip....................................................................................................................................done.
+ source env/bin/activate
++ deactivate nondestructive
++ unset pydoc
++ '[' -n '' ']'
++ '[' -n '' ']'
++ '[' -n /bin/sh -o -n '' ']'
++ hash -r
++ '[' -n '' ']'
++ unset VIRTUAL_ENV
++ '[' '!' nondestructive = nondestructive ']'
++ VIRTUAL_ENV=/media/ephemeral0/jenkins/workspace/My_Job/env
++ export VIRTUAL_ENV
++ _OLD_VIRTUAL_PATH=/usr/local/bin:/bin:/usr/bin:/opt/aws/bin
++ PATH=/media/ephemeral0/jenkins/workspace/My_Job/env/bin:/usr/local/bin:/bin:/usr/bin:/opt/aws/bin
++ export PATH
++ '[' -n '' ']'
++ '[' -z '' ']'
++ _OLD_VIRTUAL_PS1=
++ '[' x '!=' x ']'
+++ basename /media/ephemeral0/jenkins/workspace/My_Job/env
++ '[' env = __ ']'
+++ basename /media/ephemeral0/jenkins/workspace/My_Job/env
++ PS1='(env)'
++ export PS1
++ alias 'pydoc=python -m pydoc'
++ '[' -n /bin/sh -o -n '' ']'
++ hash -r
+ pip install awsebcli
Requirement already satisfied (use --upgrade to upgrade): awsebcli in ./env/lib/python2.7/site-packages
Downloading/unpacking setuptools>=7.0 (from awsebcli)
Running setup.py egg_info for package setuptools
Requirement already satisfied (use --upgrade to upgrade): pyyaml>=3.11 in ./env/lib/python2.7/site-packages (from awsebcli)
Requirement already satisfied (use --upgrade to upgrade): six==1.8.0 in ./env/lib/python2.7/site-packages (from awsebcli)
Requirement already satisfied (use --upgrade to upgrade): cement==2.4 in ./env/lib/python2.7/site-packages (from awsebcli)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil>=2.2 in ./env/lib/python2.7/site-packages (from awsebcli)
Requirement already satisfied (use --upgrade to upgrade): jmespath>=0.4.1 in ./env/lib/python2.7/site-packages (from awsebcli)
Installing collected packages: setuptools
Found existing installation: setuptools 0.9.7
Uninstalling setuptools:
Successfully uninstalled setuptools
Running setup.py install for setuptools
Installing easy_install script to /media/ephemeral0/jenkins/workspace/My_Job/env/bin
Installing easy_install-2.7 script to /media/ephemeral0/jenkins/workspace/My_Job/env/bin
Successfully installed setuptools
Cleaning up...
+ mkdir -p .elasticbeanstalk
+ cat
+ cat .elasticbeanstalk/config.yml
branch-defaults:
master:
environment: myenv
global:
application_name: myapp
default_ec2_keyname: null
default_platform: 64bit Amazon Linux 2014.09 v1.0.9 running Python 2.7
default_region: us-west-2
profile: eb-cli
sc: git
+ eb deploy myenv
ERROR: The config profile (eb-cli) could not be found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Nie jest jasne, dlaczego tak się dzieje, ponieważ po uruchomieniu powyższego na lokalnej kopii mojego projektu działa dobrze.
Komunikat o błędzie wydaje się mało pomocny. Nie jest jasne, dlaczego eb-cli nie mógłby znaleźć się na maszynie Jenkinsa.
Podsumowując ponownie moje pytanie: Jak mogę wdrożyć w Amazon Elastic Beanstalk z Jenkins? Czy powyższe podejście jest prawidłowe, ale z błędami w szczegółach? Czy jest jakiś prostszy sposób całkowicie?