From c039ab2982273e47a02375743f42ae235f43475e Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Sat, 18 Jun 2022 21:06:44 -0500 Subject: [PATCH 1/5] runner python_distributions for building wheel/sdist with pants --- contrib/runners/action_chain_runner/BUILD | 7 +++++++ contrib/runners/announcement_runner/BUILD | 7 +++++++ contrib/runners/http_runner/BUILD | 6 ++++++ contrib/runners/inquirer_runner/BUILD | 6 ++++++ contrib/runners/local_runner/BUILD | 7 +++++++ contrib/runners/noop_runner/BUILD | 6 ++++++ contrib/runners/orquesta_runner/BUILD | 7 +++++++ contrib/runners/python_runner/BUILD | 6 ++++++ contrib/runners/remote_runner/BUILD | 7 +++++++ contrib/runners/winrm_runner/BUILD | 8 ++++++++ 10 files changed, 67 insertions(+) create mode 100644 contrib/runners/action_chain_runner/BUILD create mode 100644 contrib/runners/announcement_runner/BUILD create mode 100644 contrib/runners/http_runner/BUILD create mode 100644 contrib/runners/inquirer_runner/BUILD create mode 100644 contrib/runners/local_runner/BUILD create mode 100644 contrib/runners/noop_runner/BUILD create mode 100644 contrib/runners/orquesta_runner/BUILD create mode 100644 contrib/runners/python_runner/BUILD create mode 100644 contrib/runners/remote_runner/BUILD diff --git a/contrib/runners/action_chain_runner/BUILD b/contrib/runners/action_chain_runner/BUILD new file mode 100644 index 0000000000..ae78190ad2 --- /dev/null +++ b/contrib/runners/action_chain_runner/BUILD @@ -0,0 +1,7 @@ +st2_runner_python_distribution( + runner_name="action_chain", + description=( + "Action-Chain workflow action runner " + "for the StackStorm event-driven automation platform" + ), +) diff --git a/contrib/runners/announcement_runner/BUILD b/contrib/runners/announcement_runner/BUILD new file mode 100644 index 0000000000..97ee59b3e3 --- /dev/null +++ b/contrib/runners/announcement_runner/BUILD @@ -0,0 +1,7 @@ +st2_runner_python_distribution( + runner_name="announcement", + description=( + "Announcement action runner " + "for the StackStorm event-driven automation platform" + ), +) diff --git a/contrib/runners/http_runner/BUILD b/contrib/runners/http_runner/BUILD new file mode 100644 index 0000000000..bf4c781c38 --- /dev/null +++ b/contrib/runners/http_runner/BUILD @@ -0,0 +1,6 @@ +st2_runner_python_distribution( + runner_name="http", + description=( + "HTTP(s) action runner for the StackStorm event-driven automation platform" + ), +) diff --git a/contrib/runners/inquirer_runner/BUILD b/contrib/runners/inquirer_runner/BUILD new file mode 100644 index 0000000000..c1921dac50 --- /dev/null +++ b/contrib/runners/inquirer_runner/BUILD @@ -0,0 +1,6 @@ +st2_runner_python_distribution( + runner_name="inquirer", + description=( + "Inquirer action runner for the StackStorm event-driven automation platform" + ), +) diff --git a/contrib/runners/local_runner/BUILD b/contrib/runners/local_runner/BUILD new file mode 100644 index 0000000000..ad224e8cab --- /dev/null +++ b/contrib/runners/local_runner/BUILD @@ -0,0 +1,7 @@ +st2_runner_python_distribution( + runner_name="local", + description=( + "Local Shell Command and Script action runner " + "for the StackStorm event-driven automation platform" + ), +) diff --git a/contrib/runners/noop_runner/BUILD b/contrib/runners/noop_runner/BUILD new file mode 100644 index 0000000000..b83c0a3f1b --- /dev/null +++ b/contrib/runners/noop_runner/BUILD @@ -0,0 +1,6 @@ +st2_runner_python_distribution( + runner_name="noop", + description=( + "No-Op action runner for the StackStorm event-driven automation platform" + ), +) diff --git a/contrib/runners/orquesta_runner/BUILD b/contrib/runners/orquesta_runner/BUILD new file mode 100644 index 0000000000..5171090a45 --- /dev/null +++ b/contrib/runners/orquesta_runner/BUILD @@ -0,0 +1,7 @@ +st2_runner_python_distribution( + runner_name="orquesta", + description=( + "Orquesta workflow runner " + "for the StackStorm event-driven automation platform" + ), +) diff --git a/contrib/runners/python_runner/BUILD b/contrib/runners/python_runner/BUILD new file mode 100644 index 0000000000..331394fcc2 --- /dev/null +++ b/contrib/runners/python_runner/BUILD @@ -0,0 +1,6 @@ +st2_runner_python_distribution( + runner_name="python", + description=( + "Python action runner for the StackStorm event-driven automation platform" + ), +) diff --git a/contrib/runners/remote_runner/BUILD b/contrib/runners/remote_runner/BUILD new file mode 100644 index 0000000000..02a52d1e78 --- /dev/null +++ b/contrib/runners/remote_runner/BUILD @@ -0,0 +1,7 @@ +st2_runner_python_distribution( + runner_name="remote", + description=( + "Remote SSH shell command and script action runner " + "for the StackStorm event-driven automation platform" + ), +) diff --git a/contrib/runners/winrm_runner/BUILD b/contrib/runners/winrm_runner/BUILD index a6be53dbd1..5984410a21 100644 --- a/contrib/runners/winrm_runner/BUILD +++ b/contrib/runners/winrm_runner/BUILD @@ -5,3 +5,11 @@ python_requirement( # https://github.com/pantsbuild/pants/pull/17390 modules=["winrm"], ) + +st2_runner_python_distribution( + runner_name="winrm", + description=( + "WinRM shell command and PowerShell script action runner " + "for the StackStorm event-driven automation platform" + ), +) From ff61cf19903f06614024cd3b6757db4ab29c5ef2 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 22 Jun 2022 10:16:11 -0500 Subject: [PATCH 2/5] clarify where zip_app is needed for wheels --- contrib/runners/python_runner/BUILD | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/runners/python_runner/BUILD b/contrib/runners/python_runner/BUILD index 331394fcc2..356de7c3ae 100644 --- a/contrib/runners/python_runner/BUILD +++ b/contrib/runners/python_runner/BUILD @@ -3,4 +3,5 @@ st2_runner_python_distribution( description=( "Python action runner for the StackStorm event-driven automation platform" ), + zip_safe=False, ) From 1c370c42aa671cc04fe4b7522ac59cae51844b76 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 3 Feb 2023 12:44:18 -0600 Subject: [PATCH 3/5] record entry_points for runner wheels tag with stevedore_namespace so that once we enable the pants-plugin for stevedore, pants can install things appropriately for tests to access the setuptools metadata. --- contrib/runners/action_chain_runner/BUILD | 5 ++++ contrib/runners/announcement_runner/BUILD | 5 ++++ contrib/runners/http_runner/BUILD | 5 ++++ contrib/runners/inquirer_runner/BUILD | 5 ++++ contrib/runners/local_runner/BUILD | 6 ++++ contrib/runners/noop_runner/BUILD | 5 ++++ contrib/runners/orquesta_runner/BUILD | 36 +++++++++++++++++++++++ contrib/runners/python_runner/BUILD | 5 ++++ contrib/runners/remote_runner/BUILD | 6 ++++ contrib/runners/winrm_runner/BUILD | 7 +++++ pants-plugins/macros.py | 5 ++++ 11 files changed, 90 insertions(+) diff --git a/contrib/runners/action_chain_runner/BUILD b/contrib/runners/action_chain_runner/BUILD index ae78190ad2..229eb12728 100644 --- a/contrib/runners/action_chain_runner/BUILD +++ b/contrib/runners/action_chain_runner/BUILD @@ -4,4 +4,9 @@ st2_runner_python_distribution( "Action-Chain workflow action runner " "for the StackStorm event-driven automation platform" ), + entry_points={ + stevedore_namespace("st2common.runners.runner"): { + "action-chain": "action_chain_runner.action_chain_runner", + }, + }, ) diff --git a/contrib/runners/announcement_runner/BUILD b/contrib/runners/announcement_runner/BUILD index 97ee59b3e3..e401a42867 100644 --- a/contrib/runners/announcement_runner/BUILD +++ b/contrib/runners/announcement_runner/BUILD @@ -4,4 +4,9 @@ st2_runner_python_distribution( "Announcement action runner " "for the StackStorm event-driven automation platform" ), + entry_points={ + stevedore_namespace("st2common.runners.runner"): { + "announcement": "announcement_runner.announcement_runner", + }, + }, ) diff --git a/contrib/runners/http_runner/BUILD b/contrib/runners/http_runner/BUILD index bf4c781c38..9773d48d3c 100644 --- a/contrib/runners/http_runner/BUILD +++ b/contrib/runners/http_runner/BUILD @@ -3,4 +3,9 @@ st2_runner_python_distribution( description=( "HTTP(s) action runner for the StackStorm event-driven automation platform" ), + entry_points={ + stevedore_namespace("st2common.runners.runner"): { + "http-request": "http_runner.http_runner", + }, + }, ) diff --git a/contrib/runners/inquirer_runner/BUILD b/contrib/runners/inquirer_runner/BUILD index c1921dac50..e50ae2ead8 100644 --- a/contrib/runners/inquirer_runner/BUILD +++ b/contrib/runners/inquirer_runner/BUILD @@ -3,4 +3,9 @@ st2_runner_python_distribution( description=( "Inquirer action runner for the StackStorm event-driven automation platform" ), + entry_points={ + stevedore_namespace("st2common.runners.runner"): { + "inquirer": "inquirer_runner.inquirer_runner", + }, + }, ) diff --git a/contrib/runners/local_runner/BUILD b/contrib/runners/local_runner/BUILD index ad224e8cab..b2b98fcce5 100644 --- a/contrib/runners/local_runner/BUILD +++ b/contrib/runners/local_runner/BUILD @@ -4,4 +4,10 @@ st2_runner_python_distribution( "Local Shell Command and Script action runner " "for the StackStorm event-driven automation platform" ), + entry_points={ + stevedore_namespace("st2common.runners.runner"): { + "local-shell-cmd": "local_runner.local_shell_command_runner", + "local-shell-script": "local_runner.local_shell_script_runner", + }, + }, ) diff --git a/contrib/runners/noop_runner/BUILD b/contrib/runners/noop_runner/BUILD index b83c0a3f1b..964dbb3de0 100644 --- a/contrib/runners/noop_runner/BUILD +++ b/contrib/runners/noop_runner/BUILD @@ -3,4 +3,9 @@ st2_runner_python_distribution( description=( "No-Op action runner for the StackStorm event-driven automation platform" ), + entry_points={ + stevedore_namespace("st2common.runners.runner"): { + "noop": "noop_runner.noop_runner", + }, + }, ) diff --git a/contrib/runners/orquesta_runner/BUILD b/contrib/runners/orquesta_runner/BUILD index 5171090a45..7d9cfa642d 100644 --- a/contrib/runners/orquesta_runner/BUILD +++ b/contrib/runners/orquesta_runner/BUILD @@ -4,4 +4,40 @@ st2_runner_python_distribution( "Orquesta workflow runner " "for the StackStorm event-driven automation platform" ), + entry_points={ + stevedore_namespace("st2common.runners.runner"): { + "orquesta": "orquesta_runner.orquesta_runner", + }, + stevedore_namespace("orquesta.expressions.functions"): { + "st2kv": "orquesta_functions.st2kv:st2kv_", + "task": "orquesta_functions.runtime:task", + "basename": "st2common.expressions.functions.path:basename", + "dirname": "st2common.expressions.functions.path:dirname", + "from_json_string": "st2common.expressions.functions.data:from_json_string", + "from_yaml_string": "st2common.expressions.functions.data:from_yaml_string", + "json_dump": "st2common.expressions.functions.data:to_json_string", + "json_parse": "st2common.expressions.functions.data:from_json_string", + "json_escape": "st2common.expressions.functions.data:json_escape", + "jsonpath_query": "st2common.expressions.functions.data:jsonpath_query", + "regex_match": "st2common.expressions.functions.regex:regex_match", + "regex_replace": "st2common.expressions.functions.regex:regex_replace", + "regex_search": "st2common.expressions.functions.regex:regex_search", + "regex_substring": "st2common.expressions.functions.regex:regex_substring", + "to_human_time_from_seconds": "st2common.expressions.functions.time:to_human_time_from_seconds", + "to_json_string": "st2common.expressions.functions.data:to_json_string", + "to_yaml_string": "st2common.expressions.functions.data:to_yaml_string", + "use_none": "st2common.expressions.functions.data:use_none", + "version_compare": "st2common.expressions.functions.version:version_compare", + "version_more_than": "st2common.expressions.functions.version:version_more_than", + "version_less_than": "st2common.expressions.functions.version:version_less_than", + "version_equal": "st2common.expressions.functions.version:version_equal", + "version_match": "st2common.expressions.functions.version:version_match", + "version_bump_major": "st2common.expressions.functions.version:version_bump_major", + "version_bump_minor": "st2common.expressions.functions.version:version_bump_minor", + "version_bump_patch": "st2common.expressions.functions.version:version_bump_patch", + "version_strip_patch": "st2common.expressions.functions.version:version_strip_patch", + "yaml_dump": "st2common.expressions.functions.data:to_yaml_string", + "yaml_parse": "st2common.expressions.functions.data:from_yaml_string", + }, + }, ) diff --git a/contrib/runners/python_runner/BUILD b/contrib/runners/python_runner/BUILD index 356de7c3ae..0f6630d3f5 100644 --- a/contrib/runners/python_runner/BUILD +++ b/contrib/runners/python_runner/BUILD @@ -3,5 +3,10 @@ st2_runner_python_distribution( description=( "Python action runner for the StackStorm event-driven automation platform" ), + entry_points={ + stevedore_namespace("st2common.runners.runner"): { + "python-script": "python_runner.python_runner", + }, + }, zip_safe=False, ) diff --git a/contrib/runners/remote_runner/BUILD b/contrib/runners/remote_runner/BUILD index 02a52d1e78..b6dbb3fcc3 100644 --- a/contrib/runners/remote_runner/BUILD +++ b/contrib/runners/remote_runner/BUILD @@ -4,4 +4,10 @@ st2_runner_python_distribution( "Remote SSH shell command and script action runner " "for the StackStorm event-driven automation platform" ), + entry_points={ + stevedore_namespace("st2common.runners.runner"): { + "remote-shell-cmd": "remote_runner.remote_command_runner", + "remote-shell-script": "remote_runner.remote_script_runner", + }, + }, ) diff --git a/contrib/runners/winrm_runner/BUILD b/contrib/runners/winrm_runner/BUILD index 5984410a21..e4d294f534 100644 --- a/contrib/runners/winrm_runner/BUILD +++ b/contrib/runners/winrm_runner/BUILD @@ -12,4 +12,11 @@ st2_runner_python_distribution( "WinRM shell command and PowerShell script action runner " "for the StackStorm event-driven automation platform" ), + entry_points={ + stevedore_namespace("st2common.runners.runner"): { + "winrm-cmd": "winrm_runner.winrm_command_runner", + "winrm-ps-cmd": "winrm_runner.winrm_ps_command_runner", + "winrm-ps-script": "winrm_runner.winrm_ps_script_runner", + }, + }, ) diff --git a/pants-plugins/macros.py b/pants-plugins/macros.py index f9a7c86397..79fad0091b 100644 --- a/pants-plugins/macros.py +++ b/pants-plugins/macros.py @@ -13,6 +13,11 @@ # limitations under the License. +# this is only here temporarily until we update to pants 2.16+ +def stevedore_namespace(ns): + return ns + + def st2_publish_repos(): """Return the list of repos twine should publish to. From 5ba91a8a8502536b471ab68e7d457d520d8d14bf Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Mon, 27 Feb 2023 11:49:17 -0600 Subject: [PATCH 4/5] Note that the winrm_runner includes 3 runners in python_distribution metdata Co-authored-by: Amanda McGuinness --- contrib/runners/winrm_runner/BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/runners/winrm_runner/BUILD b/contrib/runners/winrm_runner/BUILD index e4d294f534..c66877afa4 100644 --- a/contrib/runners/winrm_runner/BUILD +++ b/contrib/runners/winrm_runner/BUILD @@ -9,7 +9,7 @@ python_requirement( st2_runner_python_distribution( runner_name="winrm", description=( - "WinRM shell command and PowerShell script action runner " + "WinRM shell command and PowerShell command and script action runner " "for the StackStorm event-driven automation platform" ), entry_points={ From 69c32d7bf9cc43fc0cccd061c3a445f44b8a1ee8 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 16 Feb 2023 17:10:00 -0600 Subject: [PATCH 5/5] update changelog entry --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index db098b39e3..1a3a580631 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,7 +16,7 @@ Added to pants' use of PEX lockfiles. This is not a user-facing addition. #5778 #5789 #5817 #5795 #5830 #5833 #5834 #5841 #5840 #5838 #5842 #5837 #5849 #5850 #5846 #5853 #5848 #5847 #5858 #5857 #5860 #5868 #5871 #5864 #5874 #5884 #5893 #5891 - #5890 #5898 #5901 #5906 #5899 + #5890 #5898 #5901 #5906 #5899 #5907 Contributed by @cognifloyd * Added a joint index to solve the problem of slow mongo queries for scheduled executions. #5805