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 PipelineListsOptions to woodpecker-go #3652

Merged
merged 12 commits into from
Nov 26, 2024
Merged

Add PipelineListsOptions to woodpecker-go #3652

merged 12 commits into from
Nov 26, 2024

Conversation

xoxys
Copy link
Member

@xoxys xoxys commented Apr 26, 2024

I fear that's a breaking change... It's a bit pain IMO that we can not version the go lib independent of the server.

I don't see a (good) way to make it non-breaking. If you have a better idea, please let me know. However, as this will be breaking anyway, we should replace all other raw query parameters used in the lib (e.g. https://github.com/woodpecker-ci/woodpecker/blob/main/woodpecker-go/woodpecker/repo.go#L6) by proper opt structs as well as this makes it easier to extend with future options.

Changes:

  • Add PipelineListOptions and expose them to cli
❯ ./dist/woodpecker-cli pipeline ls --format "#{{ .Number }} {{ .Started }}" --before "2023-08-21T21:11:02+02:00" 2
#1 1692644861
❯ ./dist/woodpecker-cli pipeline ls --format "#{{ .Number }} {{ .Started }}" --after "2023-12-11T15:07:04+01:00" 2
#43 1702762952
  • Add RepoListOptions and expose them to cli
❯ ./dist/woodpecker-cli repo ls --all
testorg/test (id: 2, forgeRemoteID: 3, isActive: true)
testorg2/test2 (id: 4, forgeRemoteID: 4, isActive: true)
woodpecker/woodpecker-test (id: 0, forgeRemoteID: 1, isActive: false)
testorg/woodpecker-test (id: 6, forgeRemoteID: 2, isActive: true)
  • Add DeployOptions
  • Add PipelineStartOptions
  • Add PipelineLastOptions
  • Add RepoPostOptions
  • Add RepoMoveOptions

@xoxys xoxys requested a review from a team April 26, 2024 19:33
@xoxys xoxys added breaking will break existing installations if no manual action happens lib about our woodpecker-go api lib labels Apr 26, 2024
@xoxys
Copy link
Member Author

xoxys commented Apr 26, 2024

How do we handle such PRs in general? Keep it open until we want to do a major version bump?

@qwerty287
Copy link
Contributor

We actually just merged them and ignored that they're breaking...

@xoxys
Copy link
Member Author

xoxys commented Apr 27, 2024

Maybe we should just move the lib to a dedicated repo? But same argumentation might apply to cli, agent etc. which would end in a repo mess instead of the current monorepo approach. So maybe a bad idea 🙃

@woodpecker-bot
Copy link
Collaborator

woodpecker-bot commented Apr 27, 2024

Deployment of preview was torn down

Copy link
Contributor

@qwerty287 qwerty287 left a comment

Choose a reason for hiding this comment

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

Current code lgtm, but you introduced a ListOptions type, but did not apply it to all list api methods.

Missing in:
UserList
RegistryList
CronList
SecretList

Thanks for adding tests

@xoxys
Copy link
Member Author

xoxys commented Jun 20, 2024

That's correct. It's already on my to-do list thanks for the reminder :)

@6543
Copy link
Member

6543 commented Jun 20, 2024

before we merge this, I want to have a bugfix release!

@xoxys
Copy link
Member Author

xoxys commented Jun 20, 2024

... Nobody wanted to rush through especially not because the PR is not finished and requires a major version bump...

@qwerty287
Copy link
Contributor

qwerty287 commented Jun 20, 2024

I agree, but which bugfixes should the contained in this patch release? There's no open/merged PR currently (except some docs enhancements) and AFAIK there was nothing critical reported

@6543
Copy link
Member

6543 commented Jul 13, 2024

I want a majour bump soon-isch to get some breaking stuff done ...

... so we can just wait till that

@xoxys
Copy link
Member Author

xoxys commented Jul 13, 2024

I dont get your point. This PR was marked as breaking all the time. Its was already planned to wait with a merge till the next breaking release all the time.

First you want a bugfix release first (I still dont know how this is related to this PR) now you want a major soonish 🤷‍♂️

Im (again) pretty confused about this communication style. Just dropping a single sentence and not responding to any question is pretty bad.

@6543 6543 added this to the 3.x.x milestone Jul 14, 2024
@qwerty287 qwerty287 modified the milestones: 3.x.x, 3.0.0 Jul 17, 2024
@xoxys
Copy link
Member Author

xoxys commented Aug 3, 2024

Current code lgtm, but you introduced a ListOptions type, but did not apply it to all list api methods.

Missing in: UserList RegistryList CronList SecretList

@qwerty287 Was looking into it again. These client methods don't have any additional options. Should we still add an empty options type?

@xoxys
Copy link
Member Author

xoxys commented Aug 3, 2024

If we want to add empty list option types to every list method, what about:

	OrgRegistryList(orgID int64) ([]*Registry, error)
	GlobalRegistryList() ([]*Registry, error)
	OrgSecretList(orgID int64) ([]*Secret, error)
	GlobalSecretList() ([]*Secret, error)
	AgentList() ([]*Agent, error)
	AgentTasksList(int64) ([]*Task, error)

@qwerty287
Copy link
Contributor

My comment was about the pagination options. They're not supported yet, you need to add them and also add the query params to the URL.

@6543
Copy link
Member

6543 commented Sep 5, 2024

ci faild related

@pat-s
Copy link
Contributor

pat-s commented Nov 24, 2024

@xoxys Do you want to get this into 3.0? Currently consolidating and the state here is unclear to me.

I understand that it could potentially be merged in 3.x as it is considered an independent part of the toolstack anyhow. Yet of course it would be matching to get it into 3.0, but it shouldn't cause any stress.

@xoxys
Copy link
Member Author

xoxys commented Nov 25, 2024

Ill finish the PR this week. Would like to get it into 3.0

@6543
Copy link
Member

6543 commented Nov 25, 2024

INFO: if #2691 lands this here should not be needed anymore ...

@xoxys
Copy link
Member Author

xoxys commented Nov 25, 2024

As this PP is in draft state since a year any plans to finish it soon? Otherwise Ill continue to get it to v3.

@6543
Copy link
Member

6543 commented Nov 25, 2024

If this pull is ready before it, we merge it ... I would argue

@xoxys
Copy link
Member Author

xoxys commented Nov 25, 2024

Ok so the answer is there is no timeline to finish the linked PR. Then Ill continue with this one for now.

@xoxys
Copy link
Member Author

xoxys commented Nov 25, 2024

My comment was about the pagination options. They're not supported yet, you need to add them and also add the query params to the URL.

@qwerty287 Sorry I still dont really understand why we need to add the pagination to e.g. RegistryList but not OrgRegistryList. Can you add some more details?

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 71.94245% with 39 lines in your changes missing coverage. Please review.

Project coverage is 27.89%. Comparing base (ebf9f9c) to head (22e2f9f).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
cli/deploy/deploy.go 0.00% 6 Missing ⚠️
cli/pipeline/list.go 79.31% 4 Missing and 2 partials ⚠️
cli/pipeline/last.go 0.00% 5 Missing ⚠️
cli/pipeline/start.go 0.00% 5 Missing ⚠️
cli/repo/repo_add.go 0.00% 5 Missing ⚠️
cli/repo/repo_list.go 0.00% 5 Missing ⚠️
cli/repo/repo_sync.go 0.00% 5 Missing ⚠️
cli/pipeline/info.go 0.00% 1 Missing ⚠️
cli/pipeline/ps.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3652      +/-   ##
==========================================
+ Coverage   27.57%   27.89%   +0.32%     
==========================================
  Files         381      382       +1     
  Lines       27923    28015      +92     
==========================================
+ Hits         7700     7816     +116     
+ Misses      19538    19512      -26     
- Partials      685      687       +2     

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

@qwerty287
Copy link
Contributor

My comment was about the pagination options. They're not supported yet, you need to add them and also add the query params to the URL.

@qwerty287 Sorry I still dont really understand why we need to add the pagination to e.g. RegistryList but not OrgRegistryList. Can you add some more details?

That's a pretty old thread, I can't remember that I said something like this. All paginated api endpoints should have pagination options in the sdk as well.

@pat-s
Copy link
Contributor

pat-s commented Nov 26, 2024

Alright, everyone seems to be (somewhat) happy -> 🚀

@pat-s pat-s merged commit bf1750a into main Nov 26, 2024
9 checks passed
@pat-s pat-s deleted the wp-go-opts branch November 26, 2024 10:50
@xoxys
Copy link
Member Author

xoxys commented Nov 26, 2024

Noooo :D There was an ongoing discussion, and I was preparing the fix :D Anyway, then it will go into a dedicated PR. Note to myself: Block PRs on my own if I plan to add more changes 🙈

@woodpecker-bot woodpecker-bot mentioned this pull request Nov 26, 2024
1 task
@pat-s
Copy link
Contributor

pat-s commented Nov 26, 2024

Sorry! To me it read like everything was resolved and you did all required changes 🙈️

@xoxys
Copy link
Member Author

xoxys commented Nov 26, 2024

All good. The PR is good as is, and the missing pagination options in sdk for all api endpoints that supports it can be implemented in a follow-up PR. I'll take care.

@6543 6543 added the enhancement improve existing features label Nov 26, 2024
@woodpecker-bot woodpecker-bot mentioned this pull request Dec 14, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking will break existing installations if no manual action happens enhancement improve existing features lib about our woodpecker-go api lib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants