Skip to content

Commit

Permalink
fix: add optional vendor matrix for UI (#27)
Browse files Browse the repository at this point in the history
* fix: add optional vendor matrix for UI

* making trigger options exclusive instead of inclusive
  • Loading branch information
siddharth-khatsuriya authored Feb 15, 2022
1 parent cd36197 commit ff33595
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ name: "Add n Factory test matrix"
description: "This tool automates the selection matrix dimensions"
runs:
using: "docker"
image: 'docker://ghcr.io/splunk/addonfactory-test-matrix-action/addonfactory-test-matrix-action:v1.5.0'
image: "Dockerfile"
24 changes: 16 additions & 8 deletions addonfactory_test_matrix_action/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def _generateSupportedVendors(args, path):
Vendors_matrix = os.path.join(path, "/github/workspace/.vendormatrix")
config.read(Vendors_matrix)

supportedVendors = []
supportedModinputFunctionalVendors = []
supportedUIVendors = []
for section in config.sections():
if re.search("^\d+", section):
props = {}
Expand All @@ -102,8 +103,12 @@ def _generateSupportedVendors(args, path):
except:
value = config[section][k]
props[k] = value
supportedVendors.append({"version": props["version"], "image": props["docker_image"]})
return supportedVendors
if props.get("trigger_modinput_functional") != False:
supportedModinputFunctionalVendors.append({"version": props["version"], "image": props["docker_image"]})
if props.get("trigger_ui") != False:
supportedUIVendors.append({"version": props["version"], "image": props["docker_image"]})

return (supportedModinputFunctionalVendors, supportedUIVendors)

def main():
parser = argparse.ArgumentParser(description="Determine support matrix")
Expand Down Expand Up @@ -137,12 +142,15 @@ def main():
print(f"::set-output name=supportedSC4S::{json.dumps(supportedSC4S)}")

if os.path.exists("/github/workspace/.vendormatrix"):
supportedVendors = _generateSupportedVendors(args, path)
supportedModinputFunctionalVendors, supportedUIVendors = _generateSupportedVendors(args, path)
else:
supportedVendors = [{"version": "", "image": ""}]
result['supportedVendors']=supportedVendors
# pprint.pprint(supportedVendors)
print(f"::set-output name=supportedVendors::{json.dumps(supportedVendors)}")
supportedModinputFunctionalVendors, supportedUIVendors = ([{"version": "", "image": ""}], [{"version": "", "image": ""}])
result['supportedModinputFunctionalVendors']=supportedModinputFunctionalVendors
result['supportedUIVendors']=supportedUIVendors
pprint.pprint(supportedModinputFunctionalVendors)
pprint.pprint(supportedUIVendors)
print(f"::set-output name=supportedModinputFunctionalVendors::{json.dumps(supportedModinputFunctionalVendors)}")
print(f"::set-output name=supportedUIVendors::{json.dumps(supportedUIVendors)}")

# tests = [x[0] for x in os.walk('tests/')][1:]
# pytests = []
Expand Down

0 comments on commit ff33595

Please sign in to comment.