W
W
web_dev2017-01-27 16:55:31
git
web_dev, 2017-01-27 16:55:31

Bitbucket pipeline - execut script(redeploy) on remote server?

Hello, I actually read the documentation, did what was indicated in it, it turns out I didn’t understand a bit ..
There is a task, after each commit, ssh into the server and rebuild / restart the project. Since I use Bitbucket, it seemed to me that this is exactly what I need.
I did everything that is described, https://confluence.atlassian.com/bitbucket/access-...
As a result, I got such a script, for the test I install tree. The script worked, something was installed somewhere.

pipelines:   
  default :
     - step:
         script: # Modify the commands below to build your repository.
           - mkdir -p ~/.ssh
           - cat my_known_hosts >> ~/.ssh/known_hosts
           - (umask  077 ; echo $MY_SSH_KEY | base64 --decode > ~/.ssh/id_rsa)
           - sudo apt-get install tree

Maybe I need to write a sequence of commands in this script? And then I didn’t understand something Pts ...
Connect to my server then execute the commands there, how can I do this? There is very little information on the Internet..
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alexZzZzZzZ, 2017-03-31
@alexZzZzZzZ

- ssh [email protected] echo 1
where echo 1 is a set of commands that we want to execute on the server
, the key should be stored in a variable only if you have more than 1 server to which you want to connect. if 1 - then specify it in the pipeline settings and that's it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question