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 bitbucket datacenter (server) support #2503

Merged
merged 54 commits into from
Feb 20, 2024

Conversation

langecode
Copy link
Contributor

This pull-requests re-introduces the Bitbucket Server support with a more or less complete rewrite of the forge implementation. We have a lot of on-premises git repositories hosted in Bitbucket Server and need a CI solution for running that and Woodpecker looks promising.

The implementation is based on external Bitbucket Server REST client library which we are maintaining and have created in another context. Besides the original support for Bitbucket the re-implementation also adds support for handling Bitbucket pull-request events.

… forge implementation

Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
@langecode
Copy link
Contributor Author

This should solve #2364

Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
@mzampetakis
Copy link
Contributor

This would be a great addition!
I was not aware about the stash name of Bitbucket server edition. I found a bit confusing seeing some parts of the code (e.g. configuration) and others as Bitbucket Server I would prefer to have a common name for documentation, configuration and code. I believe it makes more sense.
What do you think?

web/src/views/repo/RepoWrapper.vue Outdated Show resolved Hide resolved
cmd/server/flags.go Outdated Show resolved Hide resolved
@langecode
Copy link
Contributor Author

This would be a great addition! I was not aware about the stash name of Bitbucket server edition. I found a bit confusing seeing some parts of the code (e.g. configuration) and others as Bitbucket Server I would prefer to have a common name for documentation, configuration and code. I believe it makes more sense. What do you think?

Yeah, we pretty much forked the code before the "old" Bitbucket server was removed so it is legacy from there. But we might try to clean up the naming removing the old "stash" name now that it has been out anyway. I'll try to do a search for "stash" :-)

…'stash' since the forge has been gone anyway

Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
Copy link
Member

@anbraten anbraten left a comment

Choose a reason for hiding this comment

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

Thanks for the nice work in general and for updating the name

docs/docs/91-migrations.md Outdated Show resolved Hide resolved
cmd/server/setup.go Outdated Show resolved Hide resolved
Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
@langecode
Copy link
Contributor Author

Should some documentation be added around migration from 0.15, i.e., you have to rename your environment variables from STASH to BITBUCKET_DC to run major version 1.

@anbraten
Copy link
Member

Should some documentation be added around migration from 0.15, i.e., you have to rename your environment variables from STASH to BITBUCKET_DC to run major version 1.

That would be great.

@woodpecker-bot
Copy link
Collaborator

woodpecker-bot commented Sep 29, 2023

Deployment of preview was successful: https://woodpecker-ci-woodpecker-pr-2503.surge.sh

@langecode
Copy link
Contributor Author

I'll take a look at the linting errors from the builds there also :)

server/forge/bitbucketserver/convert_test.go Outdated Show resolved Hide resolved
web/src/components/atomic/Icon.vue Show resolved Hide resolved
server/forge/bitbucketserver/bitbucketserver.go Outdated Show resolved Hide resolved
cmd/server/setup.go Outdated Show resolved Hide resolved
@qwerty287 qwerty287 added forge/bitbucket bitbucket forge related feature add new functionality labels Sep 29, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 29, 2023

Codecov Report

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

Comparison is base (65d88be) 36.67% compared to head (a6f247e) 36.41%.
Report is 19 commits behind head on main.

❗ Current head a6f247e differs from pull request most recent head 400fbc9. Consider uploading reports for the commit 400fbc9 to get more accurate results

Files Patch % Lines
...r/forge/bitbucketdatacenter/bitbucketdatacenter.go 14.15% 359 Missing and 5 partials ⚠️
cmd/server/setup.go 0.00% 12 Missing ⚠️
...erver/forge/bitbucketdatacenter/internal/client.go 64.00% 6 Missing and 3 partials ⚠️
server/forge/bitbucketdatacenter/convert.go 92.30% 6 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2503      +/-   ##
==========================================
- Coverage   36.67%   36.41%   -0.26%     
==========================================
  Files         225      228       +3     
  Lines       14788    15385     +597     
==========================================
+ Hits         5423     5603     +180     
- Misses       8972     9379     +407     
- Partials      393      403      +10     

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

Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
Merge remote-tracking branch 'upstream/main' into feature/reintroduce-bitbucketserver

Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
… with push permissions are shown anyway (api/users.go:114)

Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
@anbraten anbraten changed the title feat: Re-introduce bitbucket server support Add bitbucket datacenter (sever) support Oct 8, 2023
Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
Copy link
Member

@anbraten anbraten left a comment

Choose a reason for hiding this comment

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

thanks for the additional work
code (apart from remaining points) lgtm
just prettier, lint and go mod tidy left

@langecode
Copy link
Contributor Author

thanks for the additional work code (apart from remaining points) lgtm just prettier, lint and go mod tidy left

Thanks - I am just in the proces of testing the OAuth 2.0 implementation against our Bitbucket on-prem - I'll do the last clean up and let you know when I have verified that it works as intended.

@6543 6543 added this to the 2.4.0 milestone Feb 20, 2024
Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
@6543
Copy link
Member

6543 commented Feb 20, 2024

@langecode just noticed that the license header should be updated ... a smal nit before merging ;)

Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
@langecode
Copy link
Contributor Author

We have confirmed that OAuth 2.0 is indeed working now. Actually quiet nice to get rid of that old authentication stuff.

@6543 6543 enabled auto-merge (squash) February 20, 2024 14:47
@6543 6543 merged commit 364d708 into woodpecker-ci:main Feb 20, 2024
7 checks passed
@woodpecker-bot woodpecker-bot mentioned this pull request Feb 18, 2024
1 task
anbraten added a commit that referenced this pull request Mar 19, 2024
## [2.4.0](https://github.com/woodpecker-ci/woodpecker/releases/tag/2.4.0) - 2024-03-19

### 🔒 Security

- Improve security context handling
[[#3482](#3482)]
- fix(deps): update module github.com/moby/moby to v24.0.9+incompatible
[[#3323](#3323)]

### ✨ Features

- Cli setup command
[[#3384](#3384)]
- Add bitbucket datacenter (server) support
[[#2503](#2503)]
- Cli updater
[[#3382](#3382)]

### 📚 Documentation

- Delete docs for v0.15.x
[[#3508](#3508)]
- Add deployment plugin
[[#3495](#3495)]
- Bump follow-redirects and fix broken anchors
[[#3488](#3488)]
- fix: plugin doc page not found
[[#3480](#3480)]
- Documentation improvements
[[#3376](#3376)]
- fix(deps): update docs npm deps non-major
[[#3455](#3455)]
- Add "Sonatype Nexus" plugin
[[#3446](#3446)]
- Add blog post
[[#3439](#3439)]
- Add "Gradle Wrapper Validation" plugin
[[#3435](#3435)]
- Add blog post
[[#3410](#3410)]
- Extend core ideas documentation
[[#3405](#3405)]
- docs: fix contributions link
[[#3363](#3363)]
- Update/fix some docs
[[#3359](#3359)]
- chore(deps): update dependency marked to v12
[[#3325](#3325)]

### 🐛 Bug Fixes

- Fix skip setup for some general cli commands
[[#3498](#3498)]
- Move generic agent flags to cmd/agent/core
[[#3484](#3484)]
- Fix usage of WOODPECKER_DATABASE_DATASOURCE_FILE
[[#3404](#3404)]
- Set pull-request id and labels on pr-closed event
[[#3442](#3442)]
- Update org name on login
[[#3409](#3409)]
- Do not alter secret key upper-/lowercase
[[#3375](#3375)]
- fix: can't run multiple services on k8s
[[#3395](#3395)]
- Fix agent polling
[[#3378](#3378)]
- Remove empty strings from slice before parsing agent config
[[#3387](#3387)]
- Set correct link for commit
[[#3368](#3368)]
- Fix schema links
[[#3369](#3369)]
- Fix correctly handle gitlab pr closed events
[[#3362](#3362)]
- fix: update schema event_enum to remove error warning when.event
[[#3357](#3357)]
- Fix version check on next
[[#3340](#3340)]
- Ignore gitlab merge request events without code changes
[[#3338](#3338)]
- Ignore gitlab push events without commits
[[#3339](#3339)]
- Consider gitlab inherited permissions
[[#3308](#3308)]
- fix: agent panic when node is terminated during step execution
[[#3331](#3331)]

### 📈 Enhancement

- Enable golangci linter gomnd
[[#3171](#3171)]
- Apply "grpcnotrace" go build tag
[[#3448](#3448)]
- Simplify store interfaces
[[#3437](#3437)]
- Deprecate alternative names on secrets
[[#3406](#3406)]
- Store workflows/steps for blocked pipeline
[[#2757](#2757)]
- Parse email from Gitea webhook
[[#3420](#3420)]
- Replace http types on forge interface
[[#3374](#3374)]
- Prevent agent deletion when it's still running tasks
[[#3377](#3377)]
- Refactor internal services
[[#915](#915)]
- Lint for event filter and deprecate `exclude`
[[#3222](#3222)]
- Allow editing all environment variables in pipeline popups
[[#3314](#3314)]
- Parse backend options in backend
[[#3227](#3227)]
- Make agent usable for external backends
[[#3270](#3270)]
- Add no branches text
[[#3312](#3312)]
- Add loading spinner to repo list
[[#3310](#3310)]

### Misc

- Post on mastodon when releasing a new version
[[#3509](#3509)]
- chore(deps): update dependency alpine_3_18/ca-certificates to
v20240226
[[#3501](#3501)]
- fix(deps): update module github.com/google/go-github/v59 to v60
[[#3493](#3493)]
- fix(deps): update dependency @intlify/unplugin-vue-i18n to v3
[[#3492](#3492)]
- chore(deps): update dependency vue-tsc to v2
[[#3491](#3491)]
- chore(deps): update dependency eslint-config-airbnb-typescript to v18
[[#3490](#3490)]
- chore(deps): update web npm deps non-major
[[#3489](#3489)]
- fix(deps): update golang (packages)
[[#3486](#3486)]
- fix(deps): update module google.golang.org/protobuf to v1.33.0
[security]
[[#3487](#3487)]
- chore(deps): update docker.io/techknowlogick/xgo docker tag to
go-1.22.1
[[#3476](#3476)]
- chore(deps): update docker.io/golang docker tag to v1.22.1
[[#3475](#3475)]
- Update prettier version
[[#3471](#3471)]
- chore(deps): update woodpeckerci/plugin-ready-release-go docker tag to
v1.1.0 [[#3464](#3464)]
- chore(deps): lock file maintenance
[[#3465](#3465)]
- chore(deps): update postgres docker tag to v16.2
[[#3461](#3461)]
- chore(deps): update lycheeverse/lychee docker tag to v0.14.3
[[#3429](#3429)]
- fix(deps): update golang (packages)
[[#3430](#3430)]
- More `when` filters
[[#3407](#3407)]
- Apply `documentation`/`ui` label to corresponding renovate updates
[[#3400](#3400)]
- chore(deps): update dependency eslint-plugin-simple-import-sort to v12
[[#3396](#3396)]
- chore(deps): update typescript-eslint monorepo to v7 (major)
[[#3397](#3397)]
- fix(deps): update module github.com/google/go-github/v58 to v59
[[#3398](#3398)]
- chore(deps): update docker.io/techknowlogick/xgo docker tag to
go-1.22.0
[[#3392](#3392)]
- chore(deps): update docker.io/golang docker tag
[[#3391](#3391)]
- fix(deps): update golang (packages)
[[#3393](#3393)]
- chore(deps): update docker.io/woodpeckerci/plugin-docker-buildx docker
tag to v3.1.0
[[#3394](#3394)]
- Add link checking
[[#3371](#3371)]
- Apply `dependencies` label to all PRs
[[#3358](#3358)]
- chore(deps): update docker.io/woodpeckerci/plugin-docker-buildx docker
tag to v3.0.1
[[#3324](#3324)]

---------

Co-authored-by: 6543 <m.huber@kithara.com>
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature add new functionality forge/bitbucket bitbucket forge related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants