fix: validate key in files config to avoid cryptic KeyError by rickbrouwer · Pull Request #1317 · gitlabform/gitlabform · GitHub
Skip to content

fix: validate key in files config to avoid cryptic KeyError#1317

Merged
TimKnight01 merged 4 commits into
gitlabform:mainfrom
rickbrouwer:issue-1312
Jun 23, 2026
Merged

fix: validate key in files config to avoid cryptic KeyError#1317
TimKnight01 merged 4 commits into
gitlabform:mainfrom
rickbrouwer:issue-1312

Conversation

@rickbrouwer

Copy link
Copy Markdown
Collaborator

The files processor accessed configuration["files"][file]["branches"] directly, raising KeyError: 'branches' when users omitted the key. The misleading error pointed users at their top-level branches: section instead of the missing sub-key under the file entry.

Now exits with EXIT_INVALID_INPUT and a clear message listing the accepted values (all, protected, or a list of branch names).

Fixes #1312

Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com>
@rickbrouwer rickbrouwer requested a deployment to Integrate Pull Request June 17, 2026 15:29 — with GitHub Actions Waiting
@rickbrouwer rickbrouwer requested a deployment to Integrate Pull Request June 17, 2026 15:29 — with GitHub Actions Waiting
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

@amimas amimas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for looking into this @rickbrouwer . In general, looks good. Just have a question/suggestion on the approach.

Comment thread gitlabform/processors/project/files_processor.py Outdated
Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com>
@rickbrouwer rickbrouwer temporarily deployed to Integrate Pull Request June 19, 2026 08:06 — with GitHub Actions Inactive
@rickbrouwer rickbrouwer temporarily deployed to Integrate Pull Request June 19, 2026 08:06 — with GitHub Actions Inactive
Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com>
@rickbrouwer rickbrouwer temporarily deployed to Integrate Pull Request June 22, 2026 05:58 — with GitHub Actions Inactive
@rickbrouwer rickbrouwer temporarily deployed to Integrate Pull Request June 22, 2026 05:58 — with GitHub Actions Inactive
@rickbrouwer rickbrouwer temporarily deployed to Integrate Pull Request June 22, 2026 10:58 — with GitHub Actions Inactive
@rickbrouwer rickbrouwer temporarily deployed to Integrate Pull Request June 22, 2026 10:58 — with GitHub Actions Inactive
@rickbrouwer rickbrouwer enabled auto-merge June 22, 2026 10:58
@rickbrouwer rickbrouwer disabled auto-merge June 22, 2026 10:58
@rickbrouwer rickbrouwer enabled auto-merge June 22, 2026 10:59
@TimKnight01 TimKnight01 disabled auto-merge June 23, 2026 08:42
@TimKnight01 TimKnight01 merged commit 1159467 into gitlabform:main Jun 23, 2026
26 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.

Error occurred while processing project: exception: 'branches'

3 participants