-
Notifications
You must be signed in to change notification settings - Fork 176
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
Asset paths should be available in the context of commands #3662
Comments
I could see this working via token substitution.
|
What would be the benefit of exposing this value as a token vs. as an environment variable? Seems the latter would be the more natural fit? |
Related: #3492 |
The benefit is that by exposing
|
We need to schedule a discussion to expand on Eric's proposal. @nikkixdev will schedule something. |
@amdprophet made a really interesting point here that a check can reference multiple assets, so a solution here would need to offer some control over which asset path the user wishes to reference. |
Feature spec:
Requires #3639 |
Some additional context: The end goal here is to expose the asset path to resources that consume assets. For resources executed on the agent (checks & hooks), we will expose the agent path directly via a custom function of token substitution. However, since token substitution is not supported yet for backend resources (mutators & handlers), we will have to rely on an additional feature to expose it via environment variables, #3492, which in turns relies on #3639. Acceptance Criteria
Tasks
|
Feature Suggestion
Resources which invoke commands (e.g. checks, pipe handlers, mutators, hooks) should have access to the full path(s) for assets attached to the resource.
Possible Implementation
Expose asset paths as environment variables in the command execution context. For example, given this check:
The resulting command execution would have access to the file path for the named runtime asset as
%ASSET_PATH%
.For checks with multiple assets, perhaps we could iteratively create incrementing variables like
ASSET_PATH_1
,ASSET_PATH_2
or similar?Context
Sensu reports unexpected check status when executing PowerShell plugins, unless the
-f
or-File
flag is used. This flag requires the absolute path to the PowerShell script for execution, making it difficult to use this flag with PowerShell scripts distributed as assets.This is not a new issue in Sensu Go, it was also a consideration in Sensu Core (see sensu/sensu#1919).
See sensu-plugins/sensu-plugins-windows#101 for examples of how this is affecting Sensu Go users.
The text was updated successfully, but these errors were encountered: