Dependency issues when building packer

161 views
Skip to first unread message

David Arroyo

unread,
Jun 2, 2015, 9:25:36 PM6/2/15
to packe...@googlegroups.com
Hello,

Until a new release of packer is built, I want to backport certain features to the latest packer release, 0.7.5. Unfortunately that release is quite old and many of its external dependencies have changed their APIs. Running `make` gives several errors, such as

# github.com/mitchellh/packer/builder/googlecompute
builder/googlecompute/driver_gce.go:26: undefined: oauth2.Options
builder/googlecompute/driver_gce.go:36: undefined: oauth2.New
builder/googlecompute/driver_gce.go:37: undefined: oauth2.JWTClient
builder/googlecompute/driver_gce.go:38: undefined: oauth2.Scope
builder/googlecompute/driver_gce.go:39: undefined: google.JWTEndpoint
builder/googlecompute/driver_gce.go:43: undefined: oauth2.New
builder/googlecompute/driver_gce.go:43: undefined: google.ComputeEngineAccount
...
post-processor/atlas/post-processor.go:160: unknown atlas.UploadArtifactOpts field 'BuildId' in struct literal

It appears ‘master’ has kept up with these API changes, however I want to stick to the last stable release of packer.

Is there anywhere I can find what versions of each external dependency packer 0.7.5 was built with?

-David

Alvaro Miranda Aguilera

unread,
Jun 2, 2015, 10:06:45 PM6/2/15
to packe...@googlegroups.com
maybe a zip in the resource page ?

that should be point in time

https://github.com/mitchellh/packer/releases
> --
> 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...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

David Arroyo

unread,
Jun 3, 2015, 12:00:45 AM6/3/15
to packe...@googlegroups.com
On Jun 2, 2015, at 10:06 PM, Alvaro Miranda Aguilera <kik...@gmail.com> wrote:

> maybe a zip in the resource page ?
>
> that should be point in time
>
> https://github.com/mitchellh/packer/releases
>

Unless I’m missing something, that does not help with the dependencies that are not part of the packer repo. To name a few,

golang.org/x/oauth2
github.com/hashicorp/atlas-go
google.golang.org/appengine

I cannot patch+compile packer v0.7.5 without tracking down compatible versions of each of these libraries.

-David

Chris Bednarski

unread,
Jun 3, 2015, 3:36:24 AM6/3/15
to packe...@googlegroups.com
Hi David,

We don't use any dependency locking or vendoring, so it's going to be tricky to do this. We can make a point to improve this in the next release.

We're working through bugs and adding tests on the way to 0.8.0, so if you are using master and encounter problems it would be great to get your feedback on that. Is there anything in particular that's preventing you from using master today?

-Chris


-David

David Arroyo

unread,
Jun 3, 2015, 8:18:32 PM6/3/15
to packe...@googlegroups.com
Hi Chris,

Thanks for the info. We’ve developed quite few packer templates that we use to build development and production images, and found they did not work when building packer from master. For instance, given a simple template such as 

{
 "variables": {
   "truthy": "true"
 },
 "builders": [
   {
     "type": "null",
     "host": "127.0.0.1",
     "ssh_username": "{{ user `truthy` }}",
     "ssh_password": "foobar"
   }
 ],
 "provisioners": [
   {
     "type": "shell",
     "inline": "/bin/true"
   }
 ]
}

packer from master validate returns "variable truthy: '' expected type 'string', got unconvertible type ‘bool’”, where it cast the bool to a string in 0.7.5. Upon changing “truthy” to a string, we get `unknown user var: truthy`. There may be something wrong in how we’re writing the template, and refusing to cast bools to strings may be more “correct” behavior, but the fact is our templates work for 0.7.5, and I don’t want to port our templates to “master”, which is a moving target.

I was able to build packer 0.7.5 with minimal changes, by the way, with minimal changes to the build system (I had to disable the automatic dependency fetching). I can post instructions if there is any interest.

-David

Chris Trott

unread,
Jun 7, 2015, 1:36:06 PM6/7/15
to packe...@googlegroups.com


On Wednesday, June 3, 2015 at 8:18:32 PM UTC-4, David Arroyo wrote:
Hi Chris,

Thanks for the info. We’ve developed quite few packer templates that we use to build development and production images, and found they did not work when building packer from master. For instance, given a simple template such as 

{
 "variables": {
   "truthy": "true"
 },
 "builders": [
   {
     "type": "null",
     "host": "127.0.0.1",
     "ssh_username": "{{ user `truthy` }}",
     "ssh_password": "foobar"
   }
 ],
 "provisioners": [
   {
     "type": "shell",
     "inline": "/bin/true"
   }
 ]
}

packer from master validate returns "variable truthy: '' expected type 'string', got unconvertible type ‘bool’”, where it cast the bool to a string in 0.7.5. Upon changing “truthy” to a string, we get `unknown user var: truthy`. There may be something wrong in how we’re writing the template, and refusing to cast bools to strings may be more “correct” behavior, but the fact is our templates work for 0.7.5, and I don’t want to port our templates to “master”, which is a moving target.

I was able to build packer 0.7.5 with minimal changes, by the way, with minimal changes to the build system (I had to disable the automatic dependency fetching). I can post instructions if there is any interest.

David,

I'm interested. Please share how you were able to build 0.7.5. I'm attempting to do that as well.

David Arroyo

unread,
Jun 19, 2015, 1:43:06 PM6/19/15
to packe...@googlegroups.com
Hi Chris,

I’ve vendored all of packer 0.7.5’s dependencies 
at the appropriate versions here:


To build, checkout the v0.7.5-vendored branch to 
$GOPATH/src/github.com/mitchellh/packer and run 
the following:

GOPATH=`pwd`/_vendor:$GOPATH make dev

The packages that gave me trouble were 

However, I included the rest for completeness. Let me 
know if this helps you. 

Cheers,
David

Chris Trott

unread,
Jun 22, 2015, 12:07:12 AM6/22/15
to packe...@googlegroups.com
David,

This helped very much. I needed to make a small change to the openstack builder, but compiling from master was causing a lot of other issues. I'm all set now. Thank you!

Chris
Reply all
Reply to author
Forward
0 new messages