Reputation: 550
I am setting up CI from my github repo to Digital Ocean droplet. Following instructions from internet i created SSH key, encrypt it and config my .travis.yml file
But during Job Travis requires password to deploy code to droplet.
Link to one of my builds: https://travis-ci.com/KletskovG/kletksovg.tech/builds/132806624
I try to install expect package in bash and write to my deploy.sh script like this:
expect "password"
send "My_droplet_user_password"
My .travis.yml config
language: node_js
node_js:
- 10
notifications:
email: false
addons:
ssh_known_hosts:
- kletskovg.tech
before_install:
- openssl aes-256-cbc -K $encrypted_89e65714f577_key -iv $encrypted_89e65714f577_iv -in travis_rsa.enc -out travis_rsa -d
- chmod 600 travis_rsa
- mv travis_rsa ~/.ssh/id_rsa
- sudo apt-get install -y expect
install:
- cd client
- npm i webpack-cli -g
- npm i
before_script:
- echo -e "Host kletskovg.tech\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
script:
- npm test
deploy:
provider: script
skip_cleanup: true
user: travis
password: TravisDeploy02
script: cd ../ && chmod +x ./deploy.sh && ./deploy.sh
on:
all_branches: true
#
#after_success:
# - bash ./deploy.sh
Code while deploying:
Deploying application
+echo '#### DEPLOY ####'
#### DEPLOY ####
+'[' master == master ']'
++ssh-agent -s
+eval 'SSH_AUTH_SOCK=/tmp/ssh-zAgy7iJpDFB6/agent.7731; export SSH_AUTH_SOCK;
SSH_AGENT_PID=7732; export SSH_AGENT_PID;
echo Agent pid 7732;'
++SSH_AUTH_SOCK=/tmp/ssh-zAgy7iJpDFB6/agent.7731
++export SSH_AUTH_SOCK
++SSH_AGENT_PID=7732
++export SSH_AGENT_PID
++echo Agent pid 7732
Agent pid 7732
+ssh-add /home/travis/.ssh/id_rsa
Identity added: /home/travis/.ssh/id_rsa ([email protected])
+echo TRYING TO DEPLOY
TRYING TO DEPLOY
+git init
Reinitialized existing Git repository in /home/travis/build/KletskovG/kletksovg.tech/.git/
+git remote add deploy [email protected]:/var/www/kletskovg.tech
+git config user.name 'Travis CI'
+git config user.email [email protected]
+git add .
+git commit -m Deploy
[detached HEAD 4561161] Deploy
2 files changed, 42 insertions(+)
mode change 100644 => 100755 deploy.sh
+git push --force deploy master
Warning: Permanently added the ECDSA host key for IP address '138.68.30.170' to the list of known hosts.
[email protected]'s password:
How can i fix this? Thank you.
Upvotes: 0
Views: 396
Reputation: 550
I just create everything from scratch in a new repo. Now its working.
Upvotes: 1