Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Add support for Github service connections #264

Merged
merged 1 commit into from
Dec 8, 2021
Merged

Add support for Github service connections #264

merged 1 commit into from
Dec 8, 2021

Conversation

brk3
Copy link
Contributor

@brk3 brk3 commented Oct 20, 2021

PR Checklist

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My code follows the code style of this project.
  • I ran lint checks locally prior to submission.
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Description

In order to source pipeline yamls from Github (non public repos), we
need to create a service connection.

This commit updates the service endpoint functionality to understand a
'type' value. For the existing configs, default type to 'TfsGit' if none
is specified. If type is set to 'Github', then use the new logic under
azdo_service_endpoint.github.tf to provision the connection.

The various values for 'type' are shown at https://registry.terraform.io/providers/microsoft/azuredevops/latest/docs/resources/build_definition#repo_type - however this commit only implements Github.
A similar pattern should be possible to implement Bitbucket / GitHubEnterprise.

NOTE: similar to azdo-pat-admin, a Github PAT must be manually created
and stored in the keyvault identified in the 'keyvault {}' block:

$ az keyvault secret set --name gitub-pat --vault-name --value

Does this introduce a breaking change

  • YES
  • NO

Testing

@ghost
Copy link

ghost commented Oct 20, 2021

CLA assistant check
All CLA requirements met.

@brk3
Copy link
Contributor Author

brk3 commented Oct 20, 2021

Hi, I'm not clear on how testing is done in this framework yet, so have left those boxes unchecked. If there is a way I can go about adding tests for this change please just point me in the right direction :)

In order to source pipeline yamls from Github (non public repos), we
need to create a service connection.

This commit updates the service endpoint functionality to understand a
'type' value. For the existing configs, default type to 'TfsGit' if none
is specified. If type is set to 'Github', then use the new logic under
azdo_service_endpoint.github.tf to provision the connection.

The various values for 'type' are shown at https://registry.terraform.io/providers/microsoft/azuredevops/latest/docs/resources/build_definition#repo_type
- however this commit only implements Github. A similar pattern should
be possible to implement Bitbucket / GitHubEnterprise.

The following shows an example config to use this new functionality:

service_endpoints = {
  github = {
    endpoint_name = "github_endpoint"
    type = "Github"
    project_key = "project_to_add_endpoint_to"
    keyvault = {
      lz_key      = "launchpad"
      key         = "secrets"
      secret_name = "github-pat"
    }
  }
}

NOTE: similar to azdo-pat-admin, a Github PAT must be manually created
and stored in the keyvault identified in the 'keyvault {}' block above:

$ az keyvault secret set --name gitub-pat --vault-name <secrets-vault> --value <pat>
@arnaudlh arnaudlh changed the base branch from master to patch.5.4.4 November 4, 2021 04:04
@arnaudlh arnaudlh modified the milestones: 2011, 2111 Nov 4, 2021
@arnaudlh arnaudlh added the enhancement New feature or request label Nov 4, 2021
@LaurentLesle LaurentLesle changed the base branch from patch.5.4.4 to 2112.int December 7, 2021 07:01
Copy link
Contributor

@iriahk89 iriahk89 left a comment

Choose a reason for hiding this comment

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

conflict with this PR: #283

@iriahk89 iriahk89 dismissed their stale review December 7, 2021 08:25

looks like a good solution actually

Copy link
Contributor

@iriahk89 iriahk89 left a comment

Choose a reason for hiding this comment

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

LGTM

@LaurentLesle LaurentLesle merged commit c638bd5 into Azure:2112.int Dec 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants