Skip to content

Commit dfdca5b

Browse files
committed
feat: add python.version server.conf variants for Splunk 9.4
1 parent e2e8ac0 commit dfdca5b

11 files changed

Lines changed: 815 additions & 73 deletions

File tree

.github/workflows/main.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,20 @@ jobs:
2424
- uses: actions/setup-python@v5
2525
- uses: pre-commit/action@v3.0.1
2626

27-
build_release:
27+
test:
2828
runs-on: ubuntu-latest
2929
needs: pre-commit
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: actions/setup-python@v5
33+
with:
34+
python-version: "3.x"
35+
- run: pip install -r requirements.txt -r requirements-test.txt
36+
- run: pytest tests/test_splunk_matrix_update.py -v
37+
38+
build_release:
39+
runs-on: ubuntu-latest
40+
needs: [pre-commit, test]
3041
permissions:
3142
contents: read
3243
packages: write

action.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,19 @@ inputs:
44
features:
55
description: 'Comma separated list of features.'
66
required: false
7-
type: string
7+
outputs:
8+
supportedSplunk:
9+
description: 'JSON array of all supported Splunk versions'
10+
supportedSplunkModinput:
11+
description: 'JSON array of supported Splunk versions with server_conf_python_versions variants expanded for modinput tests'
12+
latestSplunk:
13+
description: 'JSON array with the single latest Splunk version'
14+
supportedSC4S:
15+
description: 'JSON array of all supported SC4S versions'
16+
supportedModinputFunctionalVendors:
17+
description: 'JSON array of supported modinput functional vendor versions'
18+
supportedUIVendors:
19+
description: 'JSON array of supported UI vendor versions'
820
runs:
921
using: "docker"
10-
image: 'docker://ghcr.io/splunk/addonfactory-test-matrix-action/addonfactory-test-matrix-action:v3.1.7'
22+
image: 'Dockerfile'

addonfactory_test_matrix_action/main.py

Lines changed: 64 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,69 @@ def has_features(features, section):
1818
return True
1919

2020

21-
def _generate_supported_splunk(args, path):
21+
_ALLOWED_SERVER_CONF_PYTHON_VERSIONS = {"python3", "force_python3"}
22+
23+
24+
def _load_splunk_config(path):
2225
if os.path.exists("splunk_matrix.conf"):
2326
splunk_matrix = "splunk_matrix.conf"
2427
else:
2528
splunk_matrix = os.path.join(path, "splunk_matrix.conf")
2629
config = configparser.ConfigParser()
2730
config.read(splunk_matrix)
28-
supported_splunk = []
31+
return config
32+
33+
34+
def _iter_splunk_sections(args, config):
35+
"""Yield (section, props, base_entry) for each non-EOL, feature-matching Splunk version."""
36+
today = datetime.now().date()
2937
for section in config.sections():
30-
if re.search(r"^\d+", section):
31-
props = {}
32-
supported_splunk_string = config[section]["SUPPORTED"]
33-
eol = datetime.strptime(supported_splunk_string, "%Y-%m-%d").date()
34-
today = datetime.now().date()
35-
if today >= eol:
36-
continue
37-
38-
if not has_features(args.features, config[section]):
39-
continue
40-
for k in config[section].keys():
41-
try:
42-
value = config[section].getboolean(k)
43-
except:
44-
value = config[section][k]
45-
props[k] = value
38+
if not re.search(r"^\d+", section):
39+
continue
40+
eol = datetime.strptime(config[section]["SUPPORTED"], "%Y-%m-%d").date()
41+
if today >= eol:
42+
continue
43+
if not has_features(args.features, config[section]):
44+
continue
45+
props = {}
46+
for k in config[section].keys():
47+
try:
48+
value = config[section].getboolean(k)
49+
except ValueError:
50+
value = config[section][k]
51+
props[k] = value
52+
base_entry = {
53+
"version": props["version"],
54+
"build": props["build"],
55+
"islatest": (config["GENERAL"]["LATEST"] == section),
56+
"isoldest": (config["GENERAL"]["OLDEST"] == section),
57+
}
58+
yield section, props, base_entry
4659

47-
supported_splunk.append(
48-
{
49-
"version": props["version"],
50-
"build": props["build"],
51-
"islatest": (config["GENERAL"]["LATEST"] == section),
52-
"isoldest": (config["GENERAL"]["OLDEST"] == section),
53-
}
54-
)
60+
61+
def _generate_supported_splunk(args, path):
62+
config = _load_splunk_config(path)
63+
return [base_entry for _, _, base_entry in _iter_splunk_sections(args, config)]
64+
65+
66+
def _generate_supported_splunk_modinput(args, path):
67+
config = _load_splunk_config(path)
68+
supported_splunk = []
69+
for _, props, base_entry in _iter_splunk_sections(args, config):
70+
raw = props.get("server_conf_python_versions")
71+
if raw:
72+
for python_version in raw.split(","):
73+
python_version = python_version.strip()
74+
if python_version not in _ALLOWED_SERVER_CONF_PYTHON_VERSIONS:
75+
raise ValueError(
76+
f"Invalid server_conf_python_versions value: {python_version!r}. "
77+
f"Allowed: {sorted(_ALLOWED_SERVER_CONF_PYTHON_VERSIONS)}"
78+
)
79+
variant = dict(base_entry)
80+
variant["serverConfPythonVersion"] = python_version
81+
supported_splunk.append(variant)
82+
else:
83+
supported_splunk.append(base_entry)
5584
return supported_splunk
5685

5786

@@ -136,6 +165,15 @@ def main():
136165
with open(os.environ["GITHUB_OUTPUT"], "a") as fh:
137166
print(f"supportedSplunk={json.dumps(supported_splunk)}", file=fh)
138167

168+
supported_splunk_modinput = _generate_supported_splunk_modinput(args, path)
169+
pprint.pprint(
170+
f"Supported Splunk versions (modinput): {json.dumps(supported_splunk_modinput)}"
171+
)
172+
with open(os.environ["GITHUB_OUTPUT"], "a") as fh:
173+
print(
174+
f"supportedSplunkModinput={json.dumps(supported_splunk_modinput)}", file=fh
175+
)
176+
139177
for splunk in supported_splunk:
140178
if splunk["islatest"]:
141179
pprint.pprint(f"Latest Splunk version: {json.dumps([splunk])}")

config/SC4S_matrix.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#SC4S Major versions
22
#
33
[2]
4-
VERSION=3.42.0
4+
VERSION=3.40.0
55
DOCKER_REGISTRY=ghcr.io/splunk/splunk-connect-for-syslog/container3
66

config/splunk_matrix.conf

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,40 @@
11
[GENERAL]
2-
LATEST = 10.2
2+
LATEST = 10.4
33
OLDEST = 9.3
44

55
[10.2]
6-
VERSION = 10.2.2
7-
BUILD = 80b90d638de6
6+
VERSION = 10.2.4
7+
BUILD = 1526e5e5df42
88
SUPPORTED = 2028-01-15
99
PYTHON39 = true
1010
PYTHON37 = false
1111

1212
[10.0]
13-
VERSION = 10.0.5
14-
BUILD = 3d2e2618f448
13+
VERSION = 10.0.7
14+
BUILD = d24b16fd5f20
1515
SUPPORTED = 2027-07-28
1616
PYTHON39 = true
1717
PYTHON37 = false
1818

1919
[9.4]
20-
VERSION = 9.4.10
21-
BUILD = 3673ab0c12ee
20+
VERSION = 9.4.12
21+
BUILD = 9dfc486f3d48
2222
SUPPORTED = 2026-12-16
2323
PYTHON39 = true
2424
PYTHON37 = false
25+
SERVER_CONF_PYTHON_VERSIONS = python3,force_python3
2526

2627
[9.3]
27-
VERSION = 9.3.11
28-
BUILD = 0c8d350423a0
28+
VERSION = 9.3.13
29+
BUILD = 688758e24bbe
2930
SUPPORTED = 2026-07-24
3031
PYTHON39 = true
3132
PYTHON37 = false
3233

34+
[10.4]
35+
VERSION = 10.4.0
36+
BUILD = f798d4d49089
37+
SUPPORTED = 2028-05-18
38+
PYTHON39 = true
39+
PYTHON37 = false
40+

requirements-test.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pytest

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
requests
22
packaging
3+
urllib3>=1.26.0,<2.0.0

0 commit comments

Comments
 (0)