From c272ed47cfd4e77581a37bdd582798378a6566db Mon Sep 17 00:00:00 2001 From: Stephen Lauck Date: Fri, 3 Aug 2018 18:23:47 -0400 Subject: [PATCH] update settings in kitchen for windows vm --- .kitchen.yml | 5 ++++- README.md | 15 ++++++++++----- habitat/plan.ps1 | 29 ++++++++++++++++++++++------- recipes/default.rb | 16 ++++++++-------- 4 files changed, 44 insertions(+), 21 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 3ac8e47..15ec351 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -2,7 +2,7 @@ driver: name: vagrant synced_folders: - - ["./", "/tmp/package"] + - ["./", "/habitat/package"] provisioner: name: chef_zero @@ -14,6 +14,9 @@ platforms: - name: windows-2016 driver_config: box: mwrock/Windows2016 + customize: + memory: 2048 + cpus: 4 suites: diff --git a/README.md b/README.md index d81bcc3..5b392ff 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,7 @@ Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) choco install habitat -y ``` -1. Setup habitat - `hab setup` 1. Create working directory for building your application ``` @@ -19,18 +17,25 @@ cd packer ``` +1. Setup habitat + + `hab setup` + + You will have to set up your origin and keys following [this guide ](https://www.habitat.sh/docs/using-builder/) + 1. Initialize plan for the application build - `hab plan init` + `hab plan init -w` 1. Launch windows based studio VM. We want a 'clean throwaway environment' to build in AND want to avoid using Docker. ``` + kitchen list kitchen converge - kitchen login ``` ### On the Windows Studio VM +1. Log into the Windows VM (vagrant/vagrant) 1. Change to the mounted habitat directory `cd /tmp/package` @@ -38,7 +43,7 @@ 1. You can either build your app on the VM OR use the habitat studio on the VM (what's the difference?) ``` - hab studio enter + hab studio enter - ``` ### In the Habitat Studio (on the VM) diff --git a/habitat/plan.ps1 b/habitat/plan.ps1 index cc6691c..7a7ad50 100644 --- a/habitat/plan.ps1 +++ b/habitat/plan.ps1 @@ -1,16 +1,15 @@ -$pkg_name="windows-habitat-no-docker" +$pkg_name="vscode" $pkg_origin="lauck" -$pkg_version="0.1.0" +$pkg_version="1.25.1" $pkg_maintainer="The Habitat Maintainers " -$pkg_license=@("Apache-2.0") -$pkg_source="http://some_source_url/releases/${pkg_name}-${pkg_version}.zip" +$pkg_license=@("MIT") +$pkg_source="https://az764295.vo.msecnd.net/stable/1dfc5e557209371715f655691b1235b6b26a06be/VSCode-win32-x64-1.25.1.zip" # $pkg_filename="$pkg_name-$pkg_version.zip" -# $pkg_shasum="TODO" # $pkg_deps=@() -# $pkg_build_deps=@() + # $pkg_lib_dirs=@("lib") # $pkg_include_dirs=@("include") -# $pkg_bin_dirs=@("bin") + # $pkg_svc_run="MyBinary.exe" # $pkg_exports=@{ # host="srv.address" @@ -26,3 +25,19 @@ $pkg_source="http://some_source_url/releases/${pkg_name}-${pkg_version}.zip" # } # $pkg_description="Some description." # $pkg_upstream_url="http://example.com/project-name" + +$pkg_shasum="aa920ae1b7e8861dcf13a93077206e30de48ea245f0b30bd3ddbea496df16102" +$pkg_build_deps = @("core/7zip") +$pkg_bin_dirs=@("bin") + +function Invoke-Unpack { + Push-Location (Resolve-Path $HAB_CACHE_SRC_PATH).Path + Try { + 7z x -y -o"$pkg_dirname" (Resolve-Path $HAB_CACHE_SRC_PATH/$pkg_filename).Path + } + Finally { Pop-Location } +} + +function Invoke-Install { + Copy-Item * "$pkg_prefix/bin" -Recurse -Force +} diff --git a/recipes/default.rb b/recipes/default.rb index c961ff7..ed82ce0 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -6,16 +6,16 @@ include_recipe 'chocolatey::default' -%w( habitat ).each do |pkg| +%w( habitat git googlechrome vscode ).each do |pkg| chocolatey_package pkg do action :install end end -powershell_script 'habitat build' do - cwd '/tmp/package/habitat' - code <<-EOH - $env:PATH += ";C:\habitat" - hab pkg build --windows - EOH -end +# powershell_script 'habitat build' do +# cwd '/tmp/package/habitat' +# code <<-EOH +# $env:PATH += ";C:\habitat" +# hab pkg build --windows +# EOH +# end