diff --git a/.github/workflows/kitchen.vagrant.yml b/.github/workflows/kitchen.vagrant.yml new file mode 100644 index 0000000..3d7f42d --- /dev/null +++ b/.github/workflows/kitchen.vagrant.yml @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +name: 'Kitchen Vagrant (FreeBSD & Windows)' +'on': ['push', 'pull_request'] + +env: + KITCHEN_LOCAL_YAML: 'kitchen.vagrant.yml' + +jobs: + test: + runs-on: 'macos-10.15' + strategy: + fail-fast: false + matrix: + instance: + # - default-freebsd-122-latest-py3 + # - default-freebsd-114-latest-py3 + - default-windows-81-latest-py3 + steps: + - name: 'Check out code' + uses: 'actions/checkout@v2' + - name: 'Set up Bundler cache' + uses: 'actions/cache@v1' + with: + path: 'vendor/bundle' + key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}" + restore-keys: "${{ runner.os }}-gems-" + - name: 'Run Bundler' + run: | + ruby --version + bundle config path vendor/bundle + bundle install --jobs 4 --retry 3 + - name: 'Run Test Kitchen' + run: 'bundle exec kitchen verify ${{ matrix.instance }}' diff --git a/.github/workflows/kitchen.windows.yml b/.github/workflows/kitchen.windows.yml index 369fddf..0690622 100644 --- a/.github/workflows/kitchen.windows.yml +++ b/.github/workflows/kitchen.windows.yml @@ -1,53 +1,101 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml --- name: 'Kitchen (Windows)' - -'on': [push, pull_request] +'on': ['push', 'pull_request'] env: machine_user: kitchen machine_pass: Pass@word1 machine_port: 5985 - KITCHEN_LOCAL_YAML: kitchen.windows.yml + KITCHEN_LOCAL_YAML: 'kitchen.windows.yml' jobs: - test: - runs-on: windows-latest - + test-2019: + runs-on: 'windows-2019' + strategy: + fail-fast: false + matrix: + instance: + - default-windows-2019-latest-py3 + steps: + - name: 'Check out code' + uses: 'actions/checkout@v2' + - name: 'Install Chef' + uses: 'actionshub/chef-install@1.1.0' + with: + project: 'chef' + version: '16.10.8' + - name: 'Add Chef bindir to PATH' + uses: 'myci-actions/export-env-var-powershell@1' + with: + name: 'PATH' + value: "C:\\opscode\\chef\\bin;\ + C:\\opscode\\chef\\embedded\\bin;$env:PATH" + - name: 'Set up Bundler cache' + uses: 'actions/cache@v1' + with: + path: 'vendor/bundle' + key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}" + restore-keys: "${{ runner.os }}-gems-" + - name: 'Set up test user' + run: | + $password = ConvertTo-SecureString $env:machine_pass -AsPlainText -Force + New-LocalUser $env:machine_user -Password $password + Add-LocalGroupMember -Group "Administrators" -Member $env:machine_user + - name: 'Set up WinRM' + run: > + Set-WSManQuickConfig -Force; + Set-WSManInstance -ResourceURI winrm/config/service + -ValueSet @{AllowUnencrypted="true"} + - name: 'Run Bundler' + run: | + ruby --version + bundle config path vendor/bundle + bundle install --jobs 4 --retry 3 + - name: 'Run Test Kitchen' + run: 'bundle exec kitchen verify ${{ matrix.instance }}' + test-2016: + runs-on: 'windows-2016' + strategy: + fail-fast: false + matrix: + instance: + - default-windows-2016-latest-py3 steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Install Chef - uses: actionshub/chef-install@1.1.0 + - name: 'Check out code' + uses: 'actions/checkout@v2' + - name: 'Install Chef' + uses: 'actionshub/chef-install@1.1.0' with: - project: chef - version: 16.10.8 - - name: Add Chef bindir to PATH - uses: myci-actions/export-env-var-powershell@1 + project: 'chef' + version: '16.10.8' + - name: 'Add Chef bindir to PATH' + uses: 'myci-actions/export-env-var-powershell@1' with: - name: PATH + name: 'PATH' value: "C:\\opscode\\chef\\bin;\ C:\\opscode\\chef\\embedded\\bin;$env:PATH" - - name: Set up Bundler cache - uses: actions/cache@v1 + - name: 'Set up Bundler cache' + uses: 'actions/cache@v1' with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- - - name: Set up test user + path: 'vendor/bundle' + key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}" + restore-keys: "${{ runner.os }}-gems-" + - name: 'Set up test user' run: | $password = ConvertTo-SecureString $env:machine_pass -AsPlainText -Force New-LocalUser $env:machine_user -Password $password Add-LocalGroupMember -Group "Administrators" -Member $env:machine_user - - name: Set up WinRM + - name: 'Set up WinRM' run: > Set-WSManQuickConfig -Force; Set-WSManInstance -ResourceURI winrm/config/service -ValueSet @{AllowUnencrypted="true"} - - name: Run Bundler + - name: 'Run Bundler' run: | ruby --version bundle config path vendor/bundle bundle install --jobs 4 --retry 3 - - name: Run Test Kitchen - run: bundle exec kitchen verify + - name: 'Run Test Kitchen' + run: 'bundle exec kitchen verify ${{ matrix.instance }}' diff --git a/kitchen.vagrant.yml b/kitchen.vagrant.yml index 1f85929..5621a16 100644 --- a/kitchen.vagrant.yml +++ b/kitchen.vagrant.yml @@ -3,14 +3,30 @@ --- driver: name: vagrant + cache_directory: false + customize: + usbxhci: 'off' + gui: false + linked_clone: true + ssh: + shell: /bin/sh platforms: - - name: windows + - name: freebsd-122-latest-py3 + driver: + box: bento/freebsd-12.2 + - name: freebsd-114-latest-py3 + driver: + box: bento/freebsd-11.4 + - name: windows-81-latest-py3 driver: box: techneg/win81x64-pro-salt - gui: false - linked_clone: true + cache_directory: "/omnibus/cache" + customize: {} + ssh: {} provisioner: + salt_install: none + # yamllint disable rule:line-length init_environment: | # Workaround to allow `kitchen converge` to be used multiple times # without having to `kitchen destroy` first: remove state files cached by @@ -22,3 +38,8 @@ platforms: C:\Users\vagrant\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\openvpn.sls ` source=https://github.com/saltstack/salt-winrepo-ng/raw/master/openvpn.sls ` skip_verify=True makedirs=True + exit 0 + # yamllint enable rule:line-length + +provisioner: + salt_install: bootstrap diff --git a/kitchen.windows.yml b/kitchen.windows.yml index 6106d21..965f8ee 100644 --- a/kitchen.windows.yml +++ b/kitchen.windows.yml @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml --- driver: name: proxy @@ -8,13 +10,16 @@ driver: password: Pass@word1 platforms: - - name: windows + - name: windows-2019-latest-py3 + - name: windows-2016-latest-py3 provisioner: salt_install: bootstrap salt_bootstrap_options: -pythonVersion 3 + # yamllint disable rule:line-length init_environment: | C:\salt\salt-call --local state.single file.managed ` C:\Users\kitchen\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\openvpn.sls ` source=https://github.com/saltstack/salt-winrepo-ng/raw/master/openvpn.sls ` skip_verify=True makedirs=True + # yamllint enable rule:line-length diff --git a/test/integration/default/files/_mapdata/windows-2016-server.yaml b/test/integration/default/files/_mapdata/windows-2016-server.yaml new file mode 100644 index 0000000..3a77df6 --- /dev/null +++ b/test/integration/default/files/_mapdata/windows-2016-server.yaml @@ -0,0 +1,32 @@ +# yamllint disable rule:indentation rule:line-length +# Windows-2016Server +--- +values: + bin_dir: C:\Program Files\OpenVPN\bin\ + conf_dir: C:\Program Files\OpenVPN\config + conf_ext: ovpn + dh_files: + - '512' + dsaparam: false + external_repo_enabled: false + external_repo_supported: [] + external_repo_version: stable + group: nobody + log_user: null + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@openvpn:lookup + - Y:G@id + multi_services: false + network_manager_pkgs: + - network-manager-openvpn + - network-manager-openvpn-gnome + pkgs: + - openvpn + service: OpenVPNService + service_function: running + user: nobody