diff --git a/.yamllint b/.yamllint index 16746a46..94e9fd8c 100644 --- a/.yamllint +++ b/.yamllint @@ -27,7 +27,11 @@ ignore: | ssf/files/default/.yamllint ssf/files/default/inspec/inspec.yml ssf/files/default/kitchen.yml + ssf/files/default/kitchen.vagrant.yml + ssf/files/default/kitchen.windows.yml ssf/files/default/.github/workflows/kitchen.yml + ssf/files/default/.github/workflows/kitchen.vagrant.yml + ssf/files/default/.github/workflows/kitchen.windows.yml ssf/files/tofs_arvados-formula/.travis.yml ssf/files/tofs_ssf-formula/.yamllint diff --git a/ssf/config/formulas.sls b/ssf/config/formulas.sls index 192cbf31..822fa89d 100644 --- a/ssf/config/formulas.sls +++ b/ssf/config/formulas.sls @@ -13,6 +13,9 @@ {#- Use shorter variables to make the code a little easier to follow #} {%- set context = semrel_formula_specs.context %} {%- set inspec_suites_kitchen = context.inspec_suites_kitchen %} +{%- set testing_freebsd = context.testing_freebsd %} +{%- set testing_openbsd = context.testing_openbsd %} +{%- set testing_windows = context.testing_windows %} {%- set use_cirrus_ci = context.use_cirrus_ci %} {%- set use_github_actions = context.use_github_actions %} {%- set use_libsaltcli = context.use_libsaltcli %} @@ -114,12 +117,16 @@ prepare-git-branch-for-{{ formula }}: {#- Likewise, if running the state for TOFS files when `use_tofs` is `False` #} {#- Also remove the local `CONTRIBUTING` file to use the org-level file instead #} {#- Furthermore, remove `.travis.yml` for the `ssf-formula` #} +{#- Also: remove both `kitchen.vagrant.yml` files if relevant testing not active #} +{#- Also: remove both `kitchen.windows.yml` files if relevant testing not active #} {%- if (semrel_file == '.cirrus.yml' and not use_cirrus_ci) or (semrel_file == '.github/workflows/kitchen.yml' and not use_github_actions) or (semrel_file == 'formula/libsaltcli.jinja' and not use_libsaltcli) or (semrel_file in ['docs/TOFS_pattern.rst', 'formula/libtofs.jinja'] and not use_tofs) or (semrel_file in ['docs/CONTRIBUTING.rst'] and formula not in ['.github', 'ssf-formula']) or - (semrel_file in ['.travis.yml'] and formula in ['ssf-formula']) + (semrel_file in ['.travis.yml'] and formula in ['ssf-formula']) or + (semrel_file.endswith('kitchen.vagrant.yml') and not testing_freebsd.active and not testing_openbsd.active and not testing_windows.active) or + (semrel_file.endswith('kitchen.windows.yml') and not testing_windows.active) %} {%- set add_or_rm = ['rm', 'remove', 'absent'] %} {%- endif %} @@ -173,15 +180,20 @@ remove-previous-file-location-for-{{ formula }}-{{ dest_file }}: platforms: {{ context.platforms | yaml }} platforms_matrix: {{ context.platforms_matrix | yaml }} platforms_matrix_commented_includes: {{ context.platforms_matrix_commented_includes | yaml }} + proxyplatformswindows: {{ ssf.proxyplatformswindows | yaml }} rubocop: {{ context.rubocop | yaml }} salt_lint: {{ context.salt_lint | yaml }} saltimages: {{ ssf.saltimages | yaml }} script_kitchen: {{ context.script_kitchen | yaml }} shellcheck: {{ context.shellcheck | yaml }} suite: {{ suite | yaml }} + testing_freebsd: {{ testing_freebsd | yaml }} + testing_openbsd: {{ testing_openbsd | yaml }} + testing_windows: {{ testing_windows | yaml }} travis: {{ context.travis | yaml }} use_cirrus_ci: {{ use_cirrus_ci }} use_github_actions: {{ use_github_actions }} + vagrantboxes: {{ ssf.vagrantboxes | yaml }} yamllint: {{ context.yamllint | yaml }} {%- endif %} {%- if ssf.git.states.prepare.active %} diff --git a/ssf/defaults.yaml b/ssf/defaults.yaml index 308e2e7a..83bc2c49 100644 --- a/ssf/defaults.yaml +++ b/ssf/defaults.yaml @@ -62,8 +62,8 @@ ssf_node_anchors: # An alternative method could be to use: # `git describe --abbrev=0 --tags` # yamllint disable rule:line-length rule:quoted-strings - title: "test: standardise use of '`'share'`' suite & '`'_mapdata'`' state [skip ci]" - body: '* Automated using https://github.com/myii/ssf-formula/pull/302' + title: "ci: enable Vagrant-based testing using GitHub Actions" + body: '* Semi-automated using https://github.com/myii/ssf-formula/pull/304' # yamllint enable rule:line-length rule:quoted-strings github: owner: 'saltstack-formulas' @@ -185,6 +185,36 @@ ssf_node_anchors: post: [] shellcheck: exclude_paths: [] + testing_freebsd: + active: false + testing_openbsd: + active: false + vagrant: + platforms: + driver: + ssh: + shell: '/bin/ksh' + testing_windows: + active: false + github: + driver: + name: 'proxy' + host: 'localhost' + reset_command: '"exit 0"' + port: '5985' + username: 'kitchen' + password: 'Pass@word1' + platforms: + provisioner: + salt_install: 'bootstrap' + salt_bootstrap_options: '-pythonVersion 3' + vagrant: + platforms: + driver: + box: 'techneg/win81x64-pro-salt' + gui: 'false' + linked_clone: 'true' + winrepo_ng: [] travis: addons: {} dist: 'bionic' @@ -275,6 +305,18 @@ ssf: create_PR: active: false source: 'salt://ssf/files/default/git/git_30_create_PR.sh' + proxyplatformswindows: + ### `windows` + - [windows , 2019 , latest, 3] # wind-2019-latest-py3 + - [windows , 2016 , latest, 3] # wind-2016-latest-py3 + vagrantboxes: + ### `freebsd` + - [freebsd , 12.2 , latest, 3] # fbsd-12.2-latest-py3 + - [freebsd , 11.4 , latest, 3] # fbsd-11.4-latest-py3 + ### `openbsd` + - [openbsd , 6.8 , latest, 3] # obsd-06.8-latest-py3 + ### `windows` + - [windows , 8.1 , latest, 3] # wind-08.1-latest-py3 saltimages: ### `tiamat-py3` - [debian , 10 , tiamat, 3] # debi-10.0-tiamat-py3 @@ -986,6 +1028,9 @@ ssf: 9: <<: *isk_suite_default name: 'gentoo' + 10: + <<: *isk_suite_default + name: 'windows' php: <<: *formula_default context: diff --git a/ssf/files/default/.github/workflows/kitchen.vagrant.yml b/ssf/files/default/.github/workflows/kitchen.vagrant.yml new file mode 100644 index 00000000..86019f36 --- /dev/null +++ b/ssf/files/default/.github/workflows/kitchen.vagrant.yml @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +{%- from tplroot ~ "/libcimatrix.jinja" import format_ci_matrix with context %} + +{#- Concatenate active platforms #} +{%- set active_platforms = [] %} +{%- if testing_freebsd.active %} +{%- do active_platforms.append("FreeBSD") %} +{%- endif %} +{%- if testing_openbsd.active %} +{%- do active_platforms.append("OpenBSD") %} +{%- endif %} +{%- if testing_windows.active %} +{%- do active_platforms.append("Windows") %} +{%- endif %} +{#- https://stackoverflow.com/questions/30083949/how-to-join-list-in-python-but-make-the-last-separator-different/30084022 #} +{%- if active_platforms | length == 1 %} +{%- set active_platforms_concat = active_platforms[0] %} +{%- else %} +{%- set active_platforms_concat = " & ".join([", ".join(active_platforms[:-1]), active_platforms[-1]]) %} +{%- endif %} +name: '{{ "Kitchen Vagrant ({})".format(active_platforms_concat) }}' +'on': ['push', 'pull_request'] + +env: + KITCHEN_LOCAL_YAML: 'kitchen.vagrant.yml' + +jobs: + test: + runs-on: 'macos-10.15' + strategy: + fail-fast: false + matrix: + instance: + {{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_commented_includes, semrel_formula, width=10, use_github_format=True, use_vagrant_platforms=True) }} + {%- raw %} + 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 }}' + {%- endraw %} diff --git a/ssf/files/default/.github/workflows/kitchen.windows.yml b/ssf/files/default/.github/workflows/kitchen.windows.yml new file mode 100644 index 00000000..f8344aa3 --- /dev/null +++ b/ssf/files/default/.github/workflows/kitchen.windows.yml @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +{%- from tplroot ~ "/libcimatrix.jinja" import format_ci_matrix with context %} +name: 'Kitchen (Windows)' +'on': ['push', 'pull_request'] + +env: + machine_user: {{ testing_windows.github.driver.username }} + machine_pass: {{ testing_windows.github.driver.password }} + machine_port: {{ testing_windows.github.driver.port }} + KITCHEN_LOCAL_YAML: 'kitchen.windows.yml' + +jobs: + {%- for platform in proxyplatformswindows %} + {#- set os = platform[0] | d('') #} + {%- set os_ver = platform[1] | d('') %} + {#- set salt_ver = platform[2] | d('') #} + {#- set py_ver = platform[3] | d('') #} + test-{{ os_ver }}: + runs-on: 'windows-{{ os_ver }}' + strategy: + fail-fast: false + matrix: + instance: + {{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_commented_includes, semrel_formula, width=10, use_github_format=True, use_proxy_platforms_windows=platform) }} + {%- raw %} + 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 }}' + {%- endraw %} + {%- endfor %} diff --git a/ssf/files/default/.github/workflows/kitchen.yml b/ssf/files/default/.github/workflows/kitchen.yml index 4532ef5e..29f6d8dc 100644 --- a/ssf/files/default/.github/workflows/kitchen.yml +++ b/ssf/files/default/.github/workflows/kitchen.yml @@ -23,12 +23,13 @@ jobs: {{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_commented_includes, semrel_formula, width=10, use_github_format=True) }} {%- raw %} steps: - - uses: 'actions/checkout@v2' - - uses: 'actions/cache@v1' + - 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') }} + key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}" restore-keys: "${{ runner.os }}-gems-" - name: 'Install Bundler' run: | @@ -37,6 +38,7 @@ jobs: --quiet --no-document - name: 'Run Bundler' run: | + ruby --version bundle config path vendor/bundle bundle install --jobs 4 --retry 3 - name: 'Run Test Kitchen' diff --git a/ssf/files/default/Gemfile b/ssf/files/default/Gemfile index 4bb31329..d44acd8a 100644 --- a/ssf/files/default/Gemfile +++ b/ssf/files/default/Gemfile @@ -12,7 +12,7 @@ gem 'kitchen-docker', git: 'https://gitlab.com/saltstack-formulas/infrastructure # rubocop:enable Layout/LineLength gem 'kitchen-inspec', '>= 2.2.1' gem 'kitchen-salt', '>= 0.6.3' -{%- if semrel_formula in ['openssh', 'openvpn', 'postgres', 'salt'] %} +{%- if semrel_formula in ['openssh', 'openvpn', 'packages', 'postgres', 'salt'] %} {%- if semrel_formula in ['openvpn'] %} gem 'rspec-retry' {%- endif %} diff --git a/ssf/files/default/kitchen.vagrant.yml b/ssf/files/default/kitchen.vagrant.yml new file mode 100644 index 00000000..6d2f0ff6 --- /dev/null +++ b/ssf/files/default/kitchen.vagrant.yml @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +driver: + name: vagrant + cache_directory: false + customize: + usbxhci: 'off' + gui: false + linked_clone: true + ssh: + shell: /bin/sh + +platforms: + {%- for platform in vagrantboxes %} + {%- set os = platform[0] | d('') %} + {%- set os_ver = platform[1] | d('') %} + {%- set salt_ver = platform[2] | d('') %} + {%- set py_ver = platform[3] | d('') %} + {#- Go to the next platform where not set as active #} + {%- if (os == 'freebsd' and not testing_freebsd.active) or + (os == 'openbsd' and not testing_openbsd.active) or + (os == 'windows' and not testing_windows.active) %} + {%- continue %} + {%- endif %} + - name: {{ os | replace('/', '-') }}-{{ os_ver | replace('.', '') }}-{{ salt_ver | replace('.', '-') }}-py{{ py_ver }} + driver: + {%- if os == 'freebsd' %} + box: {{ 'bento/{}-{}'.format(os, os_ver) }} + {%- elif os == 'openbsd' %} + box: {{ 'generic/{}{}'.format(os, os_ver | int) }} + ssh: + {{ testing_openbsd.vagrant.platforms.driver.ssh | yaml(False) | indent(8) }} + {%- elif os == 'windows' %} + box: {{ testing_windows.vagrant.platforms.driver.box }} + cache_directory: "/omnibus/cache" + customize: {} + ssh: {} + {%- endif %} + {%- if os == 'windows' %} + 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 + # Salt during the previous `converge` (if present) + rm -recurse ` + C:\Users\vagrant\AppData\Local\Temp\kitchen\var\cache\salt\minion\files\base ` + -ErrorAction SilentlyContinue + {%- for pkg in testing_windows.winrepo_ng %} + salt-call --local state.single file.managed ` + C:\Users\vagrant\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\{{ pkg }}.sls ` + source=https://github.com/saltstack/salt-winrepo-ng/raw/master/{{ pkg }}.sls ` + skip_verify=True makedirs=True + {%- endfor %} + exit 0 + # yamllint enable rule:line-length + {%- endif %} + {%- endfor %} + +provisioner: + salt_install: bootstrap diff --git a/ssf/files/default/kitchen.windows.yml b/ssf/files/default/kitchen.windows.yml new file mode 100644 index 00000000..68197185 --- /dev/null +++ b/ssf/files/default/kitchen.windows.yml @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +driver: + name: {{ testing_windows.github.driver.name }} + host: {{ testing_windows.github.driver.host }} + reset_command: {{ testing_windows.github.driver.reset_command }} + port: {{ testing_windows.github.driver.port }} + username: {{ testing_windows.github.driver.username }} + password: {{ testing_windows.github.driver.password }} + +platforms: + {%- for platform in proxyplatformswindows %} + {%- set os = platform[0] | d('') %} + {%- set os_ver = platform[1] | d('') %} + {%- set salt_ver = platform[2] | d('') %} + {%- set py_ver = platform[3] | d('') %} + - name: {{ os | replace('/', '-') }}-{{ os_ver | replace('.', '') }}-{{ salt_ver | replace('.', '-') }}-py{{ py_ver }} + {%- endfor %} + +provisioner: + salt_install: {{ testing_windows.github.platforms.provisioner.salt_install }} + salt_bootstrap_options: {{ testing_windows.github.platforms.provisioner.salt_bootstrap_options }} + {#- This template needs this `if` block since `init_environment` may not be needed at all #} + {%- if testing_windows.winrepo_ng %} + # yamllint disable rule:line-length + init_environment: | + {%- for pkg in testing_windows.winrepo_ng %} + C:\salt\salt-call --local state.single file.managed ` + C:\Users\kitchen\AppData\Local\Temp\kitchen\srv\salt\win\repo-ng\{{ pkg }}.sls ` + source=https://github.com/saltstack/salt-winrepo-ng/raw/master/{{ pkg }}.sls ` + skip_verify=True makedirs=True + {%- endfor %} + # yamllint enable rule:line-length + {%- endif %} diff --git a/ssf/files/default/kitchen.yml b/ssf/files/default/kitchen.yml index 158e012f..ae409604 100644 --- a/ssf/files/default/kitchen.yml +++ b/ssf/files/default/kitchen.yml @@ -31,7 +31,8 @@ {%- if cludes %} {{ clude_type }}: {#- Centralise duplication from here and `libcimatrix.jinja` #} -{%- for platform in saltimages %} +{%- set all_platforms = saltimages + vagrantboxes + proxyplatformswindows %} +{%- for platform in all_platforms %} {%- set os = platform[0] | d('') %} {%- set os_ver = platform[1] | d('') %} {%- set salt_ver = platform[2] | d('') %} diff --git a/ssf/files/tofs_packages-formula/Gemfile.lock b/ssf/files/tofs_packages-formula/Gemfile.lock new file mode 120000 index 00000000..c18ae2d6 --- /dev/null +++ b/ssf/files/tofs_packages-formula/Gemfile.lock @@ -0,0 +1 @@ +../tofs_openssh-formula/Gemfile.lock \ No newline at end of file diff --git a/ssf/formulas.yaml b/ssf/formulas.yaml index 597ff88e..95acf982 100644 --- a/ssf/formulas.yaml +++ b/ssf/formulas.yaml @@ -27,6 +27,8 @@ ssf_node_anchors: - centos - amazon - oracle + supports_windows_only: &supports_windows_only + - windows provisioner: dependencies_epel: &dependencies_epel - name: 'epel' @@ -107,6 +109,9 @@ ssf_node_anchors: platforms_gentoo: &platforms_gentoo # [os , os_ver, salt_ver, py_ver] - [gentoo/stage3, 0 , 0 , 0] + platforms_windows: &platforms_windows + # [os , os_ver, salt_ver, py_ver] + - [windows , 0 , 0 , 3] platforms_matrix_osfamily_debian: &platforms_matrix_osfamily_debian # [os , os_ver, salt_ver, py_ver, inspec_suite] - [debian , 0 , master, 0, default] @@ -244,6 +249,14 @@ ssf_node_anchors: .github/workflows/kitchen.yml: &file__--github__workflows__kitchen--yml <<: *file_default template: 'jinja' + # yamllint disable-line rule:line-length + .github/workflows/kitchen.vagrant.yml: &file__--github__workflows__kitchen--vagrant--yml + <<: *file_default + template: 'jinja' + # yamllint disable-line rule:line-length + .github/workflows/kitchen.windows.yml: &file__--github__workflows__kitchen--windows--yml + <<: *file_default + template: 'jinja' bin/install-hooks: &file__bin__install-hooks <<: *file_default mode: 755 @@ -314,6 +327,12 @@ ssf_node_anchors: kitchen.yml: &file__kitchen--yml <<: *file_default template: 'jinja' + kitchen.vagrant.yml: &file__kitchen--vagrant--yml + <<: *file_default + template: 'jinja' + kitchen.windows.yml: &file__kitchen--windows--yml + <<: *file_default + template: 'jinja' pre-commit_semantic-release.sh: &file__pre-commit_semantic-release--sh <<: *file_default mode: 755 @@ -3254,6 +3273,7 @@ ssf: 0: driver: hostname: 'example.net' + vm_hostname: 'example.net' inspec_yml: summary: >- Verify that the openssh formula is setup and configured correctly @@ -3268,8 +3288,30 @@ ssf: map_jinja: verification: import: ['mapdata'] + platforms_matrix: + # [os , os_ver, salt_ver, py_ver, inspec_suite] + - [debian , 0 , master, 0, default] + - [ubuntu , 0 , master, 0, default] + - [centos , 0 , master, 0, default] + - [fedora , 0 , master, 0, default] + - [opensuse/leap, 0 , master, 0, default] + - [opensuse/tmbl, 0 , master, 0, default] + - [amazonlinux , 0 , master, 0, default] + - [oraclelinux , 0 , master, 0, default] + - [gentoo/stage3, 0 , master, 0, default] + - [arch-base , 0 , 3002.2, 0, default] + - [freebsd , 0 , latest, 3, default] + - [openbsd , 0 , latest, 3, default] + testing_freebsd: + active: true + testing_openbsd: + active: true use_libsaltcli: true use_tofs: true + yamllint: + ignore: + additional: + - test/salt/pillar/default.sls semrel_files: *semrel_files_inc_map_jinja_verifier openvpn: context: @@ -3311,6 +3353,14 @@ ssf: - [oraclelinux , 7 , master, 0, default] # # - [gentoo/stage3, 0 , master, 0, default] # # - [arch-base , 0 , 3002.5, 0, default] + # # TODO: Fix 2 failing states in order to enable this + # # - [freebsd , 0 , latest, 3, default] + - [windows , 0 , latest, 3, default] + testing_freebsd: + active: true + testing_windows: + active: true + winrepo_ng: ['openvpn'] use_libsaltcli: true yamllint: ignore: @@ -3448,6 +3498,19 @@ ssf: - ._mapdata - . verifier: *verifier_inspec_tests_default + 10: + includes: *platforms_windows + inspec_yml: + summary: >- + Verify that the packages formula is setup and configured correctly + (on Windows) + supports: *supports_windows_only + provisioner: + pillars_from_files: + - .sls: 'test/salt/pillar/windows.sls' + state_top: + - '*': + - .chocolatey inspec_suites_matrix: - default - debian @@ -3459,6 +3522,7 @@ ssf: - suse - arch - gentoo + - windows map_jinja: verification: import: ['packages'] @@ -3480,6 +3544,9 @@ ssf: - [oraclelinux , 7 , master, 0, centos] - [gentoo/stage3, 0 , master, 0, gentoo] - [arch-base , 0 , 3002.5, 0, arch] + - [windows , 0 , latest, 3, windows] + testing_windows: + active: true semrel_files: *semrel_files_default php: context: @@ -3637,6 +3704,17 @@ ssf: - [oraclelinux , 0 , master, 0, default] # # - [gentoo/stage3, 0 , master, 0, default] - [arch-base , 0 , 3002.5, 0, default] + - [freebsd , 0 , latest, 3, default] + # # - [openbsd , 0 , latest, 3, default] + # # - [windows , 0 , latest, 3, default] + testing_freebsd: + active: true + # # Too much work for now (both OpenBSD and Windows) + # testing_openbsd: + # active: true + # testing_windows: + # active: true + # winrepo_ng: ['postgresql'] use_tofs: true yamllint: ignore: @@ -4073,10 +4151,10 @@ ssf: inspec_suites_kitchen: 0: includes: - # # TODO: - # # - [arch-base , latest, 3002.5, 3] # [os , os_ver, salt_ver, py_ver] - [0 , 0 , 3002.5, 3] + - [freebsd , 0 , latest, 3] + - [windows , 0 , latest, 3] inspec_yml: summary: >- Verify that Salt `v3002-py3` is setup and configured @@ -4091,10 +4169,9 @@ ssf: state_top: *state_top_salt 1: includes: - # # TODO: - # # - [arch-base , latest, 3001.6, 3] # [os , os_ver, salt_ver, py_ver] - [0 , 0 , 3001.6, 3] + - [openbsd , 0 , latest, 3] inspec_yml: summary: >- Verify that Salt `v3001-py3` is setup and configured @@ -4125,8 +4202,6 @@ ssf: state_top: *state_top_salt 3: includes: - # # TODO: - # # - [arch-base , latest, 3000.8, 2] # [os , os_ver, salt_ver, py_ver] - [0 , 0 , 3000.8, 2] inspec_yml: @@ -4169,9 +4244,11 @@ ssf: - [amazonlinux , 2 , 3002.5, 3, v3002-py3] - [oraclelinux , 8 , 3002.5, 3, v3002-py3] - [oraclelinux , 7 , 3002.5, 3, v3002-py3] - # # - [arch-base , latest, 3002.5, 3, v3002-py3] + - [arch-base , latest, 3002.5, 3, v3002-py3] - [gentoo/stage3, latest, 3002.5, 3, v3002-py3] - [gentoo/stage3, systemd, 3002.5, 3, v3002-py3] + - [freebsd , 0 , latest, 3, v3002-py3] + - [windows , 0 , latest, 3, v3002-py3] - [debian , 10 , 3001.6, 3, v3001-py3] # - [debian , 9 , 3001.6, 3, v3001-py3] - [ubuntu , 20.04, 3001.6, 3, v3001-py3] @@ -4191,6 +4268,7 @@ ssf: # # - [arch-base , latest, 3001.6, 3, v3001-py3] # - [gentoo/stage3, latest, 3001.6, 3, v3001-py3] # - [gentoo/stage3, systemd, 3001.6, 3, v3001-py3] + - [openbsd , 0 , latest, 3, v3001-py3] # - [debian , 10 , 3000.8, 3, v3000-py3] - [debian , 9 , 3000.8, 3, v3000-py3] - [ubuntu , 18.04, 3000.8, 3, v3000-py3] @@ -4207,6 +4285,17 @@ ssf: # - [ubuntu , 18.04, 3000.8, 2, v3000-py2] - [ubuntu , 16.04, 3000.8, 2, v3000-py2] # # - [arch-base , latest, 3000.8, 2, v3000-py2] + testing_freebsd: + active: true + testing_openbsd: + active: true + testing_windows: + active: true + github: + platforms: + provisioner: + salt_bootstrap_options: '-pythonVersion 3 -version 3002.5' + winrepo_ng: ['salt-minion-py3'] use_tofs: true yamllint: ignore: diff --git a/ssf/libcimatrix.jinja b/ssf/libcimatrix.jinja index cb49cbc9..cb9d3ed5 100644 --- a/ssf/libcimatrix.jinja +++ b/ssf/libcimatrix.jinja @@ -11,17 +11,32 @@ width=4, use_new_travis_format=False, use_gitlab_format=False, - use_github_format=False + use_github_format=False, + use_vagrant_platforms=False, + use_proxy_platforms_windows=[] ) %} {%- filter indent(width) %} {#- Centralise duplication from here and `kitchen.yml` #} {%- set platform_and_suite_names_done = [] %} {%- set commented_platform_done = [] %} -{%- for platform in saltimages %} +{%- set all_platforms = saltimages + vagrantboxes + proxyplatformswindows %} +{%- set driver_platforms = saltimages %} +{%- if use_vagrant_platforms %} +{%- set driver_platforms = vagrantboxes %} +{%- elif use_proxy_platforms_windows %} +{%- set driver_platforms = proxyplatformswindows %} +{%- endif %} +{%- for platform in driver_platforms %} {%- set os = platform[0] %} {%- set os_ver = platform[1] %} {%- set salt_ver = platform[2] %} {%- set py_ver = platform[3] %} +{#- Go to the next platform where not set as active #} +{%- if (os == 'freebsd' and not testing_freebsd.active) or + (os == 'openbsd' and not testing_openbsd.active) or + (os == 'windows' and not testing_windows.active) %} +{%- continue %} +{%- endif %} {#- Check if the platform matches any of the `platforms` listed #} {%- set ns_check_platform = namespace(match=False) %} @@ -35,8 +50,11 @@ {%- break %} {%- endif %} {%- endfor %} -{#- If a match hasn't been found, go to the next entry under `saltimages` #} -{%- if not ns_check_platform.match %} +{#- If a match hasn't been found, go to the next entry under `driver_platforms` #} +{#- Likewise, if working with Windows proxy platforms and doesn't match the platform sent through #} +{%- if (not ns_check_platform.match) or + (use_proxy_platforms_windows and use_proxy_platforms_windows != platform) +%} {%- continue %} {%- endif %} @@ -56,7 +74,7 @@ {%- set includes = suite.includes %} {%- else %} {#- Centralise duplication from here and `libcimatrix.jinja` #} -{%- for clude_platform in saltimages %} +{%- for clude_platform in all_platforms %} {#- Check if the clude_platform matches any of the `platforms` listed #} {%- for check in suite.includes %} {%- set ch_os = check[0] if check[0] else clude_platform[0] %} @@ -79,7 +97,7 @@ {%- set excludes = suite.excludes %} {%- else %} {#- Centralise duplication from here and `libcimatrix.jinja` #} -{%- for clude_platform in saltimages %} +{%- for clude_platform in all_platforms %} {#- Check if the clude_platform matches any of the `platforms` listed #} {%- for check in suite.excludes %} {%- set ch_os = check[0] if check[0] else clude_platform[0] %} @@ -121,7 +139,7 @@ {%- set platforms_matrix_expanded = [] %} {%- if platforms_matrix and platforms_matrix != [[]] %} {#- Centralise duplication from here and `libcimatrix.jinja` #} -{%- for matrix_platform in saltimages %} +{%- for matrix_platform in driver_platforms %} {#- Check if the matrix_platform matches any of the `platforms` listed #} {%- for check in platforms_matrix %} {%- set ch_os = check[0] if check[0] else matrix_platform[0] %}