-
-
Notifications
You must be signed in to change notification settings - Fork 751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for multiple action runners (runner modules) inside a single runner Python package #3999
Conversation
package. This means we now support multiple runner modules inside a single Python package which provides for a better abstraction then the one we currently use (multiple runners inside a single Python module or package per runner even for related runners).
@@ -19,4 +19,4 @@ | |||
# This means you can either do "from runner_name import RunnerClass" (old way, don't do that) | |||
# or "from runner_name.runner_name import RunnerClass" | |||
from __future__ import absolute_import | |||
from .local_runner import * # noqa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will actually get rid of this backward compatibility stuff. It will make things nicer and we don't need it anymore, AFAIK.
PYTHONPATH. This is important because imp.load_source() doesn't support packages and we need to manually ensure package directory is in PYTHONPATH. We eventually need to move away from imp.load_source anyway, because it doesn't work in Python 3.
Just a heads up - once this PR is merged, you will need to re-run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good improvement. 👍
Make sure we always delete old entries from activate file.
This pull request adds support for multiple runners and runner modules inside a single action runner Python package.
We already partially introduced support for that in the past during runner refactor done by @bigmstone by allowing "runner.yaml" metadata file to be an array and contain multiple entries (one per runner).
The problem is that support was not fully implemented so we needed to resort to handling multiple runners inside a single runner module inside the code using if checks. That's not ideal and ability to utilize inheritance is better and results in a cleaner code.
I already partially introduced support for that when working on serverless stuff and making runners re-distributable and standalone Python packages. This pull request finishes what I started there.
I originally wanted to postpone this, but I need this code change to be able to continue work on #3997 (one of the changes I'm working in there only applies to local shell script, but not local shell command runner and inheritance makes code a lot more cleaner).
In addition to setting up ground work for multiple runner modules per Python package it also moves local and windows runners to that model.
Another benefit this change brings is that now we can put common code shared by local or remote runners in that runner package. Previously it needed to live inside
st2common
which was far from ideal.TODO
__init__.py
files