diff --git a/ssf/defaults.yaml b/ssf/defaults.yaml index a9f8a8cc..592e3544 100644 --- a/ssf/defaults.yaml +++ b/ssf/defaults.yaml @@ -17,8 +17,8 @@ ssf_node_anchors: # An alternative method could be to use: # `git describe --abbrev=0 --tags` # yamllint disable rule:line-length - title: 'test(inspec): add remaining platforms [skip ci]' - body: '* Automated using https://github.com/myii/ssf-formula/pull/51' + title: 'ci(kitchen): use bootstrapped `opensuse` images until `2019.2.2` [skip ci]' + body: '* Automated using https://github.com/myii/ssf-formula/pull/52' # yamllint enable rule:line-length github: owner: saltstack-formulas diff --git a/ssf/files/default/kitchen.yml b/ssf/files/default/kitchen.yml index 3f406dd5..0351010e 100644 --- a/ssf/files/default/kitchen.yml +++ b/ssf/files/default/kitchen.yml @@ -47,6 +47,71 @@ {%- endif %} {%- endfilter %} {%- endmacro %} + +{%- macro format_driver_image(os, os_ver, salt_ver, py_ver) %} +{%- filter indent(6) %} +{%- if os == 'opensuse/leap' %} +image: {{ os }}:{{ os_ver }} +{%- else %} +image: netmanagers/salt-{{ salt_ver }}-py{{ py_ver }}:{{ os | replace('/', '-') }}-{{ os_ver }} +{%- endif %} +{%- endfilter %} +{%- endmacro %} + +{%- macro format_driver_prov_cmds(os, os_ver, salt_ver, py_ver) %} +{#- TODO: Should really do this whole `if` block from `defaults.yaml` or `formulas.yaml`, just speeding things up right now #} +{#- Need to look at if this can be resolved from within the formulas themselves, though #} +{%- filter indent(6) %} +{%- set prov_cmds = [] %} +{#- Specific to unsalted `opensuse/leap` #} +{%- if os == 'opensuse/leap' %} +{%- do prov_cmds.append('- systemctl enable sshd.service') %} +{%- endif %} +{#- Specific to `develop` #} +{%- if salt_ver == 'develop' %} +{%- if os != 'opensuse/leap' %} +{%- do prov_cmds.append('- curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com') %} +{%- do prov_cmds.append('- sh bootstrap-salt.sh -XdPbfrq -x python{0} git {1}'.format(py_ver, salt_ver)) %} +{%- endif %} +{%- if semrel_formula == 'deepsea' %} +{%- if os in ['centos', 'fedora'] %} +{%- do prov_cmds.append('- yum install make -y') %} +{%- endif %} +{%- elif semrel_formula == 'golang' %} +{%- if os in ['debian', 'ubuntu'] %} +{%- do prov_cmds.append('# https://github.com/saltstack/salt/issues/39314') %} +{%- do prov_cmds.append('- apt-get remove python-boto3 -y') %} +{%- elif os == 'opensuse/leap' %} +{%- do prov_cmds.append('# https://github.com/saltstack/salt/issues/39314') %} +{%- do prov_cmds.append('- zypper rm python-boto3 -y') %} +{%- endif %} +{%- endif %} +{%- endif %} +{#- General for all Salt versions #} +{%- if semrel_formula == 'deepsea' %} +{%- if os == 'opensuse/leap' %} +{%- do prov_cmds.append('- zypper -n in tar gzip') %} +{%- endif %} +{%- endif %} +{#- Prepare the commands if available#} +{%- if prov_cmds %} +provision_command: +{%- for prov_cmd in prov_cmds %} + {{ prov_cmd }} +{%- endfor %} +{%- endif %} +{%- endfilter %} +{%- endmacro %} + +{%- macro format_driver_run_cmds(os, os_ver) %} +{%- filter indent(6) %} +{%- if os in ['opensuse/leap', 'arch-base'] %} +run_command: /usr/lib/systemd/systemd +{%- elif [os, os_ver] == ['centos', 6] %} +run_command: /sbin/init +{%- endif %} +{%- endfilter %} +{%- endmacro %} # For help on this file's format, see https://kitchen.ci/ driver: name: docker @@ -100,42 +165,13 @@ platforms: {%- else %} - name: {{ os | replace('/', '-') }}-{{ os_ver | replace('.', '') }}-{{ salt_ver | replace('.', '-') }}-py{{ py_ver }} driver: - image: netmanagers/salt-{{ salt_ver }}-py{{ py_ver }}:{{ os | replace('/', '-') }}-{{ os_ver }} - {%- if salt_ver == 'develop' %} - provision_command: - - curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com - - sh bootstrap-salt.sh -XdPbfrq -x python{{ py_ver }} git develop - {#- TODO: Should really do this whole `if` block from `defaults.yaml` or `formulas.yaml`, just speeding things up right now #} - {#- Need to look at if this can be resolved from within the formulas themselves, though #} - {%- if semrel_formula == 'deepsea' %} - {%- if os in ['centos', 'fedora'] %} - - yum install make -y - {#- Duplicated `provision_command` due to `deepsea`, try to remove eventually #} - {%- elif os == 'opensuse/leap' %} - - zypper -n in tar gzip - {%- endif %} - {%- elif semrel_formula == 'golang' %} - {%- if os in ['debian', 'ubuntu'] %} - # https://github.com/saltstack/salt/issues/39314 - - apt-get remove python-boto3 -y - {%- elif os == 'opensuse/leap' %} - # https://github.com/saltstack/salt/issues/39314 - - zypper rm python-boto3 -y - {%- endif %} - {%- endif %} - {%- endif %} - {#- TODO: Should really do this whole `if` block from `defaults.yaml` or `formulas.yaml`, just speeding things up right now #} - {%- if os in ['opensuse/leap', 'arch-base'] %} - {%- if os == 'opensuse/leap' and semrel_formula == 'deepsea' and salt_ver != 'develop' %} - {#- Duplicated `provision_command` due to `deepsea`, try to remove eventually #} - provision_command: - - zypper -n in tar gzip - {%- endif %} - run_command: /usr/lib/systemd/systemd - {%- elif os == 'centos' and os_ver == 6 %} - run_command: /sbin/init - {%- endif %} + {{- format_driver_image(os, os_ver, salt_ver, py_ver) }} + {{- format_driver_prov_cmds(os, os_ver, salt_ver, py_ver) }} + {{- format_driver_run_cmds(os, os_ver) }} {%- if [os, os_ver] == ['opensuse/leap', 15] %} + provisioner: + salt_bootstrap_options: -XdPfrq -x python{{ py_ver }} git {{ salt_ver }} + salt_install: bootstrap # Workaround to avoid intermittent failures on `opensuse-leap-15`: # => SCP did not finish successfully (255): (Net::SCP::Error) transport: