-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
What problem will this feature address?
I’m integrating the Trigger Deployment API into a GitLab CI pipeline to deploy an application after building the Docker image.
When I trigger a deployment using the API from the Application Deployments section, the deployment is shown as “Manual deployment”.
However, when using a webhook, the deployment correctly displays the commit message and commit SHA.
Is there a way to include commit metadata (commit message and SHA) when triggering a deployment via the API?
Describe the solution you'd like
Add two additional optional fields to the Trigger Deployment API request body to allow populating the commit message and commit SHA.
This would make deployments triggered via the API consistent with those triggered via webhooks, which already display this information.
Example:
curl -X 'POST' \
'https://your-domain/api/application.deploy' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'x-api-key: <token>' \
-d '{
"applicationId": "string",
"commitSha": "abc123",
"commitMessage": "feat: new feature"
}'Describe alternatives you've considered
For now, I’m using a webhook to pass the commit message and commit SHA, like this:
BODY=$(printf '{
"object_kind": "push",
"ref": "refs/heads/main",
"checkout_sha": "%s",
"commits": [
{ "message": "%s" }
]
}' "$CI_COMMIT_SHA" "$CI_COMMIT_MESSAGE")
curl -X POST "$DOKPLOY_WEBHOOK_URL" \
-H "Content-Type: application/json" \
-H "X-Gitlab-Event: Push Hook" \
-d "$BODY"Additional context
No response
Will you send a PR to implement it?
I can try, maybe need help