While building packer images, is it possible to create image names with the timestamp extending upto milliseconds with isotime
?
From [2.] we use the format to get -HHMM (-1504). I have tested this to extend to -HHMMSS (-150405) which works, but the format (-150405000) translates to ZZCI - Ubuntu 16.04 - docker - 20180522-082218000
. Is this format supported?
[1.] https://golang.org/pkg/time/#example_Time_Format
[2.] https://github.com/opendaylight/releng-builder/blob/master/packer/templates/devstack-pre-pip-ocata.json#L26
Looking at the documentation you linked, you need a .
before the milliseconds. The following works for me:
"ami_name": "packer-isotime-test_{{isotime \"20060102-150405.000\"}}",
In the future this kind of question is best sent to the mailing list (https://groups.google.com/forum/#!forum/packer-tool) :)
As suggested, tried using a period .
as follows with packer version 1.2.4 ...
"image_name": "ZZCI - {{user `distro`}} - docker - {{isotime \"20060102-150405.000\"}}",
But this returns the following error:
==> vexxhost: Error waiting for server (87d9c879-8498-4365-b3be-fd27c5fd85f6) to become ready: unexpected state 'ERROR', wanted target '[ACTIVE]'
==> vexxhost: Terminating the source server: 87d9c879-8498-4365-b3be-fd27c5fd85f6 ...
==> vexxhost: Deleting temporary keypair: packer_5b1263b1-0bcc-9094-1b8e-ccf8dc5257bc ...
Build 'vexxhost' errored: Error waiting for server (87d9c879-8498-4365-b3be-fd27c5fd85f6) to become ready: unexpected state 'ERROR', wanted target '[ACTIVE]'
==> Some builds didn't complete successfully and had errors:
--> vexxhost: Error waiting for server (87d9c879-8498-4365-b3be-fd27c5fd85f6) to become ready: unexpected state 'ERROR', wanted target '[ACTIVE]'
Is this a known issue with the latest version?
@askb
This is an OpenStack issue as we stand. It seems like it tries to parse that as a hostname, and then the parsing mechanism fails when the VM goes up. This should either be failing early in the API layer or not failing in the compute layer. I'll update this issue upstream.
Upstream bug: https://bugs.launchpad.net/nova/+bug/1581977
It looks like this is not something that can easily be addressed upstream, so I recommend using the following option to have a more sane instance name:
https://www.packer.io/docs/builders/openstack.html#instance_name
thanks @mnaser. Using the instance_name
as a workaround resolved our issue.
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.