-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transforming to new form after migration from http://github.com/mishe…
- Loading branch information
Mischa Taylor
committed
May 13, 2014
1 parent
42efec9
commit 2d6f8d8
Showing
16 changed files
with
332 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
packer_cache/ | ||
output-* | ||
*.box | ||
*.tar.gz | ||
iso | ||
crash.log | ||
tmp | ||
.vagrant/ | ||
*.swp | ||
Makefile.local | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
# if Makefile.local exists, include it | ||
ifneq ("$(wildcard Makefile.local)", "") | ||
include Makefile.local | ||
endif | ||
|
||
DEBIAN75_AMD64 ?= http://cdimage.debian.org/cdimage/release/7.5.0/amd64/iso-dvd/debian-7.5.0-amd64-DVD-1.iso | ||
DEBIAN74_AMD64 ?= http://cdimage.debian.org/cdimage/archive/7.4.0/amd64/iso-dvd/debian-7.4.0-amd64-DVD-1.iso | ||
DEBIAN73_AMD64 ?= http://cdimage.debian.org/cdimage/archive/7.3.0/amd64/iso-dvd/debian-7.3.0-amd64-DVD-1.iso | ||
DEBIAN609_AMD64 ?= http://cdimage.debian.org/cdimage/archive/6.0.9/amd64/iso-cd/debian-6.0.9-amd64-CD-1.iso | ||
DEBIAN75_I386 ?= http://cdimage.debian.org/cdimage/release/7.5.0/i386/iso-dvd/debian-7.5.0-i386-DVD-1.iso | ||
DEBIAN74_I386 ?= http://cdimage.debian.org/cdimage/archive/7.4.0/i386/iso-dvd/debian-7.4.0-i386-DVD-1.iso | ||
DEBIAN73_I386 ?= http://cdimage.debian.org/cdimage/archive/7.3.0/i386/iso-dvd/debian-7.3.0-i386-DVD-1.iso | ||
DEBIAN609_I386 ?= http://cdimage.debian.org/cdimage/archive/6.0.9/i386/iso-cd/debian-6.0.9-i386-CD-1.iso | ||
|
||
# Possible values for CM: (nocm | chef | chefdk | salt | puppet) | ||
CM ?= nocm | ||
# Possible values for CM_VERSION: (latest | x.y.z | x.y) | ||
CM_VERSION ?= | ||
ifndef CM_VERSION | ||
ifneq ($(CM),nocm) | ||
CM_VERSION = latest | ||
endif | ||
endif | ||
# Packer does not allow empty variables, so only pass variables that are defined | ||
ifdef CM_VERSION | ||
PACKER_VARS := -var 'cm=$(CM)' -var 'cm_version=$(CM_VERSION)' | ||
else | ||
PACKER_VARS := -var 'cm=$(CM)' | ||
endif | ||
ifeq ($(CM),nocm) | ||
BOX_SUFFIX := -$(CM).box | ||
else | ||
BOX_SUFFIX := -$(CM)$(CM_VERSION).box | ||
endif | ||
BUILDER_TYPES := vmware virtualbox | ||
TEMPLATE_FILENAMES := $(wildcard *.json) | ||
BOX_FILENAMES := $(TEMPLATE_FILENAMES:.json=$(BOX_SUFFIX)) | ||
BOX_FILES := $(foreach builder, $(BUILDER_TYPES), $(foreach box_filename, $(BOX_FILENAMES), box/$(builder)/$(box_filename))) | ||
TEST_BOX_FILES := $(foreach builder, $(BUILDER_TYPES), $(foreach box_filename, $(BOX_FILENAMES), test-box/$(builder)/$(box_filename))) | ||
VMWARE_BOX_DIR := box/vmware | ||
VIRTUALBOX_BOX_DIR := box/virtualbox | ||
VMWARE_OUTPUT := output-vmware-iso | ||
VIRTUALBOX_OUTPUT := output-virtualbox-iso | ||
VMWARE_BUILDER := vmware-iso | ||
VIRTUALBOX_BUILDER := virtualbox-iso | ||
CURRENT_DIR = $(shell pwd) | ||
|
||
.PHONY: all list clean | ||
|
||
all: $(BOX_FILES) | ||
|
||
test: $(TEST_BOX_FILES) | ||
|
||
# Generic rule - not used currently | ||
#$(VMWARE_BOX_DIR)/%$(BOX_SUFFIX): %.json | ||
# cd $(dir $<) | ||
# rm -rf output-vmware-iso | ||
# mkdir -p $(VMWARE_BOX_DIR) | ||
# packer build -only=vmware-iso $(PACKER_VARS) $< | ||
|
||
$(VMWARE_BOX_DIR)/debian75$(BOX_SUFFIX): debian75.json | ||
rm -rf $(VMWARE_OUTPUT) | ||
mkdir -p $(VMWARE_BOX_DIR) | ||
packer build -only=$(VMWARE_BUILDER) $(PACKER_VARS) -var "iso_url=$(DEBIAN75_AMD64)" $< | ||
|
||
$(VMWARE_BOX_DIR)/debian74$(BOX_SUFFIX): debian74.json | ||
rm -rf $(VMWARE_OUTPUT) | ||
mkdir -p $(VMWARE_BOX_DIR) | ||
packer build -only=$(VMWARE_BUILDER) $(PACKER_VARS) -var "iso_url=$(DEBIAN74_AMD64)" $< | ||
|
||
$(VMWARE_BOX_DIR)/debian73$(BOX_SUFFIX): debian73.json | ||
rm -rf $(VMWARE_OUTPUT) | ||
mkdir -p $(VMWARE_BOX_DIR) | ||
packer build -only=$(VMWARE_BUILDER) $(PACKER_VARS) -var "iso_url=$(DEBIAN73_AMD64)" $< | ||
|
||
$(VMWARE_BOX_DIR)/debian609$(BOX_SUFFIX): debian609.json | ||
rm -rf $(VMWARE_OUTPUT) | ||
mkdir -p $(VMWARE_BOX_DIR) | ||
packer build -only=$(VMWARE_BUILDER) $(PACKER_VARS) -var "iso_url=$(DEBIAN609_AMD64)" $< | ||
|
||
$(VMWARE_BOX_DIR)/debian75-i386$(BOX_SUFFIX): debian75-i386.json | ||
rm -rf $(VMWARE_OUTPUT) | ||
mkdir -p $(VMWARE_BOX_DIR) | ||
packer build -only=$(VMWARE_BUILDER) $(PACKER_VARS) -var "iso_url=$(DEBIAN75_I386)" $< | ||
|
||
$(VMWARE_BOX_DIR)/debian74-i386$(BOX_SUFFIX): debian74-i386.json | ||
rm -rf $(VMWARE_OUTPUT) | ||
mkdir -p $(VMWARE_BOX_DIR) | ||
packer build -only=$(VMWARE_BUILDER) $(PACKER_VARS) -var "iso_url=$(DEBIAN74_I386)" $< | ||
|
||
$(VMWARE_BOX_DIR)/debian73-i386$(BOX_SUFFIX): debian73-i386.json | ||
rm -rf $(VMWARE_OUTPUT) | ||
mkdir -p $(VMWARE_BOX_DIR) | ||
packer build -only=$(VMWARE_BUILDER) $(PACKER_VARS) -var "iso_url=$(DEBIAN73_I386)" $< | ||
|
||
$(VMWARE_BOX_DIR)/debian609-i386$(BOX_SUFFIX): debian609-i386.json | ||
rm -rf $(VMWARE_OUTPUT) | ||
mkdir -p $(VMWARE_BOX_DIR) | ||
packer build -only=$(VMWARE_BUILDER) $(PACKER_VARS) -var "iso_url=$(DEBIAN609_I386)" $< | ||
|
||
# Generic rule - not used currently | ||
#$(VIRTUALBOX_BOX_DIR)/%$(BOX_SUFFIX): %.json | ||
# cd $(dir $<) | ||
# rm -rf output-virtualbox-iso | ||
# mkdir -p $(VIRTUALBOX_BOX_DIR) | ||
# packer build -only=virtualbox-iso $(PACKER_VARS) $< | ||
|
||
$(VIRTUALBOX_BOX_DIR)/debian75$(BOX_SUFFIX): debian75.json | ||
rm -rf $(VIRTUALBOX_OUTPUT) | ||
mkdir -p $(VIRTUALBOX_BOX_DIR) | ||
packer build -only=$(VIRTUALBOX_BUILDER) $(PACKER_VARS) -var "iso_url=$(DEBIAN75_AMD64)" $< | ||
|
||
$(VIRTUALBOX_BOX_DIR)/debian74$(BOX_SUFFIX): debian74.json | ||
rm -rf $(VIRTUALBOX_OUTPUT) | ||
mkdir -p $(VIRTUALBOX_BOX_DIR) | ||
packer build -only=$(VIRTUALBOX_BUILDER) $(PACKER_VARS) -var "iso_url=$(DEBIAN74_AMD64)" $< | ||
|
||
$(VIRTUALBOX_BOX_DIR)/debian73$(BOX_SUFFIX): debian73.json | ||
rm -rf $(VIRTUALBOX_OUTPUT) | ||
mkdir -p $(VIRTUALBOX_BOX_DIR) | ||
packer build -only=$(VIRTUALBOX_BUILDER) $(PACKER_VARS) -var "iso_url=$(DEBIAN73_AMD64)" $< | ||
|
||
$(VIRTUALBOX_BOX_DIR)/debian609$(BOX_SUFFIX): debian609.json | ||
rm -rf $(VIRTUALBOX_OUTPUT) | ||
mkdir -p $(VIRTUALBOX_BOX_DIR) | ||
packer build -only=$(VIRTUALBOX_BUILDER) $(PACKER_VARS) -var "iso_url=$(DEBIAN609_AMD64)" $< | ||
|
||
$(VIRTUALBOX_BOX_DIR)/debian75-i386$(BOX_SUFFIX): debian75-i386.json | ||
rm -rf $(VIRTUALBOX_OUTPUT) | ||
mkdir -p $(VIRTUALBOX_BOX_DIR) | ||
packer build -only=$(VIRTUALBOX_BUILDER) $(PACKER_VARS) -var "iso_url=$(DEBIAN75_I386)" $< | ||
|
||
$(VIRTUALBOX_BOX_DIR)/debian74-i386$(BOX_SUFFIX): debian74-i386.json | ||
rm -rf $(VIRTUALBOX_OUTPUT) | ||
mkdir -p $(VIRTUALBOX_BOX_DIR) | ||
packer build -only=$(VIRTUALBOX_BUILDER) $(PACKER_VARS) -var "iso_url=$(DEBIAN74_I386)" $< | ||
|
||
$(VIRTUALBOX_BOX_DIR)/debian73-i386$(BOX_SUFFIX): debian73-i386.json | ||
rm -rf $(VIRTUALBOX_OUTPUT) | ||
mkdir -p $(VIRTUALBOX_BOX_DIR) | ||
packer build -only=$(VIRTUALBOX_BUILDER) $(PACKER_VARS) -var "iso_url=$(DEBIAN73_I386)" $< | ||
|
||
$(VIRTUALBOX_BOX_DIR)/debian609-i386$(BOX_SUFFIX): debian609-i386.json | ||
rm -rf $(VIRTUALBOX_OUTPUT) | ||
mkdir -p $(VIRTUALBOX_BOX_DIR) | ||
packer build -only=$(VIRTUALBOX_BUILDER) $(PACKER_VARS) -var "iso_url=$(DEBIAN609_I386)" $< | ||
|
||
list: | ||
@for box_file in $(BOX_FILES) ; do \ | ||
echo $$box_file ; \ | ||
done ; | ||
|
||
clean: clean-builders clean-output clean-packer-cache | ||
|
||
clean-builders: | ||
@for builder in $(BUILDER_TYPES) ; do \ | ||
if test -d box/$$builder ; then \ | ||
echo Deleting box/$$builder/*.box ; \ | ||
find box/$$builder -maxdepth 1 -type f -name "*.box" ! -name .gitignore -exec rm '{}' \; ; \ | ||
fi ; \ | ||
done | ||
|
||
clean-output: | ||
@for builder in $(BUILDER_TYPES) ; do \ | ||
echo Deleting output-$$builder-iso ; \ | ||
echo rm -rf output-$$builder-iso ; \ | ||
done | ||
|
||
clean-packer-cache: | ||
echo Deleting packer_cache | ||
rm -rf packer_cache | ||
|
||
test-$(VMWARE_BOX_DIR)/%$(BOX_SUFFIX): $(VMWARE_BOX_DIR)/%$(BOX_SUFFIX) | ||
bin/test-box.sh $< vmware_desktop vmware_fusion $(CURRENT_DIR)/test/*_spec.rb | ||
|
||
test-$(VIRTUALBOX_BOX_DIR)/%$(BOX_SUFFIX): $(VIRTUALBOX_BOX_DIR)/%$(BOX_SUFFIX) | ||
bin/test-box.sh $< virtualbox virtualbox $(CURRENT_DIR)/test/*_spec.rb | ||
|
||
ssh-$(VMWARE_BOX_DIR)/%$(BOX_SUFFIX): $(VMWARE_BOX_DIR)/%$(BOX_SUFFIX) | ||
bin/ssh-box.sh $< vmware_desktop vmware_fusion $(CURRENT_DIR)/test/*_spec.rb | ||
|
||
ssh-$(VIRTUALBOX_BOX_DIR)/%$(BOX_SUFFIX): $(VIRTUALBOX_BOX_DIR)/%$(BOX_SUFFIX) | ||
bin/ssh-box.sh $< virtualbox virtualbox $(CURRENT_DIR)/test/*_spec.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash -eux | ||
|
||
box_path=$1 | ||
box_provider=$2 | ||
vagrant_provider=$3 | ||
|
||
box_filename=$(basename "${box_path}") | ||
box_name=${box_filename%.*} | ||
tmp_path=/tmp/boxtest | ||
|
||
rm -rf ${tmp_path} | ||
|
||
vagrant box remove ${box_name} --provider ${box_provider} || true | ||
vagrant box add ${box_name} ${box_path} | ||
mkdir -p ${tmp_path} | ||
|
||
pushd ${tmp_path} | ||
vagrant init ${box_name} | ||
VAGRANT_LOG=warn vagrant up --provider ${vagrant_provider} | ||
vagrant ssh | ||
vagrant destroy -f | ||
popd | ||
|
||
vagrant box remove ${box_name} --provider ${box_provider} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash -eux | ||
|
||
create_vagrantfile_linux() { | ||
cat << EOF > $tmp_path/Vagrantfile | ||
Vagrant.configure('2') do |config| | ||
config.vm.box = '$box_name' | ||
config.vm.provision :serverspec do |spec| | ||
spec.pattern = '$test_src_path' | ||
end | ||
end | ||
EOF | ||
} | ||
|
||
cleanup() { | ||
rm -f ~/.ssh/known_hosts | ||
} | ||
|
||
box_path=$1 | ||
box_provider=$2 | ||
vagrant_provider=$3 | ||
test_src_path=$4 | ||
|
||
box_filename=$(basename "${box_path}") | ||
box_name=${box_filename%.*} | ||
tmp_path=/tmp/boxtest | ||
|
||
rm -rf ${tmp_path} | ||
|
||
vagrant box remove ${box_name} --provider ${box_provider} 2>/dev/null || true | ||
vagrant box add ${box_name} ${box_path} | ||
mkdir -p ${tmp_path} | ||
|
||
pushd ${tmp_path} | ||
create_vagrantfile_linux | ||
cleanup | ||
VAGRANT_LOG=warn vagrant up --provider ${vagrant_provider} | ||
sleep 10 | ||
vagrant destroy -f | ||
popd | ||
|
||
vagrant box remove ${box_name} --provider ${box_provider} | ||
cleanup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.