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

refactor: simplify webhook deployment api(breaking) #7545

Merged
merged 1 commit into from
May 30, 2024

Conversation

klesh
Copy link
Contributor

@klesh klesh commented May 30, 2024

Summary

Currently, the Webhook Deployment API supports 2 ways of creating a deployment.

  1. Creating a Deployment that deploys a single repo
POST /plugins/webhook/connections/1/deployments
{
  "pipeline_id": "string",
  "repo_id": "string",
  "repo_url": "string",
  "commit_sha": "string"
   ....
}
  1. Creating a Deployment that deploys multiple repos
POST /plugins/webhook/connections/1/deployments
{
  "pipeline_id": "string",
  "deployment_commits": [
    {
      "repo_id": "string",
      "repo_url": "string",
      "commit_sha": "string"
    },
    {
      "repo_id": "string",
      "repo_url": "string",
      "commit_sha": "string"
    }
  ]
}

This might seem useful for different cases, but it also introduces ambiguity: For those who want to post multiple repos, they often get confused about the repo_id, repo_url and commit_sha in the root node, including our core maintainer.

So, we concluded it would be simpler for both users and maintainers if we supported only one format.

This PR would introduce the following breaking-changes:

  1. Removing the support of the single repo form while keeping the latter which could support both scenarios.
  2. Changing the field name spelling from snake_case to camelCase to align with other API designs.

The final API request would be:

POST /plugins/webhook/connections/1/deployments

{
  "id": "deploy pipeline12 to somewhere",
  "pipelineId": "pipeline12",
  "startedTime": "2024-01-19T12:00:00+00:00",
  "endedTime": "2024-01-20T12:00:00+00:00",
  "result": "SUCCESS",
  "deploymentCommits":[
    {
      "repoId": "optional",
      "startedTime": "2024-01-19T12:00:00+00:00",
      "endedTime": "2024-01-20T12:00:00+00:00",
      "repoUrl": "https://example.com",
      "refName": "release-v0.19",
      "commitSha": "sha-v0.19",
      "commitMsg": "optional"
    }
  ]
}

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. component/plugins This issue or PR relates to plugins pr-type/refactor This PR refactors existing features labels May 30, 2024
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 30, 2024
@d4x1 d4x1 merged commit 723a4db into main May 30, 2024
15 checks passed
@d4x1 d4x1 deleted the kw-webhook-deployment-refactor branch May 30, 2024 08:03
@klesh klesh mentioned this pull request May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change component/plugins This issue or PR relates to plugins lgtm This PR has been approved by a maintainer pr-type/refactor This PR refactors existing features size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants