feat: add Gentoo support

Make use of the new pre-salted images:

* https://gitlab.com/saltstack-formulas/infrastructure/salt-image-builder/-/merge_requests/55
This commit is contained in:
Imran Iqbal 2020-10-02 07:27:40 +01:00
parent e78aa0cb78
commit 4c2f4ede02
No known key found for this signature in database
GPG key ID: 6D8629439D2B7819
9 changed files with 155 additions and 1 deletions

View file

@ -101,6 +101,8 @@ jobs:
# - env: INSTANCE=default-fedora-31-master-py3
- env: INSTANCE=default-opensuse-leap-152-master-py3
# - env: INSTANCE=default-amazonlinux-2-master-py3
- env: INSTANCE=gentoo-gentoo-stage3-latest-master-py3
- env: INSTANCE=gentoo-gentoo-stage3-systemd-master-py3
# - env: INSTANCE=default-debian-10-3001-py3
# - env: INSTANCE=default-debian-9-3001-py3
# - env: INSTANCE=default-ubuntu-2004-3001-py3
@ -113,6 +115,8 @@ jobs:
# - env: INSTANCE=default-amazonlinux-2-3001-py3
# - env: INSTANCE=default-oraclelinux-8-3001-py3
# - env: INSTANCE=default-oraclelinux-7-3001-py3
# - env: INSTANCE=gentoo-gentoo-stage3-latest-3001-py3
# - env: INSTANCE=gentoo-gentoo-stage3-systemd-3001-py3
# - env: INSTANCE=default-debian-10-3000-3-py3
# - env: INSTANCE=default-debian-9-3000-3-py3
# - env: INSTANCE=default-ubuntu-1804-3000-3-py3
@ -121,6 +125,8 @@ jobs:
# - env: INSTANCE=default-fedora-31-3000-3-py3
# - env: INSTANCE=default-opensuse-leap-152-3000-3-py3
# - env: INSTANCE=default-amazonlinux-2-3000-3-py3
# - env: INSTANCE=gentoo-gentoo-stage3-latest-3000-3-py3
# - env: INSTANCE=gentoo-gentoo-stage3-systemd-3000-3-py3
# - env: INSTANCE=default-ubuntu-1804-3000-3-py2
# - env: INSTANCE=default-ubuntu-1604-3000-3-py2
- env: INSTANCE=default-arch-base-latest-3000-3-py2

View file

@ -24,7 +24,9 @@ Suse:
pkg:
name: TEMPLATE-suse
Gentoo: {}
Gentoo:
pkg:
name: TEMPLATE-gentoo
Arch:
pkg:

View file

@ -73,6 +73,13 @@ platforms:
- name: amazonlinux-2-master-py3
driver:
image: saltimages/salt-master-py3:amazonlinux-2
- name: gentoo-stage3-latest-master-py3
driver:
image: saltimages/salt-master-py3:gentoo-stage3-latest
run_command: /sbin/init
- name: gentoo-stage3-systemd-master-py3
driver:
image: saltimages/salt-master-py3:gentoo-stage3-systemd
## SALT `3001`
- name: debian-10-3001-py3
@ -116,6 +123,13 @@ platforms:
- name: oraclelinux-7-3001-py3
driver:
image: saltimages/salt-3001-py3:oraclelinux-7
- name: gentoo-stage3-latest-3001-py3
driver:
image: saltimages/salt-3001-py3:gentoo-stage3-latest
run_command: /sbin/init
- name: gentoo-stage3-systemd-3001-py3
driver:
image: saltimages/salt-3001-py3:gentoo-stage3-systemd
## SALT `3000.3`
- name: debian-10-3000-3-py3
@ -147,6 +161,13 @@ platforms:
- name: amazonlinux-2-3000-3-py3
driver:
image: saltimages/salt-3000.3-py3:amazonlinux-2
- name: gentoo-stage3-latest-3000-3-py3
driver:
image: saltimages/salt-3000.3-py3:gentoo-stage3-latest
run_command: /sbin/init
- name: gentoo-stage3-systemd-3000-3-py3
driver:
image: saltimages/salt-3000.3-py3:gentoo-stage3-systemd
- name: ubuntu-1804-3000-3-py2
driver:
image: saltimages/salt-3000.3-py2:ubuntu-18.04
@ -191,6 +212,12 @@ suites:
excludes:
- centos-6-2019-2-py2
- amazonlinux-1-2019-2-py2
- gentoo-stage3-latest-master-py3
- gentoo-stage3-systemd-master-py3
- gentoo-stage3-latest-3001-py3
- gentoo-stage3-systemd-3001-py3
- gentoo-stage3-latest-3000-3-py3
- gentoo-stage3-systemd-3000-3-py3
provisioner:
state_top:
base:
@ -231,3 +258,31 @@ suites:
verifier:
inspec_tests:
- path: test/integration/default
- name: gentoo
includes:
- gentoo-stage3-latest-master-py3
- gentoo-stage3-systemd-master-py3
- gentoo-stage3-latest-3001-py3
- gentoo-stage3-systemd-3001-py3
- gentoo-stage3-latest-3000-3-py3
- gentoo-stage3-systemd-3000-3-py3
provisioner:
state_top:
base:
'*':
- TEMPLATE._mapdata
- TEMPLATE
pillars:
top.sls:
base:
'*':
- TEMPLATE
- gentoo
- define_roles
pillars_from_files:
TEMPLATE.sls: pillar.example
gentoo.sls: test/salt/pillar/gentoo.sls
define_roles.sls: test/salt/pillar/define_roles.sls
verifier:
inspec_tests:
- path: test/integration/default

View file

@ -0,0 +1,34 @@
# yamllint disable rule:indentation rule:line-length
# Gentoo-2
---
added_in_defaults: defaults_value
added_in_lookup: lookup_value
added_in_pillar: pillar_value
arch: amd64
config: /etc/template-formula.conf
lookup:
added_in_lookup: lookup_value
master: template-master
winner: lookup
master: template-master
pkg:
name: app-shells/bash
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/TEMPLATE-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
- id
- roles
- osfinger
- os
- os_family
source_files:
TEMPLATE-config-file-file-managed:
- example.tmpl.jinja
TEMPLATE-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View file

@ -0,0 +1,34 @@
# yamllint disable rule:indentation rule:line-length
# Gentoo-2
---
added_in_defaults: defaults_value
added_in_lookup: lookup_value
added_in_pillar: pillar_value
arch: amd64
config: /etc/template-formula.conf
lookup:
added_in_lookup: lookup_value
master: template-master
winner: lookup
master: template-master
pkg:
name: app-shells/bash
rootgroup: root
service:
name: mtab
subcomponent:
config: /etc/TEMPLATE-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
- id
- roles
- osfinger
- os
- os_family
source_files:
TEMPLATE-config-file-file-managed:
- example.tmpl.jinja
TEMPLATE-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View file

@ -20,3 +20,4 @@ supports:
- platform-name: amazon
- platform-name: oracle
- platform-name: arch
- platform-name: gentoo

View file

@ -17,3 +17,4 @@ supports:
- platform-name: amazon
- platform-name: oracle
- platform-name: arch
- platform-name: gentoo

View file

@ -49,11 +49,22 @@ class SystemResource < Inspec.resource(1)
inspec.platform[:release].gsub(/2018.*/, '1')
when 'arch'
'base-latest'
when 'gentoo'
"#{inspec.platform[:release].split('.')[0]}-#{derive_gentoo_init_system}"
else
inspec.platform[:release]
end
end
def derive_gentoo_init_system
case inspec.command('systemctl').exist?
when true
'sysd'
else
'sysv'
end
end
def build_platform_finger
"#{build_platform_name}-#{build_finger_release}"
end

View file

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
portage:
sync_wait_one_day: true
TEMPLATE:
pkg:
name: 'app-shells/bash'
service:
name: "{{ 'systemd-journald' if grains.init == 'systemd' else 'mtab' }}"