Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Expected either a string or a pipe

jhorning-tyler March 6, 2019

Trying to set up SFTP deploy but copying the sample code into my yml file causes an error no matter how I seem to do the indentation. First time doing anything like this so any help appreciated.

# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:7.1.1

pipelines:
default:
- step:
caches:
- composer
script:
- pipe: atlassian/sftp-deploy:0.3.1
variables:
USER: '<string>'
SERVER: '<string>'
REMOTE_PATH: '<string>'
LOCAL_PATH: '<string>'
# SSH_KEY: '<string>' # Optional.
# EXTRA_ARGS: '<string>' # Optional.
# DEBUG: '<boolean>' # Optional.
script:
- echo "Deploying to test environment"
- apt-get update && apt-get install -y unzip
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- vendor/bin/phpunit

1 answer

1 accepted

0 votes
Answer accepted
Raul Gomis
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 7, 2019

Hey @jhorning-tyler ,

You need to fill in the pipe parameters (i.e. replacing <string> with the values you want to use). 

For example:

pipelines:
  default:
  - step:
      name: Deploy text file
      script:
        - echo "blah" > test-file.txt
        - pipe: atlassian/sftp-deploy:0.3.1
          variables:
             USER: ec2-user
             SERVER: 13.236.114.90
             REMOTE_PATH: "/opt/sftp-test/"
             LOCAL_PATH: "test-file.txt"

jhorning-tyler March 7, 2019

Hi Raul,

Thanks for the reply! I should have mentioned I left those in my post just to keep my server info private. This morning, I moved the -pipe section to the bottom and that fixed that error. Now, I have one more question: What is the IP address of the Bitbucket machine that will be hitting our server? Our server/network guy has locked down our SFTP so that it only works if you are on our server and I think that is the reason the pipeline is failing at composer install. Let me know if I need to create a new post since that is an unrelated issue.

Graham Gatus
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 7, 2019

@jhorning-tyler you should whitelist all IP ranges listed under 'Valid IP addresses for Bitbucket Pipelines build environments' at https://confluence.atlassian.com/bitbucket/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall-343343385.html

If you are using ssh or scp and will be performing host verification via the Pipelines UI, you will also need to whitelist IPs listed under 'Valid IP addresses for Bitbucket Pipelines services' (ssh key scans for host key verification are performed from Bitbucket Pipelines services).

jhorning-tyler March 8, 2019

Ok, great! I will pass this info on. Thank you so much for your help!

daniellucena2 August 27, 2019

Can i duplicate LOCALPATH and REMOTE PATH?

 

USER: ec2-user
SERVER: 13.236.114.90
REMOTE_PATH: "/opt/sftp-test/"
LOCAL_PATH: "test-file.txt"

REMOTE_PATH: "/opt/sftp-test2/"
LOCAL_PATH: "test-file.txt"

 

??

thanks.

Halyna Berezovska
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 30, 2021

@daniellucena2   if you need to copy to two locations, you need to use two pipes. You can also run such scripts in parallel steps. Check out the doc https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/#parallel

Regards, Galyna

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events