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

Validate base branches in DefaultCommandRunner #1768

Merged
merged 1 commit into from
Aug 30, 2021

Commits on Aug 23, 2021

  1. Validate base branches in DefaultCommandRunner

    Fixes runatlantis#1539
    
    The branch matcher feature has been introduced in runatlantis#1383, but the current
    implementation was broken and doesn't work at all (runatlantis#1539).
    
    If my understanding is correct, there are two problems:
    
    (1) The `GlobalCfg` has a default `Repo` instance which always matches
    any repositries and branches. Therefore the branch matcher never be
    functional.
    (2) Validating base branches in
    `DefaultPreWorkflowHooksCommandRunner.RunPreHooks()` implicitly assumed
    that users customize `pre_workflow_hooks`, but the assumption isn't
    always true because it defaults to empty.
    
    For (1), I added a new method `MatchingRepo()` to `GlobalCfg` to check
    `BranchMatches()` for a single `Repo` instance.
    
    For (2), I moved validating branch to
    `DefaultCommandRunner.validateCtxAndComment()`. Since the method has
    already validated meta data of pull request, I think it's suitable place
    to check base branches, but please let me know if there is anywhere more
    suitable.
    minamijoyo committed Aug 23, 2021
    Configuration menu
    Copy the full SHA
    8037de4 View commit details
    Browse the repository at this point in the history