Skip to content

Conversation

@zahiar
Copy link
Contributor

@zahiar zahiar commented Nov 12, 2021

Due to an undocumented quirk in Bitbucket's API, when updating a repository, you have to pass in two additional fields which are then used together, to match the string representation of the fork_policy (which the API returns - the other two fields are not returned).

Here is a link to an oustanding bug ticket filed with Atlassian: https://jira.atlassian.com/browse/BCLOUD-13093

Also added tests to cover the behaviour above, as well as an additional one for creating a repository, to ensure this functionality was not broken with the changes introduced.

@zahiar
Copy link
Contributor Author

zahiar commented Nov 12, 2021

Tests pass including the new ones TestCreateRepositoryRepositories & TestRepositoryUpdateForkPolicy 🙌

go test -v ./tests/repository_test.go
=== RUN   TestGetRepositoryRepositories
--- PASS: TestGetRepositoryRepositories (3.57s)
=== RUN   TestCreateRepositoryRepositories
--- PASS: TestCreateRepositoryRepositories (4.47s)
=== RUN   TestRepositoryUpdateForkPolicy
--- PASS: TestRepositoryUpdateForkPolicy (2.87s)
=== RUN   TestGetRepositoryPipelineVariables
--- PASS: TestGetRepositoryPipelineVariables (1.04s)
=== RUN   TestDeleteRepositoryPipelineVariables
--- PASS: TestDeleteRepositoryPipelineVariables (1.59s)

Due to an undocumented quirk in Bitbucket's API, when updating a repository, you have to pass in two additional fields which are then used together, to match the string representation of the fork_policy (which the API returns - the other two fields are not returned).

Here is a link to an oustanding bug ticket filed with Atlassian: https://jira.atlassian.com/browse/BCLOUD-13093

Also added tests to cover the behaviour above, as well as an additional one for creating a repository, to ensure this functionality was not broken with the changes introduced.
@zahiar zahiar force-pushed the fix-repo-fork-policy-update branch from 1a42ba0 to 9992407 Compare November 12, 2021 20:58
Copy link
Owner

@ktrysmt ktrysmt left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you.

@ktrysmt ktrysmt merged commit 3b8dd11 into ktrysmt:master Nov 14, 2021
@zahiar zahiar deleted the fix-repo-fork-policy-update branch November 14, 2021 19:47
zahiar referenced this pull request in zahiar/terraform-provider-bitbucket Nov 14, 2021
This includes two PRs:
1. To add functionality to support `deploy-keys` - `https://github.com/ktrysmt/go-bitbucket/pull/167`
2. To fix a bug with `fork_policy` not being updated after initially being set - `https://github.com/ktrysmt/go-bitbucket/pull/168`
zahiar referenced this pull request in zahiar/terraform-provider-bitbucket Nov 14, 2021
* GH-29 Add deploy key resource & data source

Along with docs.

* GH-29 Update `go-bitbucket` to latest version

This includes two PRs:
1. To add functionality to support `deploy-keys` - `https://github.com/ktrysmt/go-bitbucket/pull/167`
2. To fix a bug with `fork_policy` not being updated after initially being set - `https://github.com/ktrysmt/go-bitbucket/pull/168`
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