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

bitbucket pipeline, rsync pipe

Sanele Mhlakaza
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 23, 2024

I have this yml script for copying files to my window server:

pipelines:

default:

- step:

name: 'Deployment to Staging'

deployment: staging

script:

- pipe: atlassian/rsync-deploy:0.12.0

variables:

USER: $Ssh_Username

SERVER: $Server_Name

REMOTE_PATH: 'C:/Temp'

LOCAL_PATH: ${BITBUCKET_CLONE_DIR}

DEBUG: 'true'

EXTRA_ARGS:

- "--exclude=${BITBUCKET_CLONE_DIR}/.gitignore"

DELETE_FLAG: 'false'




I get the following error:

+ docker container run \

 

2
--volume=/opt/atlassian/pipelines/agent/build:/opt/atlassian/pipelines/agent/build \

 

3
--volume=/opt/atlassian/pipelines/agent/ssh:/opt/atlassian/pipelines/agent/ssh:ro \

 

4
--volume=/opt/atlassian/pipelines/bin/docker:/usr/local/bin/docker:ro \

 

5
--volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes \

 

6
--volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/rsync-deploy:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/rsync-deploy \

 

7
--workdir=$(pwd) \

 

8
--label=org.bitbucket.pipelines.system=true \

 

9
--env=BITBUCKET_STEP_TRIGGERER_UUID="$BITBUCKET_STEP_TRIGGERER_UUID" \

 

10
--env=BITBUCKET_REPO_FULL_NAME="$BITBUCKET_REPO_FULL_NAME" \

 

11
--env=BITBUCKET_GIT_HTTP_ORIGIN="$BITBUCKET_GIT_HTTP_ORIGIN" \

 

12
--env=BITBUCKET_PROJECT_UUID="$BITBUCKET_PROJECT_UUID" \

 

13
--env=BITBUCKET_REPO_IS_PRIVATE="$BITBUCKET_REPO_IS_PRIVATE" \

 

14
--env=BITBUCKET_WORKSPACE="$BITBUCKET_WORKSPACE" \

 

15
--env=BITBUCKET_DEPLOYMENT_ENVIRONMENT_UUID="$BITBUCKET_DEPLOYMENT_ENVIRONMENT_UUID" \

 

16
--env=BITBUCKET_SSH_KEY_FILE="$BITBUCKET_SSH_KEY_FILE" \

 

17
--env=BITBUCKET_REPO_OWNER_UUID="$BITBUCKET_REPO_OWNER_UUID" \

 

18
--env=BITBUCKET_BRANCH="$BITBUCKET_BRANCH" \

 

19
--env=BITBUCKET_REPO_UUID="$BITBUCKET_REPO_UUID" \

 

20
--env=BITBUCKET_PROJECT_KEY="$BITBUCKET_PROJECT_KEY" \

 

21
--env=BITBUCKET_DEPLOYMENT_ENVIRONMENT="$BITBUCKET_DEPLOYMENT_ENVIRONMENT" \

 

22
--env=BITBUCKET_REPO_SLUG="$BITBUCKET_REPO_SLUG" \

 

23
--env=CI="$CI" \

 

24
--env=BITBUCKET_REPO_OWNER="$BITBUCKET_REPO_OWNER" \

 

25
--env=BITBUCKET_STEP_RUN_NUMBER="$BITBUCKET_STEP_RUN_NUMBER" \

 

26
--env=BITBUCKET_BUILD_NUMBER="$BITBUCKET_BUILD_NUMBER" \

 

27
--env=BITBUCKET_GIT_SSH_ORIGIN="$BITBUCKET_GIT_SSH_ORIGIN" \

 

28
--env=BITBUCKET_PIPELINE_UUID="$BITBUCKET_PIPELINE_UUID" \

 

29
--env=BITBUCKET_COMMIT="$BITBUCKET_COMMIT" \

 

30
--env=PIPELINES_JWT_TOKEN="$PIPELINES_JWT_TOKEN" \

 

31
--env=BITBUCKET_STEP_UUID="$BITBUCKET_STEP_UUID" \

 

32
--env=BITBUCKET_DOCKER_HOST_INTERNAL="$BITBUCKET_DOCKER_HOST_INTERNAL" \

 

33
--env=DOCKER_HOST="tcp://host.docker.internal:2375" \

 

34
--env=BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" \

 

35
--env=BITBUCKET_PIPE_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/rsync-deploy" \

 

36
--env=DEBUG="true" \

 

37
--env=DELETE_FLAG="false" \

 

38
--env=EXTRA_ARGS_0="--exclude=${BITBUCKET_CLONE_DIR}/.gitignore" \

 

39
--env=EXTRA_ARGS_COUNT="1" \

 

40
--env=LOCAL_PATH="${BITBUCKET_CLONE_DIR}" \

 

41
--env=REMOTE_PATH="C:/Temp" \

 

42
--env=SERVER="$Server_Name" \

 

43
--env=USER="$Ssh_Username" \

 

44
--add-host="host.docker.internal:$BITBUCKET_DOCKER_HOST_INTERNAL" \

 

45
bitbucketpipelines/rsync-deploy:0.12.0

 

46
Unable to find image 'bitbucketpipelines/rsync-deploy:0.12.0' locally

 

47
0.12.0: Pulling from bitbucketpipelines/rsync-deploy

 

48
c926b61bad3b: Pulling fs layer

 

49
3fa91154c8ba: Pulling fs layer

 

50
8b799e176331: Pulling fs layer

 

51
420363a78e8f: Pulling fs layer

 

52
420363a78e8f: Waiting

 

 

53
8b799e176331: Verifying Checksum

 

 

54
8b799e176331: Download complete

 

 

55
c926b61bad3b: Verifying Checksum

 

56
c926b61bad3b: Download complete

 

57
3fa91154c8ba: Verifying Checksum

 

58
3fa91154c8ba: Download complete

 

59
c926b61bad3b: Pull complete

 

60
420363a78e8f: Download complete

 

61
3fa91154c8ba: Pull complete

 

62
8b799e176331: Pull complete

 

63
420363a78e8f: Pull complete

 

64
Digest: sha256:fa49cfc31bd2a30b81a3ed79516caa198d81f27fc619920fdffca5ce6d878f67

 

65
Status: Downloaded newer image for bitbucketpipelines/rsync-deploy:0.12.0

 

66
INFO: Executing the pipe...

 

67
INFO: Enabling debug mode.

 

68
+ setup_ssh_dir

 

69
+ INJECTED_SSH_CONFIG_DIR=/opt/atlassian/pipelines/agent/ssh

 

70
+ IDENTITY_FILE=/opt/atlassian/pipelines/agent/ssh/id_rsa_tmp

 

71
+ KNOWN_HOSTS_FILE=/opt/atlassian/pipelines/agent/ssh/known_hosts

 

72
+ mkdir -p /root/.ssh

 

73
+ touch /root/.ssh/authorized_keys

 

74
+ '[' '' '!=' '' ']'

 

75
+ '[' '!' -f /opt/atlassian/pipelines/agent/ssh/id_rsa_tmp ']'

 

76
+ debug 'Using default ssh key'

 

77
+ [[ true == \t\r\u\e ]]

 

78
+ echo -e '\e[37mDEBUG: Using default ssh key\e[0m'

 

79
+ cp /opt/atlassian/pipelines/agent/ssh/id_rsa_tmp /root/.ssh/pipelines_id

 

80
DEBUG: Using default ssh key

 

81
+ '[' '!' -f /opt/atlassian/pipelines/agent/ssh/known_hosts ']'

 

82
+ cat /opt/atlassian/pipelines/agent/ssh/known_hosts

 

83
+ '[' -f /root/.ssh/config ']'

 

84
+ echo 'IdentityFile ~/.ssh/pipelines_id'

 

85
+ chmod -R go-rwx /root/.ssh/

 

86
INFO: Starting RSYNC deployment to $Server_name:C:/Temp...

 

87
+ run_pipe

 

88
+ info 'Starting RSYNC deployment to $Server_name:C:/Temp...'

 

89
+ echo -e '\e[36mINFO: Starting RSYNC deployment to $Server_name:C:/Temp...\e[0m'

 

90
+ [[ ! -z '' ]]

 

91
+ [[ ! -z '' ]]

 

92
+ run rsync -rp --exclude=./.gitignore . $Ssh_username@$Server_name:C:/Temp

 

93
++ date +%s

 

94
rsync -rp --exclude=./.gitignore . $Ssh_username@$Server_name:C:/Temp

 

95
+ output_file=/var/tmp/pipe-1708686818-32466

 

96
+ echo rsync -rp --exclude=./.gitignore . $Ssh_username@$Server_name:C:/Temp

 

97
+ set +e

 

98
+ rsync -rp --exclude=./.gitignore . $Ssh_username@$Server_name:C:/Temp

 

99
+ tee /var/tmp/pipe-1708686818-32466

 

100
'rsync' is not recognized as an internal or external command,

 

101
operable program or batch file.

 

102
rsync: connection unexpectedly closed (0 bytes received so far) [sender]

 

103
rsync error: error in rsync protocol data stream (code 12) at io.c(231) [sender=3.2.7]

 

104
+ status=12

 

105
+ set -e

 

106
✖ Deployment failed.

 

107
+ [[ 12 == \0 ]]

 

108
+ fail 'Deployment failed.'

 

109
+ echo -e '\e[31m✖ Deployment failed.\e[0m'

 

110
+ exit 1

 

111

 

112

Can you please help
 

1 answer

1 vote
Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 23, 2024

@Sanele Mhlakaza hi. Please, check this answer.

 

Regards, Igor

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events