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

Build docker images pipeline doesn't clone code to docker images.

Chatree Kunjai October 17, 2021

Hi,

Today I found an issue that the docker images don't clone the code from the bitbucket repository when is build from the bitbucket pipeline.

On my Dockerfile has a step to clone the code from bitbucket to docker images with this step below.

RUN sed -i 's/^# StrictHostKeyChecking ask/ StrictHostKeyChecking no/g' /etc/ssh/ssh_config && \
git clone git@bitbucket.org:project/example-repo.git /home/app && \
sed -i 's/^# StrictHostKeyChecking/# StrictHostKeyChecking/g' /etc/ssh/ssh_config 

But after I tried to check inside the container that run with those docker images. The folder that should have a code is empty.

When I tried to build the docker images in my local laptop with the same docker file and the same command for docker build, the code from my repository is already pull to the application folder.

I tried to add a git debut to find out what is happening with `GIT_TRACE=true GIT_SSH_COMMAND="ssh -vvv"` options and I got whit this.

Block #1 Build the docker images with bitbucket pipeline. [Result : no code inside app]

debug2: channel 0: window 853335 sent adjust 8192
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug3: receive packet: type 96
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug3: receive packet: type 97
debug2: channel 0: rcvd close
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug3: channel 0: will not send data after close
debug3: channel 0: will not send data after close
 

Block #2  Build the docker images in my laptop. [Result: code is already clone to app]

#18 32.43 debug2: channel 0: window 1966080 sent adjust 131072
#18 32.45 debug3: receive packet: type 98
#18 32.45 debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
#18 32.45 debug3: receive packet: type 96
#18 32.45 debug2: channel 0: rcvd eof
#18 32.45 debug2: channel 0: output open -> drain
#18 32.45 debug3: receive packet: type 97
#18 32.45 debug2: channel 0: rcvd close
#18 32.45 debug2: channel 0: close_read
#18 32.45 debug2: channel 0: input open -> closed
#18 32.45 debug3: channel 0: will not send data after close
#18 32.45 debug3: channel 0: will not send data after close
#18 32.45 debug2: channel 0: obuf empty
#18 32.45 debug2: channel 0: close_write
#18 32.45 debug2: channel 0: output drain -> closed
#18 32.45 debug2: channel 0: almost dead
#18 32.45 debug2: channel 0: gc: notify user
#18 32.45 debug2: channel 0: gc: user detached
#18 32.45 debug2: channel 0: send close
#18 32.45 debug3: send packet: type 97
#18 32.45 debug2: channel 0: is dead
#18 32.45 debug2: channel 0: garbage collecting
#18 32.45 debug1: channel 0: free: client-session, nchannels 1
#18 32.45 debug3: channel 0: status: The following connections are open:
#18 32.45 #0 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cc -1)

Could please help me.

2 answers

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 20, 2021

Hi @Chatree Kunjai,

You mention that you tried to debug the issue by adding GIT_TRACE=true GIT_SSH_COMMAND="ssh -vvv" in the clone command. Could you please share the full output of the clone command with these flags, when you build the Dockerfile in Pipelines? Please sanitize any sensitive/private info from the output prior to sharing it here. The part of the output you have shared doesn't show any indication of why the clone is failing, so it would be good to check the full output.

How have you set up SSH authentication to clone the repo project/example-repo?

Kind regards,
Theodora

Chatree Kunjai October 20, 2021

Hi @Theodora Boudale ,

Thank you for your reply. I already attach the link to download the debug log that happen when git try to clone the code to docker images.

pipelineLog.txt 

About the SSH key authentication, I already add to my repository. That's why I can pull the code to docker images when I build the docker images on my laptop.

 

Regards.

Chatree.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 22, 2021

Hi Chatree,

Thank you for your reply and info. I checked the Pipelines log that you attached in your reply but I cannot see any indication on why this would fail. SSH authentication seems to succeed and I don't see any errors being reported. I see in that log that you're cloning into /var/www/html and that's a different directory than the one mentioned in your post, have you been testing this with different directories, and if so, have you checked the contents of /var/www/html?

In order to further troubleshoot this, we'd need to know some more details, like
1. Whether the SSH key pair you use for authentication is committed in the source code of the repo
2. The Dockerfile, so we can see what image your Docker image is based on and what commands are running to assemble the image
so we can try to reproduce and see if that's an issue with configuration or an issue with Pipelines. Otherwise, the attempt to reproduce will be based on guessing, and we might test something completely different than what you're doing.

I can see that your Bitbucket Cloud account is an admin of a workspace on a paid billing plan, so if you don't feel comfortable sharing the above info here publicly, I can create a support ticket for you for this issue. The support ticket will be visible only to you and Atlassian staff, so you can share there the URL of the Pipelines build with this issue and we can further investigate. You can also create the support ticket yourself via https://support.atlassian.com/contact/#/, in 'What can we help you with?' select 'Technical issues and bugs' and then Bitbucket Cloud as product. However, please feel free to let me know if you prefer me to create it for you.

Kind regards,
Theodora

0 votes
Chatree Kunjai October 17, 2021

..

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events