Skip to content

feat(resources): add Bitbucket Data Center DevOps Platform Integration#363

Merged
jdamata merged 2 commits into
jdamata:masterfrom
ryancurrah:feat/support-bitbucket-alm-bindings
Mar 28, 2026
Merged

feat(resources): add Bitbucket Data Center DevOps Platform Integration#363
jdamata merged 2 commits into
jdamata:masterfrom
ryancurrah:feat/support-bitbucket-alm-bindings

Conversation

@ryancurrah

@ryancurrah ryancurrah commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Add support for Bitbucket Data Center (Server) DevOps Platform Integration with SonarQube:

Note: Some files were modified/formatted by go fmt.

  • Add sonarqube_alm_bitbucket resource for managing Bitbucket DevOps Platform settings
  • Add sonarqube_bitbucket_binding resource for binding projects to Bitbucket repos
  • Add sonarqube_alm_bitbucket data source for querying existing configurations
  • Update GetBinding struct to include slug field for Bitbucket support
  • Add example configurations in examples/ directory
  • Generate documentation for new resources and data sources

The implementation follows the same patterns as existing GitLab and GitHub DevOps Platform Integrations. Bitbucket bindings are not supported in Community edition.

API endpoints implemented:

  • POST /api/alm_settings/create_bitbucket
  • POST /api/alm_settings/update_bitbucket
  • POST /api/alm_settings/set_bitbucket_binding
  • GET /api/alm_settings/get_binding
  • POST /api/alm_settings/delete_binding
  • POST /api/alm_settings/delete

Testing performed:

  • terraform apply: successfully created Bitbucket DevOps Platform setting and project binding
  • terraform apply (idempotency): no changes detected, resources remained stable
  • terraform destroy: successfully removed all resources

Comment on lines 15 to 16
// GetBinding for unmarshalling response body from getting project binding details
type GetBinding struct {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Looks like this is used by multiple resources GitLab, GitHub and now Bitbucket.

Add support for Bitbucket Data Center (Server) DevOps Platform Integration with SonarQube:

- Add sonarqube_alm_bitbucket resource for managing Bitbucket DevOps Platform settings
- Add sonarqube_bitbucket_binding resource for binding projects to Bitbucket repos
- Add sonarqube_alm_bitbucket data source for querying existing configurations
- Update GetBinding struct to include slug field for Bitbucket support
- Add example configurations in examples/ directory
- Generate documentation for new resources and data sources

The implementation follows the same patterns as existing GitLab and GitHub
DevOps Platform Integrations. Bitbucket bindings are not supported in
Community edition.

API endpoints implemented:
- POST /api/alm_settings/create_bitbucket
- POST /api/alm_settings/update_bitbucket
- POST /api/alm_settings/set_bitbucket_binding
- GET /api/alm_settings/get_binding
- POST /api/alm_settings/delete_binding
- POST /api/alm_settings/delete

Testing performed:
- terraform apply: successfully created Bitbucket DevOps Platform setting and project binding
- terraform apply (idempotency): no changes detected, resources remained stable
- terraform destroy: successfully removed all resources
@ryancurrah ryancurrah force-pushed the feat/support-bitbucket-alm-bindings branch 3 times, most recently from ebe7a00 to c889fe4 Compare March 26, 2026 23:43
@ryancurrah

ryancurrah commented Mar 26, 2026

Copy link
Copy Markdown
Contributor Author

To try and address the docker-compose flakiness I used ElasticSearches official docker-compose file to improve this one. If it does not work I will revert it.

https://github.com/elastic/elasticsearch/blob/main/docs/reference/setup/install/docker/docker-compose.yml

EDIT:

I removed those modifications. Looks like wget was removed from the search container and they switched to curl in their healthchecks SonarSource/docker-sonarqube@bc05dcd.

@ryancurrah ryancurrah force-pushed the feat/support-bitbucket-alm-bindings branch from c889fe4 to 2d00042 Compare March 27, 2026 15:18
@ryancurrah

ryancurrah commented Mar 27, 2026

Copy link
Copy Markdown
Contributor Author

😢 looks like we got rate limited or something from dockerhub. Maybe retry?

search-2 Error Head "https://registry-1.docker.io/v2/library/sonarqube/manifests/datacenter-search": toomanyrequests: too many failed login attempts for username or IP address
Starting sonarqube service container
  /usr/bin/docker pull sonarqube:lts-community
  Error response from daemon: Head "https://registry-1.docker.io/v2/library/sonarqube/manifests/lts-community": unauthorized: incorrect username or password
  Warning: Docker pull failed with exit code 1, back off 1.009 seconds before retry.

@ryancurrah

ryancurrah commented Mar 28, 2026

Copy link
Copy Markdown
Contributor Author

The build is failing because the lts-datacenter tag hasn't been updated in seven months, while the standard datacenter tag was updated yesterday. Crucially, the old tag contains wget but lacks curl, whereas the new tag has curl but lacks wget. Until the LTS tag is refreshed, we need a health check script compatible with both utilities.

@ryancurrah ryancurrah force-pushed the feat/support-bitbucket-alm-bindings branch from 2d00042 to d7ed08d Compare March 28, 2026 01:12
The lts-datacenter tag hasn't been updated in 7 months and contains wget
but lacks curl, while the new datacenter tag (updated yesterday) has curl
but lacks wget. This change implements a health check script that tries
curl first and falls back to wget if curl is unavailable.

The script:
- Checks for curl availability using command -v and falls back to wget
- Works with both old (lts-datacenter) and new (datacenter) image tags
@ryancurrah ryancurrah force-pushed the feat/support-bitbucket-alm-bindings branch from d7ed08d to 9f93c64 Compare March 28, 2026 01:14
@jdamata jdamata merged commit f65ba59 into jdamata:master Mar 28, 2026
11 checks passed
@ryancurrah ryancurrah deleted the feat/support-bitbucket-alm-bindings branch March 28, 2026 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants