-
Notifications
You must be signed in to change notification settings - Fork 665
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
Dynamic log links #4774
Dynamic log links #4774
Conversation
This reverts commit 3501675. Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #4774 +/- ##
==========================================
+ Coverage 58.21% 58.56% +0.35%
==========================================
Files 626 624 -2
Lines 53855 53627 -228
==========================================
+ Hits 31349 31404 +55
+ Misses 19996 19705 -291
- Partials 2510 2518 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Scheme TemplateScheme `json:"scheme" pflag:",Templating scheme to use. Supported values are Pod and TaskExecution."` | ||
DisplayName string `json:"displayName" pflag:",Display name for the generated log when displayed in the console."` | ||
TemplateURIs []TemplateURI `json:"templateUris" pflag:",URI Templates for generating task log links."` | ||
DynamicTemplateURIs []DynamicTemplateURI `json:"dynamicTemplateUris" pflag:",Dynamic URI Templates for generating task log links."` |
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.
Why do these need to be different?
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.
A DynamicTemplateURI
has a kind that we use to match with the values passed via task template. The use case is if we have multiple dynamic log links configured, but the task only enables a subset of them.
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.
Can we just add a name
field in the TemplateLogPlugin
type?
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
@EngHabu , as we talked about yesterday, this next batch of updates implements:
|
tasklog.TemplateLogPlugin{ | ||
Name: logLinkType, | ||
DisplayName: fmt.Sprintf("%s logs", logLinkType), | ||
DynamicTemplateURIs: []tasklog.TemplateURI{ |
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.
Is this field still needed? can't we use TemplateURIs
...
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 simplifies the distinction between task logs produced by dynamic log links vs regular log links.
For example, let's say we enable one dynamic log link in propeller. How do we make sure that dynamic log links only show up for tasks that have the right bits set in their task templates?
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
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.
Thank you ❤️ ❤️
Name: logLinkType, | ||
DisplayName: dynamicLogLink.DisplayName, | ||
DynamicTemplateURIs: dynamicLogLink.TemplateURIs, | ||
MessageFormat: core.TaskLog_JSON, |
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.
Does it not have a MessageFormat
field?
for _, dynamicLogLinkType := range getDynamicLogLinkTypes(input.TaskTemplate) { | ||
for _, dynamicTemplateURI := range p.DynamicTemplateURIs { | ||
if p.Name == dynamicLogLinkType { | ||
for _, match := range dynamicLogRegex.FindAllStringSubmatch(dynamicTemplateURI, -1) { |
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.
nit: Would be nice to support this for the "regular" logs as well...
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.
It will be easy to rearrange this logic when we find a good use-case for regular logs.
Signed-off-by: Eduardo Apolinario <[email protected]>
* Dynamic log links (#4774) * Bring Scheme back for backwards compatibility (#4789) * Bring Scheme back for backwards compatibility Signed-off-by: Eduardo Apolinario <[email protected]> * Rename deprecated field to `DeprecatedScheme` Signed-off-by: Eduardo Apolinario <[email protected]> --------- Signed-off-by: Eduardo Apolinario <[email protected]> Co-authored-by: Eduardo Apolinario <[email protected]> --------- Signed-off-by: Eduardo Apolinario <[email protected]> Co-authored-by: Eduardo Apolinario <[email protected]>
Tracking issue
Closes #4773
Why are the changes needed?
We need a way to specify dynamic log links from tasks as defined in the linked tracking issue. This PR implements this idea. Essentially operators are going to add a section to their config files for specific dynamic log links. For example, we have flyin as a plugin that would benefit from this feature.
What changes were proposed in this pull request?
We add a new subsection to the plugin section in the propeller config file that lets users specify dynamic plugins. The template uris for these dynamic plugins can be configured similarly to the usual plugins, the only difference that specific fields can be plucked from the task template to be used in the template uri. Take this example:
Notice how in the template uri for the
vscode
dynamic plugin we access the port (which is defined in a task template metadata) using the prefix.taskConfig
, whereas the usual template variables are also available.How was this patch tested?
Unit tests and tested locally in a sandbox.
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link