-
Notifications
You must be signed in to change notification settings - Fork 51
[WIP] feat: Filter copr_build
jobs based on paths
and files changed
#2780
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
base: main
Are you sure you want to change the base?
Conversation
# FIXME: Implement the relevant git diff | ||
return [] |
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.
Currently stuck on this part. Isn't the git repo cloned somewhere when the package_config
was evaluated? I was hoping on using that to do the git diff
, but I haven't navigated to such a part. Should that be an interface in ogr
instead?
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.
LocalProjectMixin
should give you self.local_project.git_repo
which is git.Repo
.
packit-service/packit_service/worker/mixin.py
Lines 212 to 246 in 11d4722
class LocalProjectMixin(Config): | |
_local_project: Optional[LocalProject] = None | |
@property | |
def local_project(self) -> LocalProject: | |
if not self._local_project: | |
builder = LocalProjectBuilder( | |
cache=( | |
RepositoryCache( | |
cache_path=self.service_config.repository_cache, | |
add_new=self.service_config.add_repositories_to_repository_cache, | |
) | |
if self.service_config.repository_cache | |
else None | |
), | |
) | |
working_dir = Path( | |
Path(self.service_config.command_handler_work_dir) / SANDCASTLE_LOCAL_PROJECT_DIR, | |
) | |
kwargs = { | |
"repo_name": CALCULATE, | |
"full_name": CALCULATE, | |
"namespace": CALCULATE, | |
"working_dir": working_dir, | |
"git_repo": CALCULATE, | |
} | |
if self.project: | |
kwargs["git_project"] = self.project | |
else: | |
kwargs["git_url"] = self.project_url | |
self._local_project = builder.build(**kwargs) | |
return self._local_project |
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.
Can go either way on LocalProject
vs ogr
ogr
pro
- easier interface
- don't have to deal with fork fetches
con
- it downloads the diff content thatis ignored
- may be slower and rate limited because it goes through web api
LocalProject
pro
- already used by osh (didn't check if we would be reusing it though)
- still downloads the diffs, but it's more efficient at that
- no rate/file limits
con
- handling PRs is a bit clunky
- if the git is not cached it could be more expensive to re-clone the project every time
I am leaning towards the ogr approach. What's your thoughts on the choice of these 2?
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.
+1 for the ogr/API approach, we would be checking this only if this is configured in the config, so I believe it would not be such a big additional API load in the end, and sounds more straightforward; I don't like cloning the repo already in the pre-check that much
Build failed. ❌ pre-commit FAILURE in 1m 48s |
Signed-off-by: Cristian Le <[email protected]>
Build failed. ✔️ pre-commit SUCCESS in 1m 52s |
TODO:
/packit
command is usedpackit/packit.dev
.Fixes packit/packit#1997
Fixes #2006
RELEASE NOTES BEGIN
copr_build
jobs are triggered only if there are changed files under thepaths
fieldRELEASE NOTES END