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

Extend ParseIncomingWebhook function to handle tag related events #80

Merged
merged 4 commits into from
Apr 27, 2023

Conversation

pavelmemory
Copy link
Contributor

@pavelmemory pavelmemory commented Apr 25, 2023

  • All tests passed. If this feature is not already covered by the tests, I added new tests.
  • I used go fmt ./... for formatting the code before submitting the pull request.
  • This feature is included on all supported VCS providers - GitHub, Bitbucket cloud, Bitbucket server, and GitLab.

The tag creation and removal webhook events now can be parsed by the ParseIncomingWebhook() function. The information about the tag is stored in the new Tag field of the WebhookInfo type. Also, the two new events added: TagPushed and TagRemoved to represent each of these operations.

@pavelmemory pavelmemory changed the title Tag pushed Extend ParseIncomingWebhook function to handle tag related events Apr 27, 2023
@yahavi yahavi self-requested a review April 27, 2023 07:16
@@ -228,14 +266,27 @@ type bitbucketPush struct {
}

type bitbucketChange struct {
Copy link
Member

Choose a reason for hiding this comment

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

Looks like the "New" and the "Old" can be exported to a new struct to remove duplications.
I suggest doing the following:

  1. Create a new struct "bitbucketResourceChange" (or something equivalent) with Name, Target, Type, and Message
  2. Old and New will be of type bitbucketResourceChange

vcsutils/webhookparser/bitbucketcloud_test.go Outdated Show resolved Hide resolved
@@ -262,6 +265,79 @@ func TestBitbucketServerParseIncomingPrWebhook(t *testing.T) {
})
}
}
func TestBitbucketServer_parseIncomingWebhookTagEvents(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func TestBitbucketServer_parseIncomingWebhookTagEvents(t *testing.T) {
func TestBitbucketServerParseIncomingWebhookTagEvents(t *testing.T) {

vcsutils/webhookparser/github.go Outdated Show resolved Hide resolved
@@ -328,6 +330,78 @@ func TestGithubParseIncomingPrWebhook(t *testing.T) {
}
}

func TestGitHub_parseIncomingWebhookTagEvents(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func TestGitHub_parseIncomingWebhookTagEvents(t *testing.T) {
func TestGitHubParseIncomingWebhookTagEvents(t *testing.T) {

vcsutils/webhookparser/gitlab_test.go Outdated Show resolved Hide resolved
vcsutils/webhookparser/webhookparser.go Outdated Show resolved Hide resolved
The general WebhookInfo is extended and now encapsulates
information about the tag event. The webhook parsing logic
is able to process tag event and return valid WebhookInfo
for the GitLab VCS.
The general WebhookInfo is extended and now encapsulates
information about the tag event. The webhook parsing logic
is able to process tag event and return valid WebhookInfo
for the Bitbucket Server VCS.
The general WebhookInfo is extended and now encapsulates
information about the tag event. The webhook parsing logic
is able to process tag event and return valid WebhookInfo
for the Bitbucket Cloud VCS.
The general WebhookInfo is extended and now encapsulates
information about the tag event. The webhook parsing logic
is able to process tag event and return valid WebhookInfo
for the GitHub VCS.
@yahavi yahavi added the improvement Automatically generated release notes label Apr 27, 2023
@yahavi yahavi merged commit ba6997f into jfrog:master Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Automatically generated release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants