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

[Bitbucket] Use workspaces instead of deprecated/removed teams path #1166

Merged
merged 8 commits into from
Sep 18, 2022

Conversation

MartinHerren
Copy link
Contributor

Crude fix to allow to correctly list workspaces for bitbucket cloud (https://bitbucket.org) and so run a pipeline.
Last year they removed a bunch of deprecated APIs and replaced them with new ones.

User management is still broken (maybe even more with this PR), it doesn't retrieve correct user info like email for example.

Unit tests are not yet aligned with my changes. Will try to fix that.

Got a server running locally connected to bitbucket.org, can privately provide the url if someone needs testing.

Discovered a 'feature' of bitbucket: oauth2 tokens are created at 'workspace' level but are not scoped to a specific workspace, so anyone with a bitbucket.org account can login into woodpecker. This makes it important not to allow user registration, if not possible use filters to allow only the desired workspaces in order to prevent anyone to abuse your server and runners to build their own pipelines.

I also renamed a few functions containing 'Team' to 'Workspace'. I don't know the convention here, if inside a forge you prefer to keep the 'woodpecker terminology' or the 'server specific terminology'. There is no notion of 'Team' in bitbucket cloud. Only workspaces and projects. From what i understood a repo is part of a workspace and can be part of a project. A project only serves to apply some global git settings (like merge strategies) to a group of repos. User management is done at workspace and repo level. Also the git url only contains the workspace and repo.

I'm not a Go developer yet so still learning...

Signed-off-by: Martin Herren martin.herren@gmail.com

@6543 6543 added bug Something isn't working wip forge/bitbucket bitbucket forge related labels Sep 3, 2022
@6543 6543 added this to the 1.0.0 milestone Sep 3, 2022
@6543
Copy link
Member

6543 commented Sep 4, 2022

what whould help, is if you can post raw json webhook data ... so we can adjust webhook parsing :)

@MartinHerren
Copy link
Contributor Author

what whould help, is if you can post raw json webhook data ... so we can adjust webhook parsing :)

@6543 I'm not sure i understand exactly what you need

@6543
Copy link
Member

6543 commented Sep 7, 2022

Please dont force-push, pulls get squash-merged anyway.

Just merge master into it and push

@6543
Copy link
Member

6543 commented Sep 7, 2022

With webhook request body, i mean the raw data bitbucket send via http(s) to woodpecker-server on events happening on bitbucket

It's data encoded as json in plain text in an http(s)-request in the so called body

@6543
Copy link
Member

6543 commented Sep 7, 2022

Gitea/github/gitlab lets you obtain it in the repo-settings if webhooks are enabled and already got send by cliking on an webhook entry to see details

Signed-off-by: Martin Herren <martin.herren@gmail.com>
@MartinHerren
Copy link
Contributor Author

Rebased on master and fixed the build of the tests. Now there are still 2 tests not passing.

@6543
Copy link
Member

6543 commented Sep 7, 2022

@MartinHerren please dont rebase :/

-> #1166 (comment)

@6543
Copy link
Member

6543 commented Sep 7, 2022

pull title and description will be used on merge for the final commit

@MartinHerren
Copy link
Contributor Author

Sorry i'm used to rebase my wip branches to keep all my branches and my history clean... automatic reflex. Will try not to rebase.

@MartinHerren
Copy link
Contributor Author

Gitea/github/gitlab lets you obtain it in the repo-settings if webhooks are enabled and already got send by cliking on an webhook entry to see details

Ok, think i found a way to activate history logging of webhooks. Just need to create a dummy project on my test account to generate the webhook data.

@MartinHerren

This comment was marked as resolved.

@aabril2me
Copy link

+1 to this PR.

My golang skills are limited at the moment, I'd love to contribute.

@MartinHerren
Copy link
Contributor Author

+1 to this PR.

My golang skills are limited at the moment, I'd love to contribute.

Yes, time to finish this PR ! Will attack the testing part again.

@6543 6543 changed the title [WIP][Bitbucket] Use workspaces instead of deprecated/removed teams path [Bitbucket] Use workspaces instead of deprecated/removed teams path Sep 18, 2022
@6543 6543 removed the wip label Sep 18, 2022
@6543 6543 merged commit 1d47da6 into woodpecker-ci:master Sep 18, 2022
@6543
Copy link
Member

6543 commented Sep 18, 2022

So a step closer to working BB :)

@MartinHerren
Copy link
Contributor Author

So a step closer to working BB :)

Yeah, thanks ! The next bigger step i see is probably the user management.
Then

  • register/handle the other webhooks
  • handle multi pipelines
    But know it is already possible to build pipelines !

Thanks !

@MartinHerren MartinHerren deleted the bitbucket_get_repo_fix branch September 27, 2022 19:35
@aabril2me
Copy link

aabril2me commented Sep 28, 2022

in my company, we are migrating to woodpecker thanks to this PR.
Appreciate that @MartinHerren !!

@6543
Copy link
Member

6543 commented Sep 28, 2022

ok let's chat at #1047 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working forge/bitbucket bitbucket forge related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants