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

feat: Add support for Azure DevOps #171

Merged
merged 5 commits into from
Apr 5, 2023
Merged

feat: Add support for Azure DevOps #171

merged 5 commits into from
Apr 5, 2023

Conversation

yitsushi
Copy link
Contributor

This change-set adds Azure DevOps support to pipeline promotions. Based on discussions (on Slack) we decided to go with a "copy as it is" solution to use the new GitProvider used in WGE (PR1 with 2 fixes23).

It's a simple copy-paste what we have in WGE, but with a few addition and changes:

  • [addition] List Pull Requests. If we can't create a PR, we try to find an existing one with Pipelines. That logic does not exist in WGE.
  • [change] Do not create branch if we have no additional commits. On WGE we create a branch with the CreatePullRequest call (except in on case4), but with pipelines we already have the branch with all required files and changes using pure git operations with clone and push. In this case we don't have additional commits, we only have to create the new branch if len(input.commits) > 0.
  • [addition] Name() and SupportedDomain(). These new functions were added to make it easier to verify or test given properties hidden behind the implementation of a Provder interface. We may want to port them back to WGE with extra testing.

Closes #170

Footnotes

  1. https://github.com/weaveworks/weave-gitops-enterprise/pull/2450

  2. https://github.com/weaveworks/weave-gitops-enterprise/pull/2585

  3. https://github.com/weaveworks/weave-gitops-enterprise/pull/2625

  4. https://github.com/weaveworks/weave-gitops-enterprise/blob/main/pkg/git/gitlab.go#L108

@yitsushi yitsushi added enhancement New feature or request promotion Bug or feature related to app promotion labels Mar 31, 2023
@yitsushi yitsushi force-pushed the 170-azure branch 4 times, most recently from 312aa4d to cafdb37 Compare March 31, 2023 15:23
This change-set adds Azure DevOps support to pipeline promotions. Based
on discussions (on Slack) we decided to go with a "copy as it is"
solution to use the new GitProvider used in WGE (PR[^1] with 2 fixes[^2][^3]).

It's a simple copy-paste what we have in WGE, but with a few addition
and changes:

* [addition] List Pull Requests.
  If we can't create a PR, we try to find an existing one with
  Pipelines. That logic does not exist in WGE.
* [change] Do not create branch if we have no additional commits.
  On WGE we create a branch with the CreatePullRequest call (except in
  on case[^4]), but with pipelines we already have the branch with all
  required files and changes using pure git operations with clone and
  push. In this case we don't have additional commits, we only have to
  create the new branch if `len(input.commits) > 0`.
* [addition] `Name()` and `SupportedDomain()`.
  These new functions were added to make it easier to verify or test
  given properties hidden behind the implementation of a Provder interface.
  We may want to port them back to WGE with extra testing.

Additional changes:
* Set Go version to 1.20 to match with WGE.

Closes #170

[^1]: weaveworks/weave-gitops-enterprise#2450
[^2]: weaveworks/weave-gitops-enterprise#2585
[^3]: weaveworks/weave-gitops-enterprise#2625
[^4]: https://github.com/weaveworks/weave-gitops-enterprise/blob/main/pkg/git/gitlab.go#L108

Signed-off-by: Balazs Nadasdi <balazs@weave.works>
Signed-off-by: Balazs Nadasdi <balazs@weave.works>
Signed-off-by: Balazs Nadasdi <balazs@weave.works>
@yitsushi yitsushi marked this pull request as ready for review April 4, 2023 13:50
Copy link
Collaborator

@yiannistri yiannistri left a comment

Choose a reason for hiding this comment

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

Looks great 👍

internal/git/jenkins_scm.go Outdated Show resolved Hide resolved
config/manager/kustomization.yaml Outdated Show resolved Hide resolved
server/strategy/pullrequest/gitprovider_test.go Outdated Show resolved Hide resolved
yitsushi and others added 2 commits April 5, 2023 14:53
Co-authored-by: Yiannis <8741709+yiannistri@users.noreply.github.com>
Signed-off-by: Balazs Nadasdi <balazs@weave.works>
@yitsushi yitsushi merged commit b257662 into main Apr 5, 2023
@yitsushi yitsushi deleted the 170-azure branch April 5, 2023 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request promotion Bug or feature related to app promotion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Azure DevOps
2 participants