From: Michael Marchetti Date: Thu, 2 Aug 2018 15:15:48 +0000 (+0200) Subject: Add packer script for devops pipelines X-Git-Tag: BUILD_v4.0.1_1~1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F92%2F6392%2F1;p=osm%2Fdevops.git Add packer script for devops pipelines Change-Id: Ib72d108f5fa9cf60d2f50575b38fbf2ab8506017 Signed-off-by: Michael Marchetti --- diff --git a/packer/scripts/vimemu.sh b/packer/scripts/vimemu.sh index 6beb79b8..cd47497a 100755 --- a/packer/scripts/vimemu.sh +++ b/packer/scripts/vimemu.sh @@ -16,7 +16,7 @@ while true; do sleep 2 done echo "OSM is up" -sleep 10 +sleep 10 export VIMEMU_HOSTNAME=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vim-emu) osm vim-create --name vim-emulator --user username --password password --auth_url http://$VIMEMU_HOSTNAME:6001/v2.0 --tenant tenantName --account_type openstack osm vnfd-create /home/vagrant/vim-emu/examples/vnfs/ping.tar.gz @@ -46,4 +46,4 @@ StandardOutput=journal+console WantedBy=multi-user.target EOF -#systemctl enable osm-vimemu-setup.service +systemctl enable osm-vimemu-setup.service diff --git a/packer/ubuntu1604-ovf-osm-dev.json b/packer/ubuntu1604-ovf-osm-dev.json new file mode 100644 index 00000000..2df566ee --- /dev/null +++ b/packer/ubuntu1604-ovf-osm-dev.json @@ -0,0 +1,63 @@ +{ + "provisioners": [ + { + "type": "shell", + "script": "scripts/get-install-osm.sh", + "execute_command": "{{.Path}} {{user `osm_install_options`}}" + }, + { + "type": "shell", + "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'", + "script": "scripts/vimemu.sh" + }, + { + "type": "shell", + "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'", + "script": "scripts/cleanup.sh" + } + ], + "variables": { + "osm_install_options": "--vimemu", + "input_ovf": "output-virtualbox-iso/packer-ubuntu-16.04-amd64-juju.ovf", + "vm_name": "xenial-osm", + "build_dir": "osm-{{timestamp}}" + }, + "builders": [ + { + "type": "virtualbox-ovf", + "source_path": "{{user `input_ovf`}}", + "headless": true, + "ssh_username": "vagrant", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_wait_timeout": "10000s", + "shutdown_command": "echo 'vagrant'|sudo -S shutdown -P now", + "virtualbox_version_file": ".vbox_version", + "vm_name": "{{user `vm_name`}}", + "output_directory": "{{user `build_dir`}}", + "vboxmanage": [ + [ + "modifyvm", + "{{.Name}}", + "--memory", + "4096" + ], + [ + "modifyvm", + "{{.Name}}", + "--cpus", + "2" + ] + ] + } + ], + "post-processors": [ + [ + { + "output": "{{user `build_dir`}}/{{.Provider}}-osm.box", + "type": "vagrant", + "keep_input_artifact": true + } + ] + ] +}