gitlabform / gitlabform

🏗 Specialized configuration as a code tool for GitLab
https://gitlabform.github.io/gitlabform/
MIT License
393 stars 88 forks source link

fix: add improved error handling when processing transferred project #745

Closed long-wan-ep closed 1 month ago

long-wan-ep commented 2 months ago

Gitlabform will error when it tries to process a project that has already been transferred:

Warning: Error occurred while processing project ... failed - expected code(s) [200], got code 405 & body: '{"message":"Non GET methods are not allowed for moved projects"}'

This happens when running with ALL_DEFINED target and if there's config that includes the original project path, ie.:

projects_and_groups:
  group/*:
    ...

  group/subgroup/*:
   ...

  group/project-a:
    project:
      transfer_from: group/subgroup/project-a
    ...

This PR add handling for this scenario.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 85.57%. Comparing base (75ba2f7) to head (2ff502d). Report is 6 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/gitlabform/gitlabform/pull/745/graphs/tree.svg?width=650&height=150&src=pr&token=3g2AMN9IlC&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gitlabform)](https://app.codecov.io/gh/gitlabform/gitlabform/pull/745?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gitlabform) ```diff @@ Coverage Diff @@ ## main #745 +/- ## ========================================== - Coverage 85.70% 85.57% -0.13% ========================================== Files 69 69 Lines 2777 2780 +3 ========================================== - Hits 2380 2379 -1 - Misses 397 401 +4 ``` | [Files](https://app.codecov.io/gh/gitlabform/gitlabform/pull/745?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gitlabform) | Coverage Δ | | |---|---|---| | [gitlabform/\_\_init\_\_.py](https://app.codecov.io/gh/gitlabform/gitlabform/pull/745?src=pr&el=tree&filepath=gitlabform%2F__init__.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gitlabform#diff-Z2l0bGFiZm9ybS9fX2luaXRfXy5weQ==) | `65.51% <100.00%> (+0.01%)` | :arrow_up: | ... and [2 files with indirect coverage changes](https://app.codecov.io/gh/gitlabform/gitlabform/pull/745/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gitlabform)
TimKnight-DWP commented 2 months ago

Change looks good @long-wan-ep - I would prefer a more accurate commit message fix: add improved error handling when processing transferred project

long-wan-ep commented 2 months ago

@TimKnight-DWP Thanks for the suggestion, updated title.

gdubicki commented 1 month ago

@TimKnight-DWP Thanks for the suggestion, updated title.

I think Tim meant the commit message, not the PR title, but I will merge with a squash so the title will be used as the commit message. :)