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

0.23.5 attempts to autoplan a project even when autoplan is disabled. #3368

Open
mrwacky42 opened this issue May 2, 2023 · 2 comments
Open
Labels
bug Something isn't working never-stale regression Bug introduced in a new version Stale waiting-on-response Waiting for a response from the user

Comments

@mrwacky42
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

We just updated from 0.19.3 to 0.23.5, and a PR that changed two projects tried to make a plan for both, when the configuration indicates only one should autoplan.

Reproduction Steps

Open a PR with this config and changes to both directories, and see 2 plans instead of 1. (Except the project that should not plan is failing, which is why it is disabled.)

Here's a config. For $REASONS, the no-plan project is disabled but present in our atlantis.yaml:

- name: no-plan
  autoplan:
    enabled: false
  dir: no/plan/dir
  workflow: workflow
  workspace: default
  apply_requirements:
  - approved
  - mergeable


- name: plan-me-please
  autoplan:
    when_modified:
    - '**/*'
    - '!.terraform.lock.hcl'
    - '!**/*.md'
  dir: plan/me/please
  workflow: workflow
  workspace: prod
  apply_requirements:
  - mergeable

Logs

The logs indicate the when_modified is the reason why both were planned:

{"level":"info","ts":"2023-05-02T16:03:27.205Z","caller":"events/project_command_builder.go:365","msg":"2 projects are to be planned based on their when_modified config","json":{"repo":"redacted","pull":"12835"}}

Environment details

  • Atlantis version: 0.23.5
  • Deployment method: ecs
  • If not running the latest Atlantis version have you tried to reproduce this issue on the latest version:
  • Atlantis flags: atlantis server --atlantis-url=https://REDACTED --gh-user=REDACTED --gh-org= --repo-whitelist=github.com/REDACTED/* --repo-config=/home/atlantis/repos.yaml --config=/home/atlantis/config.yaml --default-tf-version=1.3.6 --hide-prev-plan-comments --allow-fork-prs --checkout-strategy=merge --log-level=info --enable-regexp-cmd --enable-diff-markdown-format

Atlantis server-side config files:

config.yaml:

automerge: true
slack-token: REDACTED
webhooks:
- event: apply
  workspace-regex: .*
  kind: slack
  channel: deployment

(relevant parts of) repos.yaml:

repos:
- id: /.*/
  allowed_overrides: [workflow, apply_requirements]

workflows:

  workflow:
    plan:
      steps:
      - env:
          name: <REDACTED1>
          command: 'REDACTED1'

      - run: tfenv install
      - init:
          extra_args: ["-backend-config='role_arn=arn:aws:iam::<REDACTED>'"]
      - plan:
          extra_args: ["-var='terraform_exec_role=<REDACTED>'"]

Repo atlantis.yaml file:
see above

Additional Context

None

@mrwacky42 mrwacky42 added the bug Something isn't working label May 2, 2023
@nitrocode nitrocode added the regression Bug introduced in a new version label May 3, 2023
@nitrocode
Copy link
Member

nitrocode commented May 3, 2023

@mrwacky42 if you have time, could you check previous versions and see which one was the last one that worked as expected? This will help identify the release that contained the issue

projects are to be planned based on their when_modified config

moduleInfo, err := FindModuleProjects(repoDir, p.AutoDetectModuleFiles)
if err != nil {
ctx.Log.Warn("error(s) loading project module dependencies: %s", err)
}
ctx.Log.Debug("moduleInfo for %s (matching %q) = %v", repoDir, p.AutoDetectModuleFiles, moduleInfo)
if len(repoCfg.Projects) > 0 {
matchingProjects, err := p.ProjectFinder.DetermineProjectsViaConfig(ctx.Log, modifiedFiles, repoCfg, repoDir, moduleInfo)
if err != nil {
return nil, err
}
ctx.Log.Info("%d projects are to be planned based on their when_modified config", len(matchingProjects))

According to the history of this file, the following prs were merged recently (in order of most recent)

@GenPage GenPage added the waiting-on-response Waiting for a response from the user label May 11, 2023
@github-actions
Copy link

This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month.'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working never-stale regression Bug introduced in a new version Stale waiting-on-response Waiting for a response from the user
Projects
None yet
Development

No branches or pull requests

3 participants