Packer build failed to use git clone

40 views
Skip to first unread message

Sim

unread,
Mar 19, 2018, 7:19:56 PM3/19/18
to Packer
I want to clone a repository from the bitbucket into the temporary VM which is generated during Packer build in order to run some scripts in that repo. However, it failed to run git clone that repository without throwing any errors or useful info (it just didn't work as later it could not find the path of the repo), even though I have installed the Git before. 

Just wondering if anyone knows any best way to clone a repository from bitbucket to get the repository in Packer temp VM? My temporary solution is to zip the required repository, transfer the zip folder to Packer and unzip it to the right path, but this is really not ideal as we need to constantly zip the repo whenever someone makes any changes in there. 

Thanks.

Sim

unread,
Mar 19, 2018, 7:21:40 PM3/19/18
to Packer
p/s I was running Packer for Azure 

Alvaro Miranda Aguilera

unread,
Mar 20, 2018, 3:07:17 AM3/20/18
to packe...@googlegroups.com
you can spin a VM manually, ssh into as you would do with packer and run either the script or commands.

as long there is internet connectivity and the access is in place the clone should work.


Having a zip or any other intermediate step feels like a workaround more than a fix and you are creating state, ie a zip file that may not be always up to date.


Learn what are the requirements to clone by an script and make that part of your build pipeline

if you access your repo over http, then check the format and user/pass needed

can be something lile https://user:password@server/path

if you clone as ssh:// or git:// then a private key may be needed.


Spin a VM manually get the clone working by command line then work in to have this scripted.

Packer in this case is just creating the VM and running your script.



Alvaro.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/a765c843-f909-416c-b9e5-49f643f94371%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Rickard von Essen

unread,
Mar 20, 2018, 7:54:43 AM3/20/18
to packe...@googlegroups.com
Most likely this is a simple scripting error. If you provide your script and the error message maybe we can point out what's wrong.

Reply all
Reply to author
Forward
0 new messages