Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packer: initial packer configuration to build virtualbox/vagrant boxes #5828

Merged
merged 2 commits into from
Oct 13, 2016

Conversation

cgundogan
Copy link
Member

Packer [1] is a tool to build virtual machine boxes from configuration files.
This initial configuration builds a minimal virtualbox image based on ubuntu server 16.04, which includes all necessary toolchains et cetera to build&flash RIOT applications. For now, this box is uploaded into hashicorps cloud [2], but that's not a hard dependency.
Having all those tools baked into the image allows a simpler distribution of that image in scenarios like tutorials held in locations with bad internet connectivity / low bandwidth. In these scenarios, copying the base image (e.g. via usb) and adding it manually via vagrant box add RIOT-VM <path to box> is sufficient and does not require a provisioning from vagrant anymore (i.e. no internet access required).

The base image can be generated with packer build -var 'vagrant_token=<token>' -var 'box_version=<version>' riot.json. This command also uploads the image to the RIOT user that I created at hashicorps cloud, hence the necessary token. (Currently with my private mail address, but I will change it to something more generic: riot-os mail?).

@kaspar030 the configuration can be extended to support multiple ubuntu versions and also different OS'es. This might be interesting for murdock to run tests on multiple taget systems.

@kaspar030 To make everything simpler, would it be possible to build a small script for murdock that checks whether a PR contains packer configuration changes, so that a merge of such changes would re-build all virtual machine images + upload them to the cloud?

PS: to skip the upload to vagrant cloud step, just remove the vagrant-cloud post-processor in the riot.json file, this way, a vagrant box can be built without specifying a token and a version: packer build riot.json.

[1] https://www.packer.io/
[2] https://atlas.hashicorp.com/RIOT

@cgundogan cgundogan added Type: new feature The issue requests / The PR implemements a new feature for RIOT Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR Area: tools Area: Supplementary tools labels Sep 6, 2016
@miri64
Copy link
Member

miri64 commented Sep 6, 2016

@kaspar030 the configuration can be extended to support multiple ubuntu versions and also different OS'es. This might be interesting for murdock to run tests on multiple taget systems.

Does this mean this is a step into the direction for fixing #5201?

@cgundogan
Copy link
Member Author

Does this mean this is a step into the direction for fixing #5201?

yes it certainly appears that way (:

@smlng
Copy link
Member

smlng commented Sep 6, 2016

@cgundogan I know its the initial commit, but it would be great to have a (short) README stating how to run packer to build the box and which steps it is roughly doing. I remember one has to download packer and feed the config json into it; thats it?!

Otherwise, I already confirmed that it is working as intended -> ACK from my side! Very nice tool chain, great job!

@cgundogan cgundogan force-pushed the pr/packer branch 3 times, most recently from 2a6abc9 to 8e8a2fb Compare October 12, 2016 11:31
@PeterKietzmann
Copy link
Member

This is great! I've tested the online image on a linux machine. Then I built my own image with packer and used that one under linux and windows. Everything worked fine!

@smlng did you try on your mac?

I'm wondering if we should skip the upload to vagrant cloud step by default. What do you think? A readme would be great but I can reate it in a follow up PR.

@PeterKietzmann PeterKietzmann added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Oct 13, 2016
Copy link
Member

@smlng smlng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cgundogan I agree with @PeterKietzmann, uploading to vagrant cloud shouldn't be part of the packer (default) process. It should simply create a box according to the recipe, if we want the CI/Murdock to generate and upload a new box the latter step should be done separately - maybe even manually on success. Otherwise this looks (very) good indeed ...

@cgundogan
Copy link
Member Author

@PeterKietzmann @smlng okay, I removed the uploading post-processor.

@miri64 miri64 added this to the Release 2016.10 milestone Oct 13, 2016
@kaspar030 kaspar030 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Oct 13, 2016
@PeterKietzmann PeterKietzmann removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Oct 13, 2016
@PeterKietzmann
Copy link
Member

I just realized that this won't be build by Murdock anyway so let's merge as is. Tested ACK and go

@PeterKietzmann PeterKietzmann merged commit b15115c into RIOT-OS:master Oct 13, 2016
@cgundogan cgundogan deleted the pr/packer branch October 13, 2016 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: tools Area: Supplementary tools Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants