-
Notifications
You must be signed in to change notification settings - Fork 257
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
Add support for Azure DevOps RunPipelines service endpoint #184
Add support for Azure DevOps RunPipelines service endpoint #184
Conversation
build has failed by 60 minutes timeout. need a rebuild or increase azdo job timeout. |
@zhmurko Is 'azdoapi' a new devops extension developed by your team? I cannot find an extension type Error message:
|
hello @xuzhang3 thank you for looking into this issue. |
Azure DevOps Service Endpoint can be imported using the serviceendpoint id (resourceId in your browser's url bar), e.g. | ||
|
||
```sh | ||
terraform import azuredevops_serviceendpoint_devops.serviceendpoint db0541e6-ae9f-474d-ab83-1f7913839080 |
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.
terraform import azuredevops_serviceendpoint_devops.serviceendpoint db0541e6-ae9f-474d-ab83-1f7913839080 | |
terraform import azuredevops_serviceendpoint_devops.serviceendpoint projectID/00000000-0000-0000-0000-000000000000` |
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.
[x] updated this documentation page
|
||
## Import | ||
|
||
Azure DevOps Service Endpoint can be imported using the serviceendpoint id (resourceId in your browser's url bar), e.g. |
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.
Azure DevOps Service Endpoint can be imported using the serviceendpoint id (resourceId in your browser's url bar), e.g. | |
Azure DevOps Service Endpoint can be imported using the `project id`, `service connection id` , e.g. |
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.
[x] updated this documentation page
} | ||
|
||
// Convert internal Terraform data structure to an AzDO data structure: | ||
// |
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.
Unused code lines can be removed
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.
[x] removed the commented examples
} | ||
|
||
// Convert AzDO data structure to internal Terraform data structure | ||
// |
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.
Unused code lines can be removed.
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.
[x] removed the commented examples
// ResourceServiceEndpointAzureDevOps schema and implementation for Azure DevOps service endpoint resource | ||
func ResourceServiceEndpointAzureDevOps() *schema.Resource { | ||
r := genBaseServiceEndpointResource(flattenServiceEndpointAzureDevOps, expandServiceEndpointAzureDevOps) | ||
r.Schema["organization"] = &schema.Schema{ |
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.
Can we rename organization
to organization_name
or org_name
?
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.
[x] renamed organization
to organization_name
and updated the documentation page
MinItems: 1, | ||
MaxItems: 1, | ||
Elem: authPersonal, | ||
ConflictsWith: []string{}, |
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.
Conflict schema can be removed.
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.
[x] removed ConflictsWith
authPersonal.Schema[patHashKey] = patHashSchema | ||
r.Schema["auth_personal"] = &schema.Schema{ | ||
Type: schema.TypeSet, | ||
Optional: true, |
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.
If I skip the auth_personal
configuration, after execute terraform apply
, I got error:
Error: Error updating service endpoint in Azure DevOps: Unable to find service connection type 'azdoapi' using authentication scheme 'InstallationToken'.
on main.tf line 5, in resource "azuredevops_serviceendpoint_devops" "serviceendpoint":
5: resource "azuredevops_serviceendpoint_devops" "serviceendpoint" {
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.
added a unit test for default
settings with empty auth_personal
personal block
) | ||
|
||
const ( | ||
azdoPersonalAccessToken = "personal_access_token" |
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.
Duplicate with personalAccessToken
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.
[x] removed this constant value
|
||
```hcl | ||
resource "azuredevops_project" "project" { | ||
project_name = "Sample Project" |
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.
project_name
has been renamed to name
in the latest master
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.
[x] renamed project_name
to name
in project definition in this example
|
||
// validates that an apply followed by another apply (i.e., resource update) will be reflected in AzDO and the | ||
// underlying terraform state. | ||
func TestAccServiceEndpointAzureDevOps_CreateAndUpdate(t *testing.T) { |
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.
This test case is duplicate with TestAccServiceEndpointAzureDevOps_PersonalTokenUpdate
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.
[x] removed this test case and added a test case for default settings
@xuzhang3 thank you for suggestions, I'm going to review and implement them soon |
hi @xuzhang3 |
and one question, does it worth to rename this resource to |
I would suggest rename with |
so I will refactor the code and docs with |
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.
Few changes requested but otherwise looks good. Can we rename function name prefix azdo
to another name like pipelineRunner
or something else, it's a bit odd with prefix azdo
} | ||
|
||
func azdoPersonalAccessTokenField() *schema.Resource { | ||
field_name := "personal_access_token" |
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.
variable name style should follow camel style
} | ||
|
||
// Convert internal Terraform data structure to an AzDO data structure: | ||
func expandServiceEndpointAzureDevOps(d *schema.ResourceData) (*serviceendpoint.ServiceEndpoint, *string, error) { |
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.
function expandServiceEndpointAzureDevOps
never throw an error, I would suggest remove the error
from the return parameter.
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.
done
* rename files to *_serviceendpoint_runpipeline.* * update docs * update acc-tests * update package serviceendpoint * update package serviceendpoint tests * register in provider * update testutils tempalates * update provider test * improve docs
hi @xuzhang3 |
LGTM |
All Submissions:
What about the current behavior has changed?
This pull request introduces a new resource
azuredevops_serviceendpoint_devops
that allows to manage Azure DevOps Service Connection. This connection is used to trigger subsequent builds from Azure Pipelines withtask: RunPipelines@1
yaml definition.Fix for Issue Number: #182
Does this introduce a change to
go.mod
,go.sum
orvendor/
?Does this introduce a breaking change?
(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)
Other information