Answer the question
In order to leave comments, you need to log in
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
Answer the question
In order to leave comments, you need to log in
- 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 questionAsk a Question
731 491 924 answers to any question