notification-controller icon indicating copy to clipboard operation
notification-controller copied to clipboard

Add support for Bitbucket Context path - Fix issue #742

Open gdasson opened this issue 1 year ago • 6 comments

Add support for Bitbucket Context path

Fix: #742

gdasson avatar Feb 24 '24 06:02 gdasson

@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 avatar Feb 27 '24 16:02 darkowlzz

Hi @darkowlzz ,

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

fbuchmeier-abi avatar Feb 27 '24 18:02 fbuchmeier-abi

@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

fbuchmeier-abi avatar Mar 01 '24 14:03 fbuchmeier-abi

@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?

gdasson avatar Mar 02 '24 19:03 gdasson

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.

darkowlzz avatar Mar 04 '24 11:03 darkowlzz

@gdasson I've built and deployed commit a3d456c8b2a6199209a11af96e101848e25d54e0 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

fbuchmeier-abi avatar Mar 12 '24 16:03 fbuchmeier-abi

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

gdasson avatar Apr 21 '24 04:04 gdasson

@gdasson can you please rebase with upstream main

stefanprodan avatar Apr 23 '24 13:04 stefanprodan