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

GitLab merge requests use the incorrect id to name MR-based branches #3059

Closed
tobybellwood opened this issue Mar 10, 2022 · 0 comments · Fixed by #3060
Closed

GitLab merge requests use the incorrect id to name MR-based branches #3059

tobybellwood opened this issue Mar 10, 2022 · 0 comments · Fixed by #3060

Comments

@tobybellwood
Copy link
Member

tobybellwood commented Mar 10, 2022

Given a numbered GitLab Merge Request (in this case #2), Lagoon selects the incorrect "id" from the payload to name the environment.

In this case, the environment is named pr-144274375 😢

GitLab webhook payload attached for reference:

{
  "data": {
    "webhooktype": "gitlab",
    "event": "merge_request",
    "body": {
      "object_kind": "merge_request",
      "event_type": "merge_request",
      "user": {
        "id": 2217304,
        "name": "Toby Bellwood",
        "username": "tobybellwood",
        "avatar_url": "https://gitlab.com/uploads/-/system/user/avatar/2217304/avatar.png",
        "email": ""
      },
      "project": {
        "id": 34366620,
        "name": "Drupal9 Base",
        "description": "",
        "web_url": "https://gitlab.com/UseLagoon/drupal9-base",
        "avatar_url": null,
        "git_ssh_url": "git@gitlab.com:UseLagoon/drupal9-base.git",
        "git_http_url": "https://gitlab.com/UseLagoon/drupal9-base.git",
        "namespace": "Lagoon",
        "visibility_level": 20,
        "path_with_namespace": "UseLagoon/drupal9-base",
        "default_branch": "main",
        "ci_config_path": "",
        "homepage": "https://gitlab.com/UseLagoon/drupal9-base",
        "url": "git@gitlab.com:UseLagoon/drupal9-base.git",
        "ssh_url": "git@gitlab.com:UseLagoon/drupal9-base.git",
        "http_url": "https://gitlab.com/UseLagoon/drupal9-base.git"
      },
      "object_attributes": {
        "assignee_id": null,
        "author_id": 2217304,
        "created_at": "2022-03-10 06:00:32 UTC",
        "description": "",
        "head_pipeline_id": null,
        "id": 144274375,
        "iid": 2,
        "last_edited_at": null,
        "last_edited_by_id": null,
        "merge_commit_sha": null,
        "merge_error": null,
        "merge_params": {
          "force_remove_source_branch": "1"
        },
        "merge_status": "preparing",
        "merge_user_id": null,
        "merge_when_pipeline_succeeds": false,
        "milestone_id": null,
        "source_branch": "php81-update",
        "source_project_id": 34366620,
        "state_id": 1,
        "target_branch": "php81",
        "target_project_id": 34366620,
        "time_estimate": 0,
        "title": "Update README.md",
        "updated_at": "2022-03-10 06:00:32 UTC",
        "updated_by_id": null,
        "url": "https://gitlab.com/UseLagoon/drupal9-base/-/merge_requests/2",
        "source": {
          "id": 34366620,
          "name": "Drupal9 Base",
          "description": "",
          "web_url": "https://gitlab.com/UseLagoon/drupal9-base",
          "avatar_url": null,
          "git_ssh_url": "git@gitlab.com:UseLagoon/drupal9-base.git",
          "git_http_url": "https://gitlab.com/UseLagoon/drupal9-base.git",
          "namespace": "Lagoon",
          "visibility_level": 20,
          "path_with_namespace": "UseLagoon/drupal9-base",
          "default_branch": "main",
          "ci_config_path": "",
          "homepage": "https://gitlab.com/UseLagoon/drupal9-base",
          "url": "git@gitlab.com:UseLagoon/drupal9-base.git",
          "ssh_url": "git@gitlab.com:UseLagoon/drupal9-base.git",
          "http_url": "https://gitlab.com/UseLagoon/drupal9-base.git"
        },
        "target": {
          "id": 34366620,
          "name": "Drupal9 Base",
          "description": "",
          "web_url": "https://gitlab.com/UseLagoon/drupal9-base",
          "avatar_url": null,
          "git_ssh_url": "git@gitlab.com:UseLagoon/drupal9-base.git",
          "git_http_url": "https://gitlab.com/UseLagoon/drupal9-base.git",
          "namespace": "Lagoon",
          "visibility_level": 20,
          "path_with_namespace": "UseLagoon/drupal9-base",
          "default_branch": "main",
          "ci_config_path": "",
          "homepage": "https://gitlab.com/UseLagoon/drupal9-base",
          "url": "git@gitlab.com:UseLagoon/drupal9-base.git",
          "ssh_url": "git@gitlab.com:UseLagoon/drupal9-base.git",
          "http_url": "https://gitlab.com/UseLagoon/drupal9-base.git"
        },
        "last_commit": {
          "id": "34e80cb3506a97655c39c029b2e60337eac04305",
          "message": "Update README.md",
          "title": "Update README.md",
          "timestamp": "2022-03-10T06:00:24+00:00",
          "url": "https://gitlab.com/UseLagoon/drupal9-base/-/commit/34e80cb3506a97655c39c029b2e60337eac04305",
          "author": {
            "name": "Toby Bellwood",
            "email": ""
          }
        },
        "work_in_progress": false,
        "total_time_spent": 0,
        "time_change": 0,
        "human_total_time_spent": null,
        "human_time_change": null,
        "human_time_estimate": null,
        "assignee_ids": [],
        "state": "opened",
        "blocking_discussions_resolved": true,
        "action": "open"
      },
      "labels": [],
      "changes": {
        "merge_status": {
          "previous": "unchecked",
          "current": "preparing"
        }
      },
      "repository": {
        "name": "Drupal9 Base",
        "url": "git@gitlab.com:UseLagoon/drupal9-base.git",
        "description": "",
        "homepage": "https://gitlab.com/UseLagoon/drupal9-base"
      }
    },
    "giturl": "git@gitlab.com:UseLagoon/drupal9-base.git",
    "uuid": "61aa420d-b021-4616-9d7d-3f5d75ef8f53"
  }
}
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 a pull request may close this issue.

1 participant