-
Notifications
You must be signed in to change notification settings - Fork 991
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
Support optional conf-based arguments for controlling dirty repo detection #14416
Comments
Hi @santhonisz Thanks for your suggestion. I understand the use case, and it seems enough to be considered. If this is like something permanent, and you point that you want that in the recipe too for the |
Hi @memsharded , Thanks for the prompt reply. Actually your suggestion probably makes more sense. We are using a custom base class for the majority of our Conan recipes where we follow the approach outlined in Capturing git scm information, so having a recipe attribute that was automatically considered would make it very easy for us to apply it broadly. Thinking out loud myself, I wonder if rather than just configuring exclusions, there would be any appetite for an |
After comments from #14715 (comment), adding this for next 2.0.12 discussion and consideration. |
Hi everybody, The better solution for our use case is to add an option to export-pkg command and eventually other commands involved to allow scm revision_mode even on dirty repository, like conan v1 does. We use Gitlab as source repository and CI manager and Artifactory to store the result. In this scenario an option to add to the conan commands is easy to implement into the scripts. The expected result in Artifactory is, like conan v1 commands do: |
@santhonisz, a couple of clarifications, please
This file lives in the user folder, together with the In think that for files that are not exported, then, it might not be necessary to do If the file is actually exported into the cache, that might be more problematic, because even if it is not used (why does it need to be exported then), it will break the "immutability" of package recipes. Maybe this would be a candidate for the new |
Hi @memsharded , The file in question is not exported to the Conan cache; it is in fact a It's an interesting point you make about just taking the To your last point, I completely agree and we have no such scenario where a "dirty" file is exported because, as you say, that would break the "immutability" of the package. |
Hello, Protecting from dirty sources and keeping immutability makes total sense. Nevertheless, isn't there a bug in the |
Thanks for pointing this out. Yes, I think it is worth checking this, lets have a look |
I am doing #15289 for fixing the bug of |
By the way, I am checking possible implementations, and it seems
At least that is a potential workaround that CI can define to avoid the Conan recipe failing because of dirty? |
No worries on the delays, appreciate there's been more pressing issues! To your comment, we've in fact been doing something similar in CI to date, though with |
I am trying to find a way to have I am thinking about trying to add something to .gitignore temporarily or some other similar git trick, like |
#15289 is doing the fix for the path |
I have tried several git built-in approaches, but I didn't find anything effective I am trying in #15457 a |
We are moving forward #15457 for next 2.1. It would be fantastic to have your feedback on this before it goes live. |
Hi memsharded, |
Thanks for the feedback @paorho Isn't it what you are looking for the This exclusion is just a protection for users to avoid having necessary changes not committed, and allow to proceed with the commit hash. If the files are going to change, then maybe the above makes sense? |
I hadn't considered using wild cards. Then adding the line |
Yes, exactly it should. The only thing you will not get is the protection against doing unwanted changes to source files that would be part of the package, but that should be relatively low risk. |
OK |
For other users use cases: the in-recipe explicit def export(self):
excluded = os.getenv("MY_GIT_EXCLUDED")
excluded = excluded.split(",") if excluded else None
git = Git(self, self.recipe_folder, excluded=excluded)
git.... As said above, command line or profile I will have a look if |
I have made it configurable in same PR via |
Hi memsharded, Do I have to do something else? |
Hi @paorho Those are not git configs, but Conan configs, you can use them:
In order to test from source:
|
Hi memsharded, |
Something like
And that will be running Conan from my branch. Recommended to do in a python virtualenv, that you can later destroy |
Hi memsharded, |
Excellent! Thanks very much for the feedback, I'll keep pushing it for 2.1 @santhonisz @BriceMortier any further feedback? Thanks! |
On my side I upgraded to 2.0.15 to use the fix on the |
Merged in #15457, this will be in next 2.1, thanks all for the feedback |
What is your suggestion?
Hi there,
Under Conan 2.0 we have been coming against an issue when attempting to use the
scm
andscm_folder
revision modes on our private Conan project recipes. To cut a long story short, we are often required to have a particular file located alongside theconanfile.py
; this file is both tracked by git (it cannot be ignored as it must be stored in the repo) and is modified during our CI build processes prior to the Conan package build. As such, when we attempt to eitherconan create
orconan export
etc. we receive the error about the repo being dirty and the command fails.I should point out that this file in no way contributes to the build outputs of the Conan package, so it being dirty has no effect on the built package.
I realise that #14330 has gone some of the way to allowing dirty content to exist when using
scm_folder
revisions, but in our specific case it still doesn't provide a solution due to the modified file being located in the same folder as the recipe. It is simply not viable for us to re-organise the structure of our repos so that we could use the functionality in this form.Would a possible solution to this scenario be to provide an optional config setting that could allow users to provide extra arguments to the
git status -s
command used in the revision calculcation logic, so that specific files/patterns can be excluded from the dirty check e.g.tools.git:is_dirty_args=':!<file_to_exclude>'
(see https://stackoverflow.com/a/67815271)It would also be good to have the ability to pass such extra arguments via an optional arg for the
is_dirty
method, and theget_url_and_commit
method that calls it, within theconan.tools.scm.Git
tool.I look forward to your feedback!
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: