Skip to content

Conversation

@lucasls
Copy link
Contributor

@lucasls lucasls commented Oct 20, 2025

The Pipeline and Job webhook events support the environment for deployment jobs, but they are missing in the library.

You can find more information at https://docs.gitlab.com/user/project/integrations/webhook_events/ (search for "environment": { to see an example).

I noticed the Build class is not in the models package, instead of webhook. I didn't change it since it'd break compatibility, but let me know if you think I should change something about it.

@lucasls lucasls force-pushed the feature/webhook-environment-field branch from 551c1c3 to 306a159 Compare October 20, 2025 17:34
@lucasls lucasls changed the title Support environment field in the Pipeline and Build webhook events Support environment field in the Pipeline and Job webhook events Oct 20, 2025
@lucasls lucasls marked this pull request as ready for review October 20, 2025 17:45
@lucasls lucasls changed the title Support environment field in the Pipeline and Job webhook events Support the "environment" field in the Pipeline and Job webhook events Oct 20, 2025
Copy link
Collaborator

@jmini jmini left a comment

Choose a reason for hiding this comment

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

Looks good to me.

I am not sure why we have 2 packages:

  • org.gitlab4j.api.webhook
  • org.gitlab4j.api.models

But since we have them and Build is only used by PipelineEvent, I agree it should be in webhook and not models. I agree with your point of not changing it to not break anything.

The example json files that correspond to PipelineEvent and BuildEvent:

  • "pipeline-event.json"
  • "build-event.json"

here: https://github.com/gitlab4j/gitlab4j-api/tree/main/gitlab4j-models/src/test/resources/org/gitlab4j/models

--> They should be updated (they should contain the example values corresponding to the model extension made with this PR)

@jmini
Copy link
Collaborator

jmini commented Oct 27, 2025

I looked at some real webhook event from our gitlab installation, and I can't parse

{
  "object_kind": "build",
...
  "environment": {
    "name": "docs-1504-guide-2-0",
    "action": "start"
  }
}

You added those "auto_stop_at", "state", "tier", "external_url", "last_deployment", "id", "name", "slug", to but "action" seems to be missing in your list...

@lucasls
Copy link
Contributor Author

lucasls commented Oct 27, 2025

I looked at some real webhook event from our gitlab installation, and I can't parse

{
  "object_kind": "build",
...
  "environment": {
    "name": "docs-1504-guide-2-0",
    "action": "start"
  }
}

You added those "auto_stop_at", "state", "tier", "external_url", "last_deployment", "id", "name", "slug", to but "action" seems to be missing in your list...

Hey @jmini, yes, this is related to this comment. I've fixed it

@lucasls lucasls requested a review from jmini October 27, 2025 15:28
@lucasls
Copy link
Contributor Author

lucasls commented Oct 27, 2025

Hey @jmini , I added "environment" to the example JSONs. Just some points:

  • A real non-deployment "build-event.json" would come with null / missing "environment", but I added a not-null value to the example file to have it tested
  • In "pipeline-event.json", tests fail if the file includes "environment": null (like a saw in real events) and succeed if it's missing. So I omitted it for non-deployment cases instead of setting null. Not a problem, just so you know why.

Please let me know if you have any further comments.

Copy link
Collaborator

@jmini jmini left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

@jmini jmini merged commit e2e7980 into gitlab4j:main Oct 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants