I am learning about Pipelines. My objective is to use a pipeline to deploy the code to a Digitalocean server. The SSH and the Server is set.
The pipeline runs without errors but when I go to the server there is nothing there. How can I make cloned repository show up in the destination server?
My Pipeline:
image: node:12.13.0
pipelines:
default:
- step:
name: Deploy to Staging
deployment: staging
script:
- apt-get update && apt-get install -y unzip git
- sh script_CloneOnly.sh
definitions:
services:
mongo:
image: mongo
The script:
#!/bin/bash
git clone --bare git@bitbucket.org:team1/myrepo.git
cd myrepo.git
git fetch origin --tags
Then I get the following output:
+ sh script_CloneOnly.sh
Checking out the source repository
Cloning into bare repository 'myrepo.git'...
Warning: Permanently added the RSA host key for IP address '18.205.93.0' to the list of known hosts.
Entering the checked out repository
Downloading the source repository
Warning: Permanently added the RSA host key for IP address '18.205.93.1' to the list of known hosts.
From bitbucket.org:team1/myrepo
* branch HEAD -> FETCH_HEAD
I expected to find the cloned repository in the server but there is nothing there. What is going wrong with my pipeline? Why I can't clone the repo to the server and keep it there?
Hello @Andre,
There's nothing in your pipeline configuration pointing to your remote server in DigitalOcean. Your current script simply clones team1/myrepo repository onto machine that runs the pipeline, that is, Bitbucket machine, not the remote server.
Depending on what your desired deployment mechanism looks like, I'd expect to see either adding another remote to the repo (which is already there, provided by Pipelines, so you don't need to clone it again) and then git push, or maybe rsync, or something else to actually copy the files to the remote server in DigitalOcean.
Hope this helps. Let me know if you have any questions.
Cheers,
Daniil
Ok, now I understand, the setup of the remote server in the repository page is not enough to send the app to the server. I must add SSH instructions in the pipeline, something, under script:, like:
- ssh root@167.99.185.20 touch mytxt.txt
Now it works,
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.