-
Notifications
You must be signed in to change notification settings - Fork 642
feat: add support for creating deployments by project name #8611
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
base: main
Are you sure you want to change the base?
Changes from all commits
f9b3b1a
6fe7d4e
ad2ebc3
234df77
b79d3ac
2aef41c
30434c2
0ddce2c
e13f552
463f094
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # Ensure all text files use LF (Linux) line endings | ||
| * text=auto eol=lf | ||
|
|
||
| # Treat shell scripts as text and enforce LF | ||
| *.sh text eol=lf | ||
|
|
||
| # Treat Go files as text and enforce LF | ||
| *.go text eol=lf | ||
|
|
||
| # Treat Python files as text and enforce LF | ||
| *.py text eol=lf | ||
|
|
||
| # Treat JavaScript files as text and enforce LF | ||
| *.js text eol=lf | ||
|
|
||
| # Treat Markdown files as text and enforce LF | ||
| *.md text eol=lf | ||
|
|
||
| # Treat configuration files as text and enforce LF | ||
| *.yml text eol=lf | ||
| *.yaml text eol=lf | ||
| *.json text eol=lf | ||
|
|
||
| # Prevent CRLF normalization for binary files | ||
| *.png binary | ||
| *.jpg binary | ||
| *.jpeg binary | ||
| *.gif binary | ||
| *.pdf binary | ||
| *.zip binary | ||
| *.tar binary | ||
| *.gz binary | ||
| *.bz2 binary | ||
| *.xz binary |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,6 +93,16 @@ func RegisterRouter(r *gin.Engine, basicRes context.BasicRes) { | |
| } | ||
| // mount all api resources for all plugins | ||
| for pluginName, apiResources := range resources { | ||
| if pluginName == "webhook" { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not the way to handle route conflict. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not exactly a conflict, but more a duplicate route not wanted. The way routing is done, this route, because how it is defined on the plugin, would have resulted in the route There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is wrong with |
||
| // we need to register the project webhook endpoint first to avoid route conflict | ||
| const endpointName = "projects/:projectName/deployments" | ||
| if methodMap, ok := apiResources[endpointName]; ok { | ||
| if handler, ok := methodMap["POST"]; ok { | ||
| r.Handle("POST", fmt.Sprintf("/%s", endpointName), handlePluginCall(basicRes, pluginName, handler)) | ||
| delete(apiResources, endpointName) | ||
| } | ||
| } | ||
| } | ||
| registerPluginEndpoints(r, basicRes, pluginName, apiResources) | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,6 @@ export const transformWebhook = (connection: IWebhookAPI): IWebhook => { | |
| closeIssuesEndpoint: connection.closeIssuesEndpoint, | ||
| postPipelineDeployTaskEndpoint: connection.postPipelineDeployTaskEndpoint, | ||
| postPullRequestsEndpoint: connection.postPullRequestsEndpoint, | ||
| apiKeyId: connection.apiKey.id, | ||
| apiKeyId: connection.apiKey?.id, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. apiKey is optional for a webhook, so we won't always have an apiKey id. |
||
| }; | ||
| }; | ||
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.
It would be better to pass the
webhookNameto thefindByProjectNamefunction instead of redefining.