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 for Bitbucket Context path #747

Merged
merged 1 commit into from
Apr 23, 2024
Merged

Conversation

gdasson
Copy link
Contributor

@gdasson gdasson commented Feb 24, 2024

Add support for Bitbucket Context path

Fix: #742

@darkowlzz
Copy link
Contributor

darkowlzz commented Feb 27, 2024

@fbuchmeier-abi would you be able to test this fix? There is no patch release planned yet, so it may take time for this to be officially released.

You should be able to build notification-controller container image by running make docker-build IMG=<custom-image-name:tag> at the root of the cloned repository.

@darkowlzz darkowlzz added enhancement New feature or request area/alerting Alerting related issues and PRs backport:release/v1.2.x To be backported to release/v1.2.x labels Feb 27, 2024
@fbuchmeier-abi
Copy link

Hi @darkowlzz ,

thank you very much for the quick fix. I will test it tomorrow and let you know how it works.

@fbuchmeier-abi
Copy link

@fbuchmeier-abi would you be able to test this fix? There is no patch release planned yet, so it may take time for this to be officially released.

You should be able to build notification-controller container image by running make docker-build IMG=<custom-image-name:tag> at the root of the cloned repository.

Hi,

sorry for the late response. I was able to test the fix and it is working fine in our environment with the following configuration:

apiVersion: notification.toolkit.fluxcd.io/v1beta3
kind: Provider
metadata:
  name: bitbucket
  namespace: flux-system
spec:
  type: bitbucketserver
  address: https://example.com/bitbucket/scm/proj/fluxcd.git
  secretRef:
    name: bitbucket-token

Screenshot_20240301_154139

@gdasson
Copy link
Contributor Author

gdasson commented Mar 2, 2024

@fbuchmeier-abi, @fbuchmeier-abi : I have now added code to support all of the scenarios.

Here is how it works:

Look at the last /scm/ in the path (after host). Anything, if present, on left of it is context path. Anything right of it is project/repo. We finally build api path by using the context, project and repo values. We don't care what's on the left of last /scm/ i.e context path may contain any depth or may contain /scm/

@fbuchmeier-abi Could you please test this new code in your env? I have tested in mine for all different scenarios and it works fine.

@darkowlzz : While working on this fix, I realized there were some unused variables being passed in functions. I added the fix for it in this PR. Is it okay to club those fixes with this change or should I revert these and submit a separate PR to fix these?

@darkowlzz
Copy link
Contributor

While working on this fix, I realized there were some unused variables being passed in functions. I added the fix for it in this PR. Is it okay to club those fixes with this change or should I revert these and submit a separate PR to fix these?

@gdasson yes, seems good to me. Thanks.

@fbuchmeier-abi
Copy link

fbuchmeier-abi commented Mar 12, 2024

@gdasson I've built and deployed commit a3d456c in our env and it is working as expected, thanks!

I've used the following provider config:

apiVersion: notification.toolkit.fluxcd.io/v1beta3
kind: Provider
metadata:
  name: bitbucket
  namespace: flux-system
spec:
  type: bitbucketserver
  address: https://example.com/bitbucket/scm/project/sandbox.git
  secretRef:
    name: bitbucket-token

Copy link
Contributor

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

The fix looks good to me but I left a suggestion for an overall improvement of the provider related to URL paths. Please have a look.

@gdasson gdasson force-pushed the fix_742 branch 2 times, most recently from b5ea6c1 to fa5f5a0 Compare March 30, 2024 04:40
Copy link
Contributor

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

The new implementation looks great. Thanks.
Left a few minor comments.

Signed-off-by: Gaurav Dasson <gaurav.dasson@gmail.com>
@gdasson
Copy link
Contributor Author

gdasson commented Apr 21, 2024

@darkowlzz : Fixed all of the review comments. Please review. Thx.

@stefanprodan stefanprodan removed the backport:release/v1.2.x To be backported to release/v1.2.x label Apr 23, 2024
@stefanprodan
Copy link
Member

@gdasson can you please rebase with upstream main

Copy link
Contributor

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @gdasson

@stefanprodan stefanprodan changed the title Add support for Bitbucket Context path - Fix issue #742 Add support for Bitbucket Context path Apr 23, 2024
@stefanprodan stefanprodan merged commit 678f374 into fluxcd:main Apr 23, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/alerting Alerting related issues and PRs enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bitbucket Server Provider does not support custom SSH port or HTTP context path
4 participants