Skip to content
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

Resolving paths #838

Closed
3 of 4 tasks
mfocko opened this issue Jan 31, 2024 · 2 comments
Closed
3 of 4 tasks

Resolving paths #838

mfocko opened this issue Jan 31, 2024 · 2 comments
Assignees
Labels
area/gitlab Related to GitLab implementation. area/testing-farm Related to Testing Farm integration. complexity/single-task Regular task, should be done within days. gain/high This brings a lot of value to (not strictly a lot of) users. impact/low This issue impacts only a few users. kind/bug Something isn't working.

Comments

@mfocko
Copy link
Member

mfocko commented Jan 31, 2024

What happened? What is the problem?

GitLab fails to resolve . and (potentially) .. in the paths, this resulted in not triggering the TF runs.

Possibly affected methods (as TODO list with confirmed as ticked):

  • GitProject.get_file_content()
  • PullRequest.comment()

What did you expect to happen?

ogr to ignore the . and .. where applicable

Example URL(s)

Example of sanitization:
https://github.com/packit/packit-service/blob/7337498d73eed935e6196696a518d3ea69ef4ad7/packit_service/worker/helpers/testing_farm.py#L191-L202

This could be probably done in a more generic way in the packit-service, that's open for discussion. The linked sanitization is not enough IMO…

Steps to reproduce

import os
from ogr import GitlabService

gs = GitlabService(token=os.getenv("GITLAB_TOKEN"))
p = gs.get_project(namespace="efedin", repo="compose-tests")

# generated via f-string in Packit Service
print(p.get_file_content(path="./.fmf/version", ref="84d980d")

# without the `.` prefix
print(p.get_file_content(path=".fmf/version", ref="84d980d")

Workaround

  • There is an existing workaround that can be used until this issue is fixed.

Participation

  • I am willing to submit a pull request for this issue. (Packit team is happy to help!)
@mfocko mfocko added kind/bug Something isn't working. area/gitlab Related to GitLab implementation. area/testing-farm Related to Testing Farm integration. complexity/single-task Regular task, should be done within days. gain/high This brings a lot of value to (not strictly a lot of) users. impact/low This issue impacts only a few users. labels Jan 31, 2024
@majamassarini
Copy link
Member

In ogr we want the same behaviour for github, gitlab and pagure. Fix it in packit if this will change the behaviour for gitlab in ogr.

@majamassarini majamassarini moved this from new to priority-backlog in Packit Kanban Board Feb 1, 2024
@lbarcziova lbarcziova moved this from priority-backlog to refined in Packit Kanban Board Feb 8, 2024
@lbarcziova lbarcziova moved this from refined to in-progress in Packit Kanban Board Feb 27, 2024
@lbarcziova lbarcziova self-assigned this Feb 27, 2024
lbarcziova added a commit to lbarcziova/ogr that referenced this issue Feb 28, 2024
So that the behaviour is consistent among forges. GitLab
cannot do this automatically.

Related to packit#838
lbarcziova added a commit to lbarcziova/ogr that referenced this issue Mar 1, 2024
So that the behaviour is consistent among forges. GitLab
cannot do this automatically.

Related to packit#838
lbarcziova added a commit to lbarcziova/ogr that referenced this issue Mar 1, 2024
So that the behaviour is consistent among forges. GitLab
cannot do this automatically.

Related to packit#838
softwarefactory-project-zuul bot added a commit that referenced this issue Mar 4, 2024
Remove ./ when getting file in GitLab

So that the behaviour is consistent among forges. GitLab cannot do this automatically (confirmed that both GitHub and Pagure can).
Related to #838
RELEASE NOTES BEGIN
GitLabProject.get_file_content can now correctly handle file paths starting with ./.
RELEASE NOTES END

Reviewed-by: Matej Focko
Reviewed-by: Laura Barcziová
@lbarcziova
Copy link
Member

PullRequest.comment() is not affected as filename there is not event considered for GitLab, closing.

@github-project-automation github-project-automation bot moved this from in-progress to done in Packit Kanban Board Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gitlab Related to GitLab implementation. area/testing-farm Related to Testing Farm integration. complexity/single-task Regular task, should be done within days. gain/high This brings a lot of value to (not strictly a lot of) users. impact/low This issue impacts only a few users. kind/bug Something isn't working.
Projects
Archived in project
Development

No branches or pull requests

3 participants