-
Notifications
You must be signed in to change notification settings - Fork 117
[feat] Add new ci_extras test variable that allows passing test-specific options to the pipeline generated by --ci-generate
#2833
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
Conversation
|
Can I test this patch? |
|
@jenkins-cscs Yes, I just updated the description. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #2833 +/- ##
===========================================
+ Coverage 86.84% 86.85% +0.01%
===========================================
Files 60 60
Lines 11402 11414 +12
===========================================
+ Hits 9902 9914 +12
Misses 1500 1500
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
vkarak
left a comment
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.
Hi @donion74, thanks for the PR!
I like the idea as it's simple, yet powerful. I think it essentially addresses what #2420 tries to do. @mahendrapaipuri Wdyt? Would that feature work for your case as well?
Other than that we'd need a unit test or expand the existing one in test_ci.py that basically exercises also this feature and a bit of fine tuning of the docs as this is not about adding "options" to the CI: users can essentially extend per test basis the generated child pipeline.
|
@donion74 @vkarak I think it should work in my case as well. From what I see we can arbitrary configure the child pipeline within each "test", which was exactly what we were looking for. I really like this PR as it is a very simple and efficient solution. @donion74 What happens if we want to configure directives that are explicitly generated by current CI code? For instance, ReFrame already emits artifacts to include the report file. If user wants to add more artifacts to it, with this PR, the user can set which will end up generating a YAML file as follows in your example: So, the question is if the GitLab CI parser (in future if other CI engines will be supported, their parsers as well) is smart enough to merge them? Could you maybe do a quick test? |
5ae5174 to
7a29bc8
Compare
|
@mahendrapaipuri Good point. If I try to reproduce your suggestions, the produces this pipeline: I guess this is related to https://stackoverflow.com/q/14902299, and could be solved by the suggestion https://stackoverflow.com/a/61416215. |
|
I updated the example git repo. Here are two pipelines that demonstrate the use of |
|
Thanks @donion74 for the tests. So, if Gitlab CI is not merging them, we need to do it within ReFrame. So, currently ReFrame is emitting pipelines using directives
I think this should do nicely to configure CI pipelines. What do you think @vkarak? |
|
@mahendrapaipuri I agree with your suggestion. For |
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 updated the PR implementing the restrictions we just discussed and added also unit tests. Now lgtm. @donion74 @mahendrapaipuri If you confirm that it works for your use cases, then we can merge this PR.
|
Thanks for implementing the changes @vkarak , my pipeline still works as intended: https://gitlab.com/latticeqcd/reframe-debug/-/pipelines/827286511 The only downside I notice is that subsequent tests overwrite the variable |
|
Nice find @donion74 . This is not just case of overriding. If we play around the test file hello1.py, we notice that the This has to do with test instantiation. |
|
@vkarak I managed to find the problem but not sure about the solution. Lets take a simplified test case: This would produce a This is the buggy behaviour where we get correct behaviour giving us following @vkarak , I hope that can give you an idea where to look at!! |
|
@donion74 I accidentally deleted my previous comment. As @mahendrapaipuri said, If you instead set the |
|
great, thanks. It works as expected, there is only some minor issue (I am not sure whether it is related to the changes that you have done): The jobs run successfully, but fails due to a missing directory, see https://gitlab.com/latticeqcd/reframe-debug/-/pipelines/828496576. If I run the tests locally, it does not occur. |
|
@vkarak @donion74 Seems like this regression is coming from this commit. In the CI tests, we are explicitly setting the |
|
@mahendrapaipuri Good catch, would you mind opening an issue? The |
|
@vkarak @donion74 I was meaning to ask you if it is worth to include this new The use case is that users can define a global CI config in the ReFrame config and override it for specific tests within the test. This is especially useful for users who wish to use same CI config for all tests as they will not need to set the config for "each" test. |
|
This would be very useful. The initial reason I came up with that was to run the Gitlab CI only in merge request pipelines, so I would need to add the same in all the tests. Your idea would avoid duplicate code. |
|
@mahendrapaipuri I suggest opening an issue about that. There is also an old one that requests essentially this for any test variable #1500, which we could reconsider. |
ci_extras test variable that allows passing test-specific options to the pipeline generated by --ci-generate
This PR allows to use Gitlab CI options to filter tests, e.g. based on downstream pipelines or changes of the file. A minimal working example is provided in the repository https://gitlab.com/latticeqcd/reframe-debug, see hello1.py
HelloMergeRequestis run.HelloModified.