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

policy.CreatePolicyConfiguration fails with error when trying to unmarshall response from azdo #59

Closed
nmiodice opened this issue Apr 28, 2020 · 12 comments

Comments

@nmiodice
Copy link

The API call for CreatePolicyConfiguration fails with the error described below. My investigation leads me to believe that the error is occurring during the response unmarshalling phase.

API call
https://github.com/microsoft/azure-devops-go-api/blob/dev/azuredevops/policy/client.go#L26

Sample code

	createdPolicy, err := clients.PolicyClient.CreatePolicyConfiguration(clients.Ctx, policy.CreatePolicyConfigurationArgs{
		Configuration: policyConfig,
		Project:       projectID,
	})

	if err != nil) {
		return fmt.Errorf("Error creating policy in Azure DevOps: %+v", err)
	}

Error Response

Error: Error updating policy in Azure DevOps: parsing time ""2020-04-28T19:17:13.1093738"" as ""2006-01-02T15:04:05Z07:00"": cannot parse """ as "Z07:00"

Investigation
This is similar to the issue raised in #17. The fix put forward in that issue, however, is not applicable here because the time returned from the server does not equal 0001-01-01T00:00:00.

Note The policy is actually created in AzDO, which leads me to believe that the unmarshalling error is for this field specifically: https://github.com/microsoft/azure-devops-go-api/blob/dev/azuredevops/policy/models.go#L32

@tmeckel
Copy link
Contributor

tmeckel commented Apr 28, 2020

@nmiodice just wrote @mozehgir an email about the situation here with the GO API. I've the impression that nobody really maintains the GO API, because @tedchamb got assigned to another job and thus the GO API is kinda abandoned.

Especially #47 prevents us from implementing ANY kind of support for permission related stuff in the Terraform provider. That's why my own PR microsoft/terraform-provider-azuredevops#238, about the security framework and the first two permission resource definitions, is on hold for a couple of weeks now.

A very disappointing situation.

@nmiodice
Copy link
Author

:/

@nmiodice
Copy link
Author

@tedchamb
Copy link
Member

I am working with Azure DevOps leadership to find a team to pick up maintenance of the SDK going forward. In the meantime, if I can carve out some free time outside of work, I will do a sweep of the open issues and fix what I can.

Until these issues get addressed, I recommend the following:

  1. Keep submitting issues you find to this repo
  2. fork the repo so you can make your own fixes and tweaks
  3. create PRs back to this repo for any fixes that do not affect the auto-generated code.

cc: @edglas1

Thanks,
Ted

@tmeckel
Copy link
Contributor

tmeckel commented Apr 29, 2020

@tedchamb I think all people working on the Terraform Provider for Azure DevOps are really appreciating your willingness to work on the DevOps GO API aside your normal job as long as no new maintainer has been found!!!! As I mentioned above I'm in contact with @mozehgir, who's the new Program Manager for the Azure DevOps Provider, and I suggested that he takes the DevOps GO API under his oversight as well. It's the only logical consequence, because the DevOps GO API is the foundation of the provider. Perhaps you could get in touch with him and discuss this any further. I copy @nmiodice for reference.

@mozehgir
Copy link

Let me look in to this and get back to all of you.

@nmiodice
Copy link
Author

nmiodice commented May 4, 2020

@tedchamb
Copy link
Member

@nmiodice , if this property is returning a date that is not in the standard format, then it is a service side bug. That doesn't mean we can't create a work around, but the longterm fix is to fix the api.

@nmiodice
Copy link
Author

@tedchamb I agree. I was "instructed" to create an issue here - https://developercommunity.visualstudio.com/content/problem/1010676/policycreatepolicyconfiguration-fails-with-error-w.html

Is there a better way to submit the bug?

nmiodice pushed a commit to nmiodice/azure-devops-go-api that referenced this issue May 16, 2020
tedchamb added a commit that referenced this issue May 16, 2020
workaround for issue #59, support "2006-01-02T15:04:05.999999999" time format
@nmiodice
Copy link
Author

I'll test this early next week and let you know if the fix merged in works for the API we are using. Thanks @tedchamb!

@tedchamb
Copy link
Member

@nmiodice , sorry again for the slow turn around on this. It should be fixed now. If you have any issues with the fix, let me know.

PR #65
Release: https://github.com/microsoft/azure-devops-go-api/releases/tag/azuredevops%2Fv5.1.0-b1

@nmiodice
Copy link
Author

I wanted to circle back and confirm that this issue is resolved:

=== RUN   TestAccAzureDevOpsBranchPolicy_CreateAndUpdate
--- PASS: TestAccAzureDevOpsBranchPolicy_CreateAndUpdate (16.23s)
PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants