fix(resolve): restore relative task path resolution for repository paths#2554
fix(resolve): restore relative task path resolution for repository paths#2554chmouel merged 1 commit intotektoncd:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a regression that prevented the proper resolution of relative task paths when referencing files within a repository. The fix re-enables this critical functionality, allowing users to define tasks using relative paths without encountering errors from the GitHub API. It ensures that the system can correctly interpret and resolve these paths, improving the robustness and flexibility of task definitions within repositories. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🔍 PR Lint Feedback
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses a regression that broke relative task path resolution for tasks defined within repository file paths. The fix correctly extends the resolution logic to handle both HTTP(S) URLs and local repository paths, and the change is well-supported by a new unit test case. However, I've identified a potential issue with the new logic for detecting repository paths, which may not work for files at the repository root. I've also included a minor suggestion to clean up some commented-out code.
| pipelineURL: "share/pipelines/build.yaml", | ||
| tasks: []string{"../tasks/t.yaml", "tasks/other-task.yaml"}, | ||
| expected: []string{"../tasks/t.yaml", "tasks/other-task.yaml"}, | ||
| expected: []string{"share/tasks/t.yaml", "share/pipelines/tasks/other-task.yaml"}, |
There was a problem hiding this comment.
I have tried to restore the original behaviour of the function but a bit doubtful if the second resolution is what we expect expect.
There was a problem hiding this comment.
These tests are skipped but still modified them (not tested).
test/gitea_test.go
Outdated
| ".tekton/pr.yaml": "testdata/pipelinerun_remote_task_annotations.yaml", | ||
| ".tekton/pipeline.yaml": "testdata/pipeline_in_tektondir.yaml", | ||
| ".other-tasks/task-referenced-internally.yaml": "testdata/task_referenced_internally.yaml", | ||
| ".other-tasks/task2-referenced-internally.yaml": "testdata/task2_referenced_internally.yaml", |
There was a problem hiding this comment.
Both tasks are same, one is referenced using its absolute path in the repo and the other with relative path
pipelinesascode.tekton.dev/task: "[.other-tasks/task-referenced-internally.yaml]"
pipelinesascode.tekton.dev/task-3: "[../.other-tasks/task2-referenced-internally.yaml]"|
@theakshaypant we will ned a jira for this one. |
Created downstream ticket to track this SRVKP-11021 |
583c0f8 to
57c149d
Compare
|
/retest go-testing |
|
I think this is fixing the right bug in the code, but the new e2e test is proving a different thing than what the code actually changed. The patch teaches PAC how to resolve relative task paths when they come from the Pipeline file. That path still goes through a different code path, so this PR does not really prove that case is fixed. |
|
/retest |
Commit 6e36620 broke relative task path resolution for repository file paths by only allowing HTTP(S) URLs. This caused paths containing '..' to be passed unresolved to the GitHub API, which rejects them with "path must not contain '..' due to auth vulnerability issue". This fix restores the original behavior by allowing both HTTP(S) URLs and repository file paths (e.g., .tekton/pipelines/build.yaml) to have their relative paths resolved, while still excluding catalog/hub references (catalog://, hub://). Fixes: tektoncd#2549 Signed-off-by: Akshay Pant <akpant@redhat.com>
📝 Description of the Change
Commit 6e36620 broke relative task path resolution for repository file paths by only allowing HTTP(S) URLs. This caused paths containing '..' to be passed unresolved to the GitHub API, which rejects them with "path must not contain '..' due to auth vulnerability issue".
This fix restores the original behavior by allowing both HTTP(S) URLs and repository file paths (e.g., .tekton/pipelines/build.yaml) to have their relative paths resolved, while still excluding catalog/hub references (catalog://, hub://).
Also added relative local path resolution in e2e test
TestGiteaPullRequestTaskAnnotations.👨🏻 Linked Jira
https://redhat.atlassian.net/browse/SRVKP-11021
🔗 Linked GitHub Issue
Fixes #2549
🧪 Testing Strategy
🤖 AI Assistance
If you have used AI assistance, please provide the following details:
Which LLM was used?
Extent of AI Assistance:
Important
If the majority of the code in this PR was generated by an AI, please add a
Co-authored-bytrailer to your commit message.For example:
Co-authored-by: Gemini gemini@google.com
Co-authored-by: ChatGPT noreply@chatgpt.com
Co-authored-by: Claude noreply@anthropic.com
Co-authored-by: Cursor noreply@cursor.com
Co-authored-by: Copilot Copilot@users.noreply.github.com
**💡You can use the script
./hack/add-llm-coauthor.shto automatically addthese co-author trailers to your commits.
✅ Submitter Checklist
fix:,feat:) matches the "Type of Change" I selected above.make testandmake lintlocally to check for and fix anyissues. For an efficient workflow, I have considered installing
pre-commit and running
pre-commit installtoautomate these checks.