Skip to content

Commit 4c2f4ed

Browse files
committed
feat: add Gentoo support
Make use of the new pre-salted images: * https://gitlab.com/saltstack-formulas/infrastructure/salt-image-builder/-/merge_requests/55
1 parent e78aa0c commit 4c2f4ed

File tree

9 files changed

+155
-1
lines changed

9 files changed

+155
-1
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ jobs:
101101
# - env: INSTANCE=default-fedora-31-master-py3
102102
- env: INSTANCE=default-opensuse-leap-152-master-py3
103103
# - env: INSTANCE=default-amazonlinux-2-master-py3
104+
- env: INSTANCE=gentoo-gentoo-stage3-latest-master-py3
105+
- env: INSTANCE=gentoo-gentoo-stage3-systemd-master-py3
104106
# - env: INSTANCE=default-debian-10-3001-py3
105107
# - env: INSTANCE=default-debian-9-3001-py3
106108
# - env: INSTANCE=default-ubuntu-2004-3001-py3
@@ -113,6 +115,8 @@ jobs:
113115
# - env: INSTANCE=default-amazonlinux-2-3001-py3
114116
# - env: INSTANCE=default-oraclelinux-8-3001-py3
115117
# - env: INSTANCE=default-oraclelinux-7-3001-py3
118+
# - env: INSTANCE=gentoo-gentoo-stage3-latest-3001-py3
119+
# - env: INSTANCE=gentoo-gentoo-stage3-systemd-3001-py3
116120
# - env: INSTANCE=default-debian-10-3000-3-py3
117121
# - env: INSTANCE=default-debian-9-3000-3-py3
118122
# - env: INSTANCE=default-ubuntu-1804-3000-3-py3
@@ -121,6 +125,8 @@ jobs:
121125
# - env: INSTANCE=default-fedora-31-3000-3-py3
122126
# - env: INSTANCE=default-opensuse-leap-152-3000-3-py3
123127
# - env: INSTANCE=default-amazonlinux-2-3000-3-py3
128+
# - env: INSTANCE=gentoo-gentoo-stage3-latest-3000-3-py3
129+
# - env: INSTANCE=gentoo-gentoo-stage3-systemd-3000-3-py3
124130
# - env: INSTANCE=default-ubuntu-1804-3000-3-py2
125131
# - env: INSTANCE=default-ubuntu-1604-3000-3-py2
126132
- env: INSTANCE=default-arch-base-latest-3000-3-py2

TEMPLATE/osfamilymap.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ Suse:
2424
pkg:
2525
name: TEMPLATE-suse
2626

27-
Gentoo: {}
27+
Gentoo:
28+
pkg:
29+
name: TEMPLATE-gentoo
2830

2931
Arch:
3032
pkg:

kitchen.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ platforms:
7373
- name: amazonlinux-2-master-py3
7474
driver:
7575
image: saltimages/salt-master-py3:amazonlinux-2
76+
- name: gentoo-stage3-latest-master-py3
77+
driver:
78+
image: saltimages/salt-master-py3:gentoo-stage3-latest
79+
run_command: /sbin/init
80+
- name: gentoo-stage3-systemd-master-py3
81+
driver:
82+
image: saltimages/salt-master-py3:gentoo-stage3-systemd
7683

7784
## SALT `3001`
7885
- name: debian-10-3001-py3
@@ -116,6 +123,13 @@ platforms:
116123
- name: oraclelinux-7-3001-py3
117124
driver:
118125
image: saltimages/salt-3001-py3:oraclelinux-7
126+
- name: gentoo-stage3-latest-3001-py3
127+
driver:
128+
image: saltimages/salt-3001-py3:gentoo-stage3-latest
129+
run_command: /sbin/init
130+
- name: gentoo-stage3-systemd-3001-py3
131+
driver:
132+
image: saltimages/salt-3001-py3:gentoo-stage3-systemd
119133

120134
## SALT `3000.3`
121135
- name: debian-10-3000-3-py3
@@ -147,6 +161,13 @@ platforms:
147161
- name: amazonlinux-2-3000-3-py3
148162
driver:
149163
image: saltimages/salt-3000.3-py3:amazonlinux-2
164+
- name: gentoo-stage3-latest-3000-3-py3
165+
driver:
166+
image: saltimages/salt-3000.3-py3:gentoo-stage3-latest
167+
run_command: /sbin/init
168+
- name: gentoo-stage3-systemd-3000-3-py3
169+
driver:
170+
image: saltimages/salt-3000.3-py3:gentoo-stage3-systemd
150171
- name: ubuntu-1804-3000-3-py2
151172
driver:
152173
image: saltimages/salt-3000.3-py2:ubuntu-18.04
@@ -191,6 +212,12 @@ suites:
191212
excludes:
192213
- centos-6-2019-2-py2
193214
- amazonlinux-1-2019-2-py2
215+
- gentoo-stage3-latest-master-py3
216+
- gentoo-stage3-systemd-master-py3
217+
- gentoo-stage3-latest-3001-py3
218+
- gentoo-stage3-systemd-3001-py3
219+
- gentoo-stage3-latest-3000-3-py3
220+
- gentoo-stage3-systemd-3000-3-py3
194221
provisioner:
195222
state_top:
196223
base:
@@ -231,3 +258,31 @@ suites:
231258
verifier:
232259
inspec_tests:
233260
- path: test/integration/default
261+
- name: gentoo
262+
includes:
263+
- gentoo-stage3-latest-master-py3
264+
- gentoo-stage3-systemd-master-py3
265+
- gentoo-stage3-latest-3001-py3
266+
- gentoo-stage3-systemd-3001-py3
267+
- gentoo-stage3-latest-3000-3-py3
268+
- gentoo-stage3-systemd-3000-3-py3
269+
provisioner:
270+
state_top:
271+
base:
272+
'*':
273+
- TEMPLATE._mapdata
274+
- TEMPLATE
275+
pillars:
276+
top.sls:
277+
base:
278+
'*':
279+
- TEMPLATE
280+
- gentoo
281+
- define_roles
282+
pillars_from_files:
283+
TEMPLATE.sls: pillar.example
284+
gentoo.sls: test/salt/pillar/gentoo.sls
285+
define_roles.sls: test/salt/pillar/define_roles.sls
286+
verifier:
287+
inspec_tests:
288+
- path: test/integration/default
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# yamllint disable rule:indentation rule:line-length
2+
# Gentoo-2
3+
---
4+
added_in_defaults: defaults_value
5+
added_in_lookup: lookup_value
6+
added_in_pillar: pillar_value
7+
arch: amd64
8+
config: /etc/template-formula.conf
9+
lookup:
10+
added_in_lookup: lookup_value
11+
master: template-master
12+
winner: lookup
13+
master: template-master
14+
pkg:
15+
name: app-shells/bash
16+
rootgroup: root
17+
service:
18+
name: systemd-journald
19+
subcomponent:
20+
config: /etc/TEMPLATE-subcomponent-formula.conf
21+
tofs:
22+
files_switch:
23+
- any/path/can/be/used/here
24+
- id
25+
- roles
26+
- osfinger
27+
- os
28+
- os_family
29+
source_files:
30+
TEMPLATE-config-file-file-managed:
31+
- example.tmpl.jinja
32+
TEMPLATE-subcomponent-config-file-file-managed:
33+
- subcomponent-example.tmpl.jinja
34+
winner: pillar
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# yamllint disable rule:indentation rule:line-length
2+
# Gentoo-2
3+
---
4+
added_in_defaults: defaults_value
5+
added_in_lookup: lookup_value
6+
added_in_pillar: pillar_value
7+
arch: amd64
8+
config: /etc/template-formula.conf
9+
lookup:
10+
added_in_lookup: lookup_value
11+
master: template-master
12+
winner: lookup
13+
master: template-master
14+
pkg:
15+
name: app-shells/bash
16+
rootgroup: root
17+
service:
18+
name: mtab
19+
subcomponent:
20+
config: /etc/TEMPLATE-subcomponent-formula.conf
21+
tofs:
22+
files_switch:
23+
- any/path/can/be/used/here
24+
- id
25+
- roles
26+
- osfinger
27+
- os
28+
- os_family
29+
source_files:
30+
TEMPLATE-config-file-file-managed:
31+
- example.tmpl.jinja
32+
TEMPLATE-subcomponent-config-file-file-managed:
33+
- subcomponent-example.tmpl.jinja
34+
winner: pillar

test/integration/default/inspec.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ supports:
2020
- platform-name: amazon
2121
- platform-name: oracle
2222
- platform-name: arch
23+
- platform-name: gentoo

test/integration/share/inspec.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ supports:
1717
- platform-name: amazon
1818
- platform-name: oracle
1919
- platform-name: arch
20+
- platform-name: gentoo

test/integration/share/libraries/system.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,22 @@ def build_platform_release
4949
inspec.platform[:release].gsub(/2018.*/, '1')
5050
when 'arch'
5151
'base-latest'
52+
when 'gentoo'
53+
"#{inspec.platform[:release].split('.')[0]}-#{derive_gentoo_init_system}"
5254
else
5355
inspec.platform[:release]
5456
end
5557
end
5658

59+
def derive_gentoo_init_system
60+
case inspec.command('systemctl').exist?
61+
when true
62+
'sysd'
63+
else
64+
'sysv'
65+
end
66+
end
67+
5768
def build_platform_finger
5869
"#{build_platform_name}-#{build_finger_release}"
5970
end

test/salt/pillar/gentoo.sls

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
portage:
5+
sync_wait_one_day: true
6+
TEMPLATE:
7+
pkg:
8+
name: 'app-shells/bash'
9+
service:
10+
name: "{{ 'systemd-journald' if grains.init == 'systemd' else 'mtab' }}"

0 commit comments

Comments
 (0)