uselagoon / lagoon

Lagoon, the developer-focused application delivery platform
https://docs.lagoon.sh/
Apache License 2.0
566 stars 148 forks source link

Archiving a GitLab project should not create a new Lagoon project #3022

Open seanhamlin opened 2 years ago

seanhamlin commented 2 years ago

Describe the bug

At present, when you have a GitLab system hook setup for Repository update events, this fires for when a project in GitLab is archived (by design). Lagoon at present does not seem to be able to discern this archive action, from any other project action.

We are seeing issues now where Lagoon projects are deleted, then at a later point the GitLab project is archived, and then the Lagoon project is brought back to life. This is less than ideal.

An example payload from a system hook for project_update:

{
  "event_name": "project_update",
  "created_at": "2019-02-12T19:24:41+11:00",
  "updated_at": "2022-02-11T08:43:16+11:00",
  "name": "distro-testing",
  "path": "distro-testing",
  "path_with_namespace": "testing/distro-testing",
  "project_id": 345,
  "owner_name": "Testing",
  "owner_email": "",
  "project_visibility": "private"
}

So it looks like you may need to query the GitLab API to find out the current project status.

GET /api/v4/projects/345
...
  "archived": true,
...

There is an existing GitLab issue to add more information to the system hook.

To Reproduce

Steps to reproduce the behavior:

  1. Delete the Lagoon project
  2. Archive the corresponding GitLab repo
  3. Notice how the Lagoon project has been re-created

Expected behavior

When a GitLab project is archived, this should not create a new project in Lagoon.

rocketeerbkw commented 2 years ago

Do we go one step further and say when a project is archived in gitlab, lagoon automatically deletes it?

seanhamlin commented 2 years ago

I think we can save that for when someone actually deletes the project in GitLab.