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

Add support of remote task on remote Pipeline #1494

Conversation

chmouel
Copy link
Member

@chmouel chmouel commented Nov 8, 2023

We now support remote tasks on remote Pipeline, allowing to share a remote Pipeline across multiple repositories.

User can override tasks from the remote pipeline by adding a task with the same name.

Demo here: https://youtu.be/PetZInZTbM8?si=4P6VoYnl_dSbMAjG

Changes

Submitter Checklist

  • 📝 A good commit message is important for other reviewers to understand the context of your change. Please refer to How to Write a Git Commit Message for more details how to write beautiful commit messages. We rather have the commit message in the PR body and the commit message instead of an external website.
  • ♽ Run make test before submitting a PR (ie: with pre-commit, no need to waste CPU cycle on CI. (or even better install pre-commit and do pre-commit install in the root of this repo).
  • ✨ We heavily rely on linters to get our code clean and consistent, please ensure that you have run make lint before submitting a PR. The markdownlint error can get usually fixed by running make fix-markdownlint (make sure it's installed first)
  • 📖 If you are adding a user facing feature or make a change of the behavior, please verify that you have documented it
  • 🧪 100% coverage is not a target but most of the time we would rather have a unit test if you make a code change.
  • 🎁 If that's something that is possible to do please ensure to check if we can add a e2e test.
  • 🔎 If there is a flakiness in the CI tests then don't necessary ignore it, better get the flakyness fixed before merging or if that's not possible there is a good reason to bypass it. (token rate limitation may be a good reason to skip).

@chmouel chmouel force-pushed the remote-annotations-on-pipeline branch 2 times, most recently from 82b5e82 to 899c60e Compare November 8, 2023 14:21
Copy link

codecov bot commented Nov 8, 2023

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (d81b08e) 61.61% compared to head (46a705e) 61.76%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1494      +/-   ##
==========================================
+ Coverage   61.61%   61.76%   +0.15%     
==========================================
  Files         137      138       +1     
  Lines       10373    10422      +49     
==========================================
+ Hits         6391     6437      +46     
- Misses       3465     3466       +1     
- Partials      517      519       +2     
Files Coverage Δ
pkg/matcher/annotation_tasks_install.go 74.47% <40.00%> (-1.19%) ⬇️
pkg/resolve/remote.go 90.74% <90.74%> (ø)
pkg/resolve/resolve.go 85.79% <86.36%> (+1.05%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@chmouel
Copy link
Member Author

chmouel commented Nov 8, 2023

/test go-testing

Comment on lines 219 to 220
pipelinesascode.tekton.dev/task-1: "./my-task.yaml
pipelinesascode.tekton.dev/task-2: "git-clone"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

task-1, task-2 are just "index", they don't "refer" the name of the Task in the pipeline, right ?

Copy link
Member Author

@chmouel chmouel Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, just because annotation length are not infinite and looks better than having a really long line 🙃


// Merge remote tasks with local tasks
for _, remoteTask := range remoteTasks {
if alreadySeen(types.Tasks, remoteTask) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not this will give preference to local tasks, then remote task?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what happen here, the precedence works like this:

The tasks in the tekton directory (we get all files in .tekton dir and subdir and parses it)
The tasks in the PipelineRun annotations
The tasks in the Pipeline annotations

Maybe we should make the tasks in PipelineRun annotation precedence over tekton directory tasks

Copy link
Member

@piyush-garg piyush-garg Nov 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with this order also, maybe we just mention this in doc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactored the PR to make it more idiomatic, moved it to its own files and improved the docs to make it clear... Please let me know what do you think

@chmouel chmouel force-pushed the remote-annotations-on-pipeline branch 2 times, most recently from 62fccf3 to 71fa73f Compare November 9, 2023 10:02
@chmouel chmouel force-pushed the remote-annotations-on-pipeline branch 2 times, most recently from 82f0239 to 93980fa Compare November 9, 2023 11:58
@piyush-garg
Copy link
Member

lgtm

We now support remote tasks on remote Pipeline, allowing to share
a remote Pipeline across multiple repositories.

User can override tasks from the remote pipeline by adding a task with
the same name.

Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
@chmouel chmouel force-pushed the remote-annotations-on-pipeline branch from 93980fa to 46a705e Compare November 9, 2023 16:18
@savitaashture
Copy link
Member

Can we have E2E for this feature ?

@chmouel
Copy link
Member Author

chmouel commented Nov 9, 2023

@savitaashture not now for the e2e this is well tested in the unittest already..

@savitaashture
Copy link
Member

@savitaashture not now for the e2e this is well tested in the unittest already..

Ah i see

So are you planning to add in another PR ?

@savitaashture savitaashture merged commit 0edaa50 into openshift-pipelines:main Nov 9, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants