-
Notifications
You must be signed in to change notification settings - Fork 126
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
When everywhere #3340
base: main
Are you sure you want to change the base?
When everywhere #3340
Conversation
dc46687
to
8182196
Compare
Use case: enable particular step configuration only on some environments
8182196
to
5efcfc5
Compare
docs/releases.rst
Outdated
It is easier limit when step configuration is run by | ||
using :ref:`when-config` key. |
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 is easier limit when step configuration is run by | |
using :ref:`when-config` key. | |
It is easier to limit a step execution using | |
the :ref:when-config key. |
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.
|
||
prepare: | ||
- name: Prepare config to run only on Fedora | ||
when: distro == fedora |
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.
@lukaszachy can we add an example for multiple when rules?
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.
in this way, it soon becomes difficult to read. | ||
|
||
Using the ``when`` key makes it easier to restrict a step configuration | ||
to run only if any of the specified rules matches. |
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.
so this means I can also use something like
when:
- distro == fedora && trigger = rhel-ci
- distro == centos && trigger = fedora-ci
?
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 would appreciate more examples here, to get the feel of what can be done here
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.
example: | | ||
finish: | ||
- name: finish config to run only on Fedora | ||
when: distro == fedora |
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.
@lukaszachy could we add a test with multiple when rules maybe?
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.
Will change tests/steps/when/data/plan.fmf
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.
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.
Nice!
I'm thinking if it would make sense if Phase would have a more generic enabled
property, but that's just a random thought, no opinion.
docs/guide.rst
Outdated
- name: Prepare config to run only on Fedora | ||
when: distro == fedora | ||
how: shell | ||
script: ./fedora_specific. |
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.
script: ./fedora_specific. | |
script: ./fedora_specific.sh |
I assume? or no dot? Same below.
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.
summary: Conditional step configuration | ||
description: | | ||
Using the ``when`` key makes it easier to restrict a step configuration | ||
to run only if any of the specified rules matches. |
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.
run only if any of the specified rules matches.
I wonder if we could better communicate to the user how does that look, perhaps an example like:
If you want mach all conditions(see fmf context documentation), use:
when: "distro == fedora and arch = x86_64"
If you want to mach at least one use:
when: "distro == fedora"
when: "arch = x86_64"
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.
Hm, nice idea but that is common for whole adjust madness so ... another PR?
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.
IMO context deserves whole section in https://tmt.readthedocs.io/en/stable/examples.html#
@martinhoyer there's definitely one situation when "enabled" needs an input, i.e. "Is this phase enabled on this guest?", and because of that I think we cannot reach a singular "Is this phase enabled?" property. |
Pull Request Checklist