Skip to content

Commit

Permalink
Improve windows support of omnibus installer - fix #889
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Null Cating-Subramanian authored and chris-rock committed Aug 10, 2016
1 parent 3c389ac commit ce2b094
Show file tree
Hide file tree
Showing 19 changed files with 680 additions and 23 deletions.
1 change: 1 addition & 0 deletions omnibus/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ pkg/*
bin/*
files/**/cache/
vendor/cookbooks
Berksfile.lock
6 changes: 6 additions & 0 deletions omnibus/.kitchen.vmware.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
driver:
name: vagrant
provider: vmware_fusion
customize:
numvcpus: 4
memsize: 4096
80 changes: 67 additions & 13 deletions omnibus/.kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,89 @@ driver:
name: vagrant
forward_agent: yes
customize:
cpus: 2
memory: 2048
cpus: 4
memory: 4096
synced_folders:
- ['..', '/home/vagrant/inspec']
- ['../../omnibus', '/home/vagrant/omnibus']
- ['../../omnibus-software', '/home/vagrant/omnibus-software']

provisioner:
name: chef_zero
require_chef_omnibus: true
attributes:
vagrant:
this_key_exists_so_we_have_a_vagrant_key: true
omnibus:
build_user: vagrant
build_user_group: vagrant
build_user_password: vagrant
install_dir: /opt/inspec

platforms:
- name: centos-7.1
- name: centos-7.2
run_list: yum-epel::default
- name: centos-6.6
- name: centos-6.7
run_list: yum-epel::default
- name: debian-7.8
- name: debian-8.2
run_list: apt::default
- name: debian-6.0.10
- name: debian-7.9
run_list: apt::default
- name: ubuntu-14.04
run_list: apt::default
- name: ubuntu-12.04
run_list: apt::default
# The following (private) boxes are shared via Atlas and are only
# available to users working for Chef. Sorry, it's about software licensing.
#
# Chef-internal users, you will need to:
# 1. Create an Atlas account: https://atlas.hashicorp.com/
# 2. Ping #eng-services-support with your Atlas account name
# to be added to the relevant team in Atlas,
# 3. Do `vagrant login` with your Atlas creds so that you can download
# the private boxes.
#
# The Mac OS X boxes are VMware only also. You can enable VMware Fusion
# by activating the `.kitchen.vmware.yml` file with the `KITCHEN_LOCAL_YAML`
# environment variable:
#
# KITCHEN_LOCAL_YAML=.kitchen.vmware.yml kitchen converge inspec-macosx-109
#
<% %w(
10.9
10.10
10.11
).each do |mac_version| %>
- name: macosx-<%= mac_version %>
driver:
box: chef/macosx-<%= mac_version %> # private
synced_folders:
- ['..', '/Users/vagrant/chef']
- ['../../omnibus', '/Users/vagrant/omnibus']
- ['../../omnibus-software', '/Users/vagrant/omnibus-software']
<% end %>

# By adding an `i386` to the name the Omnibus cookbook's `load-omnibus-toolchain.bat`
# will load the 32-bit version of the MinGW toolchain.
<% [ '', '-i386' ].each do |win_suffix| %>
- name: windows-2012r2-standard<%= win_suffix %>
driver:
box: chef/windows-server-2012r2-standard # private
synced_folders:
# We have to mount this repos enclosing folder as the Omnibus build
# gets cranky if the mounted source folder is a symlink. This
# mounts at `C:\vagrant\code` and the inspec source folder is available
# at `C:\vagrant\code\inspec`
- ['../..', '/vagrant/code']
provisioner:
attributes:
omnibus:
build_user: vagrant
build_user_group: Administrators
build_user_password: vagrant
install_dir: /opscode/inspec
<% end %>

suites:
- name: default
- name: inspec
run_list: omnibus::default
attributes:
omnibus:
build_user: vagrant
build_user_group: vagrant
build_user_password: vagrant
install_dir: /opt/inspec
9 changes: 6 additions & 3 deletions omnibus/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
source 'https://rubygems.org'

# Install omnibus
gem 'omnibus', '~> 5.3'
# Sadly due to an ongoing msys2 issue, producing windows builds requires
# the two branches below.
gem 'omnibus', github: 'chef/omnibus', branch: 'ksubrama/gcc_investigate'

# Use Chef's software definitions. It is recommended that you write your own
# software definitions, but you can clone/fork Chef's to get you started.
gem 'omnibus-software', github: 'chef/omnibus-software'
gem 'omnibus-software', github: 'chef/omnibus-software', branch: 'ksubrama/ruby23'

# This development group is installed by default when you run `bundle install`,
# but if you are using Omnibus in a CI-based infrastructure, you do not need
Expand All @@ -17,6 +19,7 @@ group :development do
gem 'berkshelf', '~> 4.3'

# Use Test Kitchen with Vagrant for converging the build environment
gem 'test-kitchen', '~> 1.7'
gem 'test-kitchen', '~> 1.9'
gem 'kitchen-vagrant', '~> 0.19'
gem 'winrm-fs', '~> 0.4'
end
38 changes: 35 additions & 3 deletions omnibus/config/projects/inspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,53 @@
#

name 'inspec'
friendly_name 'InSpec'
maintainer 'Chef Software, Inc <maintainers@chef.io>'
homepage 'https://github.com/chef/inspec'

license 'Apache-2.0'
license_file '../LICENSE'

# Defaults to C:/inspec on Windows
# and /opt/inspec on all other platforms
install_dir "#{default_root}/#{name}"
# Defaults to C:/opscode/inspec on Windows
# and /opt/inspec on all other platforms.
if windows?
install_dir "#{default_root}/opscode/#{name}"
else
install_dir "#{default_root}/#{name}"
end

build_version Omnibus::BuildVersion.semver
build_iteration 1

dependency 'preparation'

dependency 'inspec'

# Mark all directories world readable.
dependency 'gem-permissions'
# Redirect all gem bat files and rb files to point to embedded ruby.
dependency 'shebang-cleanup'
# Ensure our SSL cert files are accessible to ruby.
dependency 'openssl-customization'
# Remove all .dll.a and .a files needed for static linkage.
dependency 'clean-static-libs'

package :rpm do
signing_passphrase ENV['OMNIBUS_RPM_SIGNING_PASSPHRASE']
end

package :pkg do
identifier 'com.getchef.pkg.inspec'
signing_identity 'Developer ID Installer: Chef Software, Inc. (EU3VF8YLX2)'
end
compress :dmg

package :msi do
fast_msi true
upgrade_code 'DFCD452F-31E5-4236-ACD1-253F4720250B'
wix_light_extension 'WixUtilExtension'
signing_identity 'F74E1A68005E8A9C465C3D2FF7B41F3988F0EA09', machine_store: true
end

exclude '**/.git'
exclude '**/bundler/git'
7 changes: 3 additions & 4 deletions omnibus/config/software/inspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@
name 'inspec'

dependency 'ruby'
dependency 'rb-readline'
dependency 'bundler'
dependency 'appbundler'

license :project_license

default_version "v#{Inspec::VERSION}"

source path: "#{Omnibus::Config.project_root}/../"
source path: "#{Omnibus::Config.project_root}/../",
options: { exclude: ['omnibus'] }

build do
env = with_standard_compiler_flags(with_embedded_path)
Expand All @@ -42,8 +44,5 @@
gem "build #{name}.gemspec", env: env
gem "install #{name}-*.gem --no-document", env: env

# Dependecy added to avoid this pry error: "Sorry, you can't use Pry
# without Readline or a compatible library."
gem 'install rb-readline --no-document', env: env
appbundle 'inspec'
end
35 changes: 35 additions & 0 deletions omnibus/files/openssl-customization/windows/ssl_env_hack.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# encoding: utf-8
#
# Copyright:: Copyright (c) 2016 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# This script sets the SSL_CERT_FILE environment variable to the CA cert bundle
# that ships with omnibus packages of Inspec. If this environment
# variable is already configured, this script is a no-op.
#
# This is required to make Chef tools use https URLs out of the box.

unless ENV.key?('SSL_CERT_FILE')
base_dirs = File.dirname(__FILE__).split(File::SEPARATOR)

(base_dirs.length - 1).downto(0) do |i|
candidate_ca_bundle = File.join(base_dirs[0..i] + ['ssl/certs/cacert.pem'])
if File.exist?(candidate_ca_bundle)
ENV['SSL_CERT_FILE'] = candidate_ca_bundle
break
end
end
end
Binary file added omnibus/resources/inspec/dmg/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added omnibus/resources/inspec/dmg/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ce2b094

Please sign in to comment.