Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,23 @@ jobs:

integration:
needs: "lint-unit"
runs-on: ubuntu-latest
runs-on: windows-latest
strategy:
matrix:
os:
- almalinux-8
- amazonlinux-2
- debian-10
- debian-11
- centos-7
- centos-stream-8
- ubuntu-1804
- ubuntu-2004
- ubuntu-2204
- rockylinux-8
- windows-latest
suite: [default]
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Install Chef
uses: actionshub/chef-install@6.0.0
uses: sous-chefs/.github/.github/actions/install-workstation@8.0.4
- name: Dokken
uses: actionshub/test-kitchen@3.0.0
env:
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: kitchen.dokken.yml
KITCHEN_LOCAL_YAML: kitchen.exec.yml
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
Expand All @@ -52,4 +43,4 @@ jobs:
runs-on: ubuntu-latest
needs: [integration]
steps:
- run: echo ${{needs.integration.outputs}}
- run: echo "Integration complete"
2 changes: 1 addition & 1 deletion .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
- name: Install Chef
uses: actionshub/chef-install@main
- name: Install cookbooks
run: berks install
run: chef install Policyfile.rb
8 changes: 3 additions & 5 deletions .kitchen.appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ driver:

provisioner:
name: chef_zero
policyfile: Policyfile.rb

platforms:
- name: windows-2012r2
Expand All @@ -21,11 +22,8 @@ platforms:

suites:
- name: default
run_list:
- recipe[visualstudio]
- recipe[visualstudio::install_update]
- recipe[visualstudio::install_vsto]
- recipe[minitest-handler]
provisioner:
named_run_list: default
attributes:
visualstudio:
source: "http://download.microsoft.com/download/b/e/d/bedddfc4-55f4-4748-90a8-ffe38a40e89f/"
Expand Down
8 changes: 3 additions & 5 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ driver:

provisioner:
name: chef_zero
policyfile: Policyfile.rb

platforms:
- name: windows-2012r2
Expand All @@ -20,11 +21,8 @@ platforms:

suites:
- name: default
run_list:
- recipe[visualstudio]
- recipe[visualstudio::install_update]
- recipe[visualstudio::install_vsto]
- recipe[minitest-handler]
provisioner:
named_run_list: default
attributes:
visualstudio:
source: "http://download.microsoft.com/download/b/e/d/bedddfc4-55f4-4748-90a8-ffe38a40e89f/"
Expand Down
9 changes: 9 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
Chef/Modernize/SevenZipArchiveResource:
Exclude:
- providers/edition.rb
- providers/update.rb

Style/MultilineBlockChain:
Exclude:
- spec/install_spec.rb
5 changes: 0 additions & 5 deletions Berksfile

This file was deleted.

26 changes: 26 additions & 0 deletions Policyfile.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

name 'visualstudio'

default_source :supermarket

run_list 'recipe[visualstudio]'

named_run_list :default,
'recipe[visualstudio]',
'recipe[visualstudio::install_update]',
'recipe[visualstudio::install_vsto]',
'recipe[minitest-handler]'

cookbook 'visualstudio', path: '.'
cookbook 'minitest-handler',
git: 'https://github.com/b-dean/minitest-handler-cookbook.git',
branch: 'chef-13-fix'
cookbook 'sqlce'

default['minitest']['recipes'] = %w(
visualstudio::install
visualstudio::install_update
visualstudio::install_vsto
visualstudio::nuget
)
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ If you _really_ want to install VS 2015 on Windows Server 2012R2 over naked WinR

### Optional

| Key | Type | Description | Default |
|-----|------|-------------|---------|
| `['visualstudio']['source']` | URL | HTTP(S) root URL beneath which ISOs for all versions/editions of Visual Studio are stored. | |
| `['visualstudio'][VERSION][EDITION]['source']` | URL | HTTP(S) root URL beneath which the ISO for a specific `VERSION` and `EDITION` of Visual Studio is stored. `VERSION` and `EDITION` should be replaced with one of the supported Visual Studio versions/editions. This attribute, when set, takes precedence over `node['visualstudio']['source']`. | |
| `['visualstudio'][VERSION]['update']['source']` | URL | HTTP(S) root URL beneath which the update ISO for a specific `VERSION` is stored. | |
| `['visualstudio']['edition']` | Boolean | The Visual Studio edition to install, i.e. community, professional, premium, ultimate, testprofessional. | `community` |
| `['visualstudio']['version']` | Integer | The Visual Studio version to install, i.e. 2010, 2012, 2013, 2015. | `2015` |
| `['visualstudio']['enable_nuget_package_restore']` | Boolean | Sets the system wide environment variable to enable MSBuild/Visual Studio package restore on build. | `True` |
| `['visualstudio']['installs']` | Array | An array of hashes that contain the various versions and editions of Visual Studio to install. See Usage below for an example. | |
| `['visualstudio']['install_items'][FEATURE]['selected']` | Boolean | Configures the feature on/off. This currently applies to all versions/editions being installed. | |
| `['visualstudio']['2010']['professional']['config_file']` | String | The name of the Visual Studio 2010 unattend.ini template to use. | |
| Key | Type | Description | Default
| --- | ---- | ----------- | -------
| `['visualstudio']['source']` | URL | HTTP(S) root URL beneath which ISOs for all versions/editions of Visual Studio are stored. | -
| `['visualstudio'][VERSION][EDITION]['source']` | URL | HTTP(S) root URL beneath which the ISO for a specific `VERSION` and `EDITION` of Visual Studio is stored. `VERSION` and `EDITION` should be replaced with one of the supported Visual Studio versions/editions. This attribute, when set, takes precedence over `node['visualstudio']['source']`. | -
| `['visualstudio'][VERSION]['update']['source']` | URL | HTTP(S) root URL beneath which the update ISO for a specific `VERSION` is stored. | -
| `['visualstudio']['edition']` | Boolean | The Visual Studio edition to install, i.e. community, professional, premium, ultimate, testprofessional. | `community`
| `['visualstudio']['version']` | Integer | The Visual Studio version to install, i.e. 2010, 2012, 2013, 2015. | `2015`
| `['visualstudio']['enable_nuget_package_restore']` | Boolean | Sets the system wide environment variable to enable MSBuild/Visual Studio package restore on build. | `True`
| `['visualstudio']['installs']` | Array | An array of hashes that contain the various versions and editions of Visual Studio to install. See Usage below for an example. | -
| `['visualstudio']['install_items'][FEATURE]['selected']` | Boolean | Configures the feature on/off. This currently applies to all versions/editions being installed. | -
| `['visualstudio']['2010']['professional']['config_file']` | String | The name of the Visual Studio 2010 unattend.ini template to use. | -

## Usage

Expand Down
7 changes: 2 additions & 5 deletions chefignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ test/*
*/.hg/*
*/.svn/*

# Berkshelf #
#############
Berksfile
Berksfile.lock
# Dependency cache #
####################
cookbooks/*
tmp

Expand All @@ -98,7 +96,6 @@ Gemfile.lock

# Policyfile #
##############
Policyfile.rb
Policyfile.lock.json

# Documentation #
Expand Down
7 changes: 6 additions & 1 deletion files/default/test/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
require 'win32/registry'
require 'minitest/autorun'

# Cinc Client leaves its own CLI flags in ARGV; keep them away from minitest
# while allowing minitest-handler to own execution.
ARGV.clear

require 'minitest/spec'

# MiniTest helper methods
module ChefHelper
Expand Down
1 change: 1 addition & 0 deletions kitchen.exec.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
driver: { name: exec }
transport: { name: exec }
verifier: { name: dummy }

platforms:
- name: macos-latest
Expand Down
1 change: 1 addition & 0 deletions kitchen.global.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ provisioner:
product_version: <%= ENV['CHEF_VERSION'] || 'latest' %>
channel: stable
install_strategy: once
policyfile: Policyfile.rb
chef_license: accept
enforce_idempotency: <%= ENV['ENFORCE_IDEMPOTENCY'] || true %>
multiple_converge: <%= ENV['MULTIPLE_CONVERGE'] || 2 %>
Expand Down
4 changes: 4 additions & 0 deletions providers/edition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
action :install do
unless package_is_installed?(new_resource.package_name)
converge_by("Installing VisualStudio #{new_resource.edition} #{new_resource.version}") do
directory extracted_iso_dir do
recursive true
end

# Extract the ISO image to the temporary Chef cache dir
seven_zip_archive "extract_#{new_resource.version}_#{new_resource.edition}_iso" do
path extracted_iso_dir
Expand Down
4 changes: 4 additions & 0 deletions providers/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
action :install do
unless package_is_installed?(new_resource.package_name)
converge_by("Installing #{new_resource.package_name}") do
directory extracted_iso_dir do
recursive true
end

# Extract the ISO image to the temporary Chef cache dir
seven_zip_archive "extract_#{setup_basename}_iso" do
path extracted_iso_dir
Expand Down
2 changes: 1 addition & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
include_recipe 'visualstudio::dotnet_prereq'

# We require 7-zip in order to extract the ISOs
include_recipe 'seven_zip'
seven_zip_tool 'seven_zip'

# Enable/disable Nuget package restore
include_recipe 'visualstudio::nuget'
Expand Down
2 changes: 1 addition & 1 deletion spec/install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
end
end

let(:config_xml_path) { 'c:\var\chef\cache\2015\professional\AdminDeployment.xml' }
let(:config_xml_path) { ::File.expand_path('c:\var\chef\cache\2015\professional\AdminDeployment.xml').tr('/', '\\') }
it 'customizes the AdminDeployment.xml when install_items set on the node' do
opts = {
step_into: ['visualstudio_edition'],
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'chefspec'
require 'chefspec/berkshelf'
require 'chefspec/policyfile'

# Conventionally, all specs live under a `spec` directory
# which RSpec adds to the `$LOAD_PATH`. Require this file
Expand Down
Loading