-
Notifications
You must be signed in to change notification settings - Fork 271
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
feat: resource_azuredevops_git_repository_branch #713
Conversation
c0f4db6
to
2f02fbb
Compare
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mvinkio Can we change the source_ref
to ref
, tag
or commitId
like the UI pages? By skip the source_ref
, a totally new branch without any other commit history will be created..
azuredevops/internal/acceptancetests/resource_git_repository_branch_test.go
Outdated
Show resolved
Hide resolved
azuredevops/internal/acceptancetests/resource_git_repository_branch_test.go
Outdated
Show resolved
Hide resolved
azuredevops/internal/service/git/resource_git_repository_branch.go
Outdated
Show resolved
Hide resolved
azuredevops/internal/service/git/resource_git_repository_branch.go
Outdated
Show resolved
Hide resolved
Ok, the resource schema should indeed have ref, tag, and commitId fields like in the azure devops GUI when creating new branch.
This creation of branch without existing commit history will be removed. |
010776b
to
d391387
Compare
Also acceptance test TestAccGitRepoFile_Create_IncorrectBranch fails on my machine, it tries to apply regex too the error from the azure devops sdk GetBranch. It works again if I change the regex pattern to |
azuredevops/internal/service/git/resource_git_repository_branch.go
Outdated
Show resolved
Hide resolved
azuredevops/internal/service/git/resource_git_repository_branch.go
Outdated
Show resolved
Hide resolved
azuredevops/internal/service/git/resource_git_repository_branch.go
Outdated
Show resolved
Hide resolved
698f5a0
to
8f30a9e
Compare
azuredevops/internal/service/git/resource_git_repository_branch.go
Outdated
Show resolved
Hide resolved
azuredevops/internal/service/git/resource_git_repository_branch.go
Outdated
Show resolved
Hide resolved
azuredevops/internal/service/git/resource_git_repository_branch.go
Outdated
Show resolved
Hide resolved
290eebb
to
c66d731
Compare
1. Change field source_ref to ref, tag, and commit_id. 2. Remove creation of branch without existing history 3. Remove unnecessary branch exists in acceptance test 4. Replace custom validation with suggested TestCheckResourceAttr 5. Remove Sensitive: false mistake 6. Remove unnecessary call to read in import 7. Remove is_default_branch from computed fields, since the api https://learn.microsoft.com/en-us/rest/api/azure/devops/git/stats/get?view=azure-devops-rest-7.1&tabs=HTTP returns true when non-default branch is on same head commit.
Branch reference was basically a workaround that should be unnecessary. Also added assertions on the format of the `name` field to make it more clear that only shortBranchName format is valid.
Co-authored-by: xuzhang3 <57888764+xuzhang3@users.noreply.github.com>
Current import forced recreate of resource if exactly one of ref_commit_id, ref_tag, ref_branch was given. This is a bit contradicting with the schema. Probably we can add better import that also supports setting ref_tag, ref_branch or ref_commit_id manually using import expression. Something like this is also done in github_branch: <repository_id>:<name>:<ref_(commit_id | tag | branch)> Not sure if necessary. I'll remove import for now I think and maybe make another issue.
@mvinkio LGTM 🎆 |
All Submissions:
What about the current behavior has changed?
Issue Number: #663
Introduce the ability to manage files on branches that are managed by terraform. Maybe an extra acceptance test case should be included that creates/updates a file on a branch managed by terraform that is not the default branch.
Basically, I took inspiration from gitlab_branch and github_branch.
Does this introduce a change to
go.mod
,go.sum
orvendor/
?Does this introduce a breaking change?
Any relevant logs, error output, etc?
To reproduce bug from linked issue:
Should be fixed in second commit of this pull request. Basically we check if the file exists on the right branch as suggested in the original issue and set the ChangeType accordingly.
Other information