-
Notifications
You must be signed in to change notification settings - Fork 5
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
Implement Jira processor configuration logic #8
Comments
There is an example file already merged, it was based on examples shown above, but there are small differences and it's not covering everything shown above. See https://github.com/RedHatQE/newa/blob/main/component-config.yaml.sample Note the templating looks different, Importing files and filtering has been omitted on purpose, to simplify the introduction of issue rules. We could go with restricted |
After a bit of research I have found
For more info visit https://newville.github.io/asteval/basics.html |
Very similar to what we're used to from our gluetool modules. However, I'm afraid the package might not be available in EPEL.
That's what I was thinking about. Saving the expression alone in the config file would be enough, a simple Jinja2 wrapper would then provide a result. For example: - summary: 'Perform full regression testing'
description: 'Run all tests on all supported architectures'
...
# The condition - just an example, but let's say this issue should exist for errata with even IDs:
when: "ERRATUM.event.id % 2" # Inject the `when` key into a template consisting of a single condition.
# If the expression gets evaluated as true, the template would render to a "true" string.
# For non-true expressions, we'd get an empty string
result = render_template(f'{{% if {action["when"]} %}}true{{% endif %}}', ERRATUM=erratum_job)
if result:
... |
Adding a bit more complicated example with
I am aware that Jinja2 enables using conditionals, loops etc., although I do not have an experience with it. The ease of use should be probably considered. We may need to come up with a list of use stories (conditions a typical user would need) and assess the complexity. |
... The Jinja2 example is more complicated than I'd say it's necessary:
In what I proposed, the condition could be simpler - just the condition, no Jinja controls:
The condition itself would be "glued into" a dummy "if-else" template, and as such it does not have to contain any Jinja control characters. It's simply an expression one would use after any other So, the complete example with your data and simpler expression:
|
That's good. I thought that the condition itself should follow some Jinja syntax and is limited by whatever Jinja supports. Does is mean the the |
In addition to the
That could look like:
|
"Almost any" is a fitting description. It's not a Python expression per se, it's Jinja2 after all, but it's very similar. For example, in Python , Plus, since we would own the environment when evaluating the condition, we would be able to add custom tests to simplify common checks, or to make them more readable. And, of course, we can add attributes to objects we own, so we might really simplify the test even more, e.g. to It would be helpful to write down a couple of examples of these conditions you foresee - or already needed - to better see whether the
Indeed, we should collect them and check what way would be better. |
Dropping few use cases that I plan to utilize myself:
|
Added a trivial bootstrap in #19. I included a couple of examples based on #8 (comment) - some of the proposals cannot be implemented yet, but I'm confident we will get them in the future. There is also a rudimentary test we would then convert to a proper unit test. Let me know what you think. |
Jira processor needs to know how to handle an erratum. For that there should be a configuration stored in a single or multiple YAML files.
Below is the proposed format but the actual implementation is up to a discussion, this is just something so we can starting the discussion.
Proposed file format for the Jira issue configuration file
covered use cases
not covered use cases
to improve
errata_base.yaml
errata_checklist.yaml
opencryptoki_ewa.yaml
The text was updated successfully, but these errors were encountered: