Error using default Packer configs [Solved]


#1

Hi, I’ve been struggling with this issue and was hoping you guys could point me in the right direction. I just installed Spinnaker and am trying to use the default aws-multi-ebs.json packer config. However, it fails immediately, returning Unknown region: Pics below show the error and my current setup. Thanks!


#2

Error too because new users can only have one image in post 38%20PM


#3

I’m not overly familiar with the Amazon templates, but based on the error message it seems like somehow the checkbox in the UI is not properly setting your region. Can you try using the ‘Edit stage as JSON’ button to see what the value is of region in the JSON? (I’m interested in the top-level region, not the one in extended attributes, which I don’t think should be necessary.)


#4

Thanks for the quick response. The json looks as follows

{
  "appConfig": {},
  "executionEngine": "v2",
  "keepWaitingPipelines": false,
  "lastModifiedBy": "anonymous",
  "limitConcurrent": true,
  "parallel": true,
  "stages": [
    {
      "baseAmi": "ami-80861296",
      "baseLabel": "release",
      "baseOs": "xenial",
      "cloudProviderType": "aws",
      "extendedAttributes": {
        "Region": "'us-east-1'"
      },
      "name": "Bake AMI",
      "package": "git",
      "refId": "2",
      "region": "us-east-1",
      "regions": [
        "us-east-1"
      ],
      "requisiteStageRefIds": [],
      "storeType": "ebs",
      "type": "bake",
      "user": "[anonymous]",
      "vmType": "hvm"
    }
  ],
  "triggers": [],
  "updateTs": "1524606944000"
}

It appears region is set


#5

That looks correct to me, so I’m confused why “us-east-1” is not making it all the way to packer. A couple more things to check to figure out where things aren’t working:

grep 'api/v1.*bake' orca.log will show the calls to Rosco. The region should be in the URL path, so you should see api/v1/us-east-1/bake.

grep packer rosco.log should show the actual parameters passed to packer; here I’d expect to see -var region=us-east-1

(In both of the above, I haven’t included the full path to the logs as that depends on the installation you’ve set up.) With that info, hopefully we can figure out where along the code path the region is being dropped.


#6

So the region is making it to the API calls. From Orca log:

2018-04-24 21:55:58.837  INFO 23843 --- [/us-east-1/bake] c.n.s.orca.bakery.api.BakeryService      : [] ---> HTTP POST http://localhost:8087/api/v1/us-east-1/bake
2018-04-24 21:55:59.849  INFO 23843 --- [/us-east-1/bake] c.n.s.orca.bakery.api.BakeryService      : [] <--- HTTP 500 http://localhost:8087/api/v1/us-east-1/bake (1012ms)

And it looks like the region is in the packer call too

[packer, build, -color=false, -var, aws_region=us-east-1, -var, aws_instance_type=t2.medium, -var, aws_source_ami=ami-80861296, -var, aws_target_ami=git-all-20180424185532-xenial, -var, aws_ssh_username=ubuntu, -var, aws_associate_public_ip_address=true, -var, repository=http://dummy-repo trusty main, -var, package_type=deb, -var, packages=git, -var, configDir=/opt/rosco/config/packer/, -var, Region='us-east-1', /opt/rosco/config/packer//aws-multi-ebs.json]

#7

Interesting thing to note - the same command from my local machine also fails with unknown region:. This gives me the feeling it is either an issue with the template or packer


#9

Turns out the SPINNAKER_AWS_DEFAULT_REGION env var wasn’t set. Not exactly sure how its supposed be, whether through halyard or spinnaker itself. The fix was adding it to a file in /etc/default/spinnaker. Similar to this issue https://github.com/spinnaker/spinnaker/issues/1001


#10

Thanks for posting the eventual answer! I wasn’t aware of that environment variable, but looks like that’s the solution.