$ cat examples/packer.yaml
model:
image: centos:7
pipeline:
- stage(Example):
- tasks(ordered):
- packer:
script: |
{
"builders": [{
"type": "docker",
"image": "{{ model.image }}",
"commit": true,
"changes": [
"LABEL pipeline={{ env.PIPELINE_PID }}",
"LABEL pipeline-stage={{ env.PIPELINE_STAGE }}"
]
}],
"provisioners": [{
"type": "shell",
"inline": [
"yum -y install python-setuptools",
"easy_install pip",
"pip install tox"
]
}],
"post-processors": [{
"type": "docker-tag",
"repository": "spline/packer/demo",
"tag": "0.1"
}]
}--
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/359c57a5-e8e5-4256-9354-54a2cf7cc26e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi,
I have an easy reproducable example for you:$ cat simple.json
{
"builders": [{
"type": "docker",
"image": "centos:7",
"export_path": "image.tar"
}]
}
The command packer build demo.json (as usual).
Now a small and simple Python setup:I hope it helps,
- Install tox with pip install tox. If you have Centos you can say: sudo yum -y install python-setuptools;sudo easy_install pip; sudo pip install tox
On Debian it's also easy: sudo apt-get install python pip;sudo pip install tox.- Now organize two have a setup.py (choose a folder demo or so).
$ cat setup.py
from setuptools import setup
setup(name='demo',
version='1.0',
description='demo',
long_description='demo',
author='Thomas Lehmann',
author_email='thomas.lehmann.pri...@gmail.com',
license="MIT",
install_requires=[],
packages=[],
url="https://github.com/Nachtfeuer/pipeline",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: Unix"
])- Now provide a tox.ini file in same folder
$ cat tox.ini
[testenv]
commands = \
packer build {toxinidir}/simple.json- Now just say "tox" and press enter:
$ tox
GLOB sdist-make: /tmp/demo/setup.py
python inst-nodeps: /tmp/demo/.tox/dist/demo-1.0.zip
python installed: demo==1.0
python runtests: PYTHONHASHSEED='3442765722'
python runtests: commands[0] | packer build /tmp/demo/simple.json
WARNING:test command found but not installed in testenv
cmd: /usr/local/bin/packer
env: /tmp/demo/.tox/python
Maybe you forgot to specify a dependency? See also the whitelist_externals envconfig setting.
docker output will be in this color.
==> docker: Creating a temporary directory for sharing data...
==> docker: Pulling Docker image: centos:7
docker: 7: Pulling from library/centos
docker: Digest: sha256:dcbc4e5e7052ea2306eed59563da1fec09196f2ecacbe042acbdcd2b44b05270
docker: Status: Image is up to date for centos:7
==> docker: Starting docker container...
docker: Run command: docker run -v ~/.packer.d/tmp/packer-docker717100724:/packer-files -d -i -t centos:7 /bin/bash
==> docker: Error running container: Docker exited with a non-zero exit status.
==> docker: Stderr: docker: Error response from daemon: create ~/.packer.d/tmp/packer-docker717100724: "~/.packer.d/tmp/packer-docker717100724" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
==> docker: See 'docker run --help'.
==> docker:
Build 'docker' errored: Error running container: Docker exited with a non-zero exit status.
Stderr: docker: Error response from daemon: create ~/.packer.d/tmp/packer-docker717100724: "~/.packer.d/tmp/packer-docker717100724" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
See 'docker run --help'.
==> Some builds didn't complete successfully and had errors:
--> docker: Error running container: Docker exited with a non-zero exit status.
Stderr: docker: Error response from daemon: create ~/.packer.d/tmp/packer-docker717100724: "~/.packer.d/tmp/packer-docker717100724" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
See 'docker run --help'.
==> Builds finished but no artifacts were created.
ERROR: InvocationError: '/usr/local/bin/packer build /tmp/demo/simple.json'
___________________________________________________ summary ____________________________________________________
ERROR: python: commands failed
regards,
Thomas
--
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/c06712fe-a5a5-4efe-b99a-7509e8a8e5af%40googlegroups.com.