Skip to content

Commit

Permalink
Merge pull request #124 from myii/feat/avoid-bootstrap-for-master-ins…
Browse files Browse the repository at this point in the history
…tances

feat(kitchen): avoid using bootstrap for `master` instances
  • Loading branch information
myii authored Feb 5, 2020
2 parents c1560ce + 16de460 commit 885bfff
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 119 deletions.
18 changes: 9 additions & 9 deletions ssf/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ ssf_node_anchors:
# the release phase via. `pre-commit_semantic-release.sh`
# An alternative method could be to use:
# `git describe --abbrev=0 --tags`
# yamllint disable rule:line-length
title: 'refactor: improve reusability using an unique keyword TEMPLATE'
body: '* Checked using https://github.com/myii/ssf-formula/pull/123'
# yamllint enable rule:line-length
# yamllint disable rule:line-length rule:quoted-strings
title: "ci(kitchen): avoid using bootstrap for '`'master'`' instances"
body: '* Automated using https://github.com/myii/ssf-formula/pull/124'
# yamllint enable rule:line-length rule:quoted-strings
github:
owner: 'saltstack-formulas'
repo: ''
Expand Down Expand Up @@ -95,7 +95,7 @@ ssf_node_anchors:
- [fedora , 31 , master, 3]
- [opensuse/leap, 15.1 , master, 3]
### ` master-py2`
- [amazonlinux , 2 , master, 2]
- [amazonlinux , 2 , master, 3]
- [arch-base , latest, master, 2]

### `2019.2-py3`
Expand All @@ -110,7 +110,7 @@ ssf_node_anchors:
### `2019.2-py2`
# - [ubuntu , 18.04, 2019.2, 2]
- [centos , 7 , 2019.2, 2]
- [amazonlinux , 2 , 2019.2, 2]
- [amazonlinux , 2 , 2019.2, 3]
- [arch-base , latest, 2019.2, 2]

### `2018.3-py3`
Expand All @@ -124,7 +124,7 @@ ssf_node_anchors:
- [centos , 7 , 2018.3, 2]
# - [centos , 6 , 2018.3, 2]
- [opensuse/leap, 15.1 , 2018.3, 2]
- [amazonlinux , 2 , 2018.3, 2]
- [amazonlinux , 1 , 2018.3, 2]
- [arch-base , latest, 2018.3, 2]

### `2017.7-py2`
Expand All @@ -133,7 +133,7 @@ ssf_node_anchors:
- [centos , 6 , 2017.7, 2]
- [fedora , 30 , 2017.7, 2]
- [opensuse/leap, 15.1 , 2017.7, 2]
- [amazonlinux , 2 , 2017.7, 2]
- [amazonlinux , 1 , 2017.7, 2]
- [arch-base , latest, 2017.7, 2]

platforms_matrix:
Expand All @@ -142,7 +142,7 @@ ssf_node_anchors:
- [debian , 10 , master, 3, default]
- [ubuntu , 18.04, 2019.2, 3, default]
- [opensuse/leap, 15.1 , 2019.2, 3, default]
- [amazonlinux , 2 , 2019.2, 2, default]
- [amazonlinux , 2 , 2019.2, 3, default]
- [fedora , 30 , 2018.3, 3, default]
- [arch-base , latest, 2018.3, 2, default]
- [centos , 6 , 2017.7, 2, default]
Expand Down
27 changes: 8 additions & 19 deletions ssf/files/default/kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@

{%- macro format_driver_image(os, os_ver, salt_ver, py_ver, pre_salted) %}
{%- filter indent(6) %}
{#- Temporary use of `develop` instead of `master` until it is available #}
{%- if [os, os_ver, salt_ver] == ['amazonlinux', 2, 'master'] %}
{%- set salt_ver = 'develop' %}
{%- endif %}
{#- Use bootstrapped images where not already pre-salted #}
{%- if not pre_salted %}
image: {{ os }}:{{ os_ver }}
Expand All @@ -68,16 +64,12 @@ image: netmanagers/salt-{{ salt_ver }}-py{{ py_ver }}:{{ os | replace('/', '-')
{#- Need to look at if this can be resolved from within the formulas themselves, though #}
{%- filter indent(6) %}
{%- set prov_cmds = [] %}
{#- Specific to `master` or bootstrapped images #}
{%- if salt_ver == 'master' or not pre_salted %}
{#- Temporary use of `develop` instead of `master` until it is available #}
{%- if [os, os_ver, salt_ver] == ['amazonlinux', 2, 'master'] %}
{%- set salt_ver = 'develop' %}
{%- endif %}
{#- Use the appropriate bootstrap options for pre-salted images vs. bootstrapped images #}
{%- set bootstrap_options = 'XdPbfrq' if pre_salted else 'XdPfq' %}
{#- Use the appropriate bootstrap method depending on the Salt version #}
{%- set bootstrap_method = 'git' if salt_ver in ['master', 'develop'] else 'stable' %}
{#- Specific to bootstrapped images #}
{%- if not pre_salted %}
{#- Use the appropriate bootstrap options for bootstrapped images #}
{%- set bootstrap_options = 'XdPfq' %}
{#- Use the appropriate bootstrap method #}
{%- set bootstrap_method = 'stable' %}
{%- do prov_cmds.append('- curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com') %}
{%- do prov_cmds.append('- sh bootstrap-salt.sh -{0} -x python{1} {2} {3}'.format(
bootstrap_options, py_ver, bootstrap_method, salt_ver
Expand Down Expand Up @@ -143,7 +135,8 @@ platforms:
{%- set os_ver = platform[1] %}
{%- set salt_ver = platform[2] %}
{%- set py_ver = platform[3] %}
{%- set pre_salted = [os, os_ver] not in [['amazonlinux', 1]] %}
{#- Was used for `[['amazonlinux', 1]]` but now leaving blank in case it's needed in the future #}
{%- set pre_salted = [os, os_ver] not in [[]] %}
{#- Display comment for each section (based on Salt version) #}
{%- set linebreak = '\n' %}
{%- set comment = '`{0}`'.format(salt_ver) %}
Expand All @@ -164,10 +157,6 @@ platforms:
# image: netmanagers/salt-2017.7-py2:centos-6
# run_command: /sbin/init
{%- else %}
{%- if [os, os_ver, salt_ver] == ['amazonlinux', 2, 'master'] %}
# Use the `develop` image temporarily until the `master` image is available
# Not changing the name to minimise disruption across all of the formulas
{%- endif %}
- name: {{ os | replace('/', '-') }}-{{ os_ver | replace('.', '') }}-{{ salt_ver | replace('.', '-') }}-py{{ py_ver }}
driver:
{{- format_driver_image(os, os_ver, salt_ver, py_ver, pre_salted) }}
Expand Down
Loading

0 comments on commit 885bfff

Please sign in to comment.