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

Add option flag to filter the modified files #151

Closed
wants to merge 1 commit into from
Closed

Add option flag to filter the modified files #151

wants to merge 1 commit into from

Conversation

bewie
Copy link
Contributor

@bewie bewie commented Jun 16, 2018

Hi,
I use a mono-repo with a lot of non related terraform files or some projects that I don't want to plan/apply from atlantis.
So I want to filter on specific path from my repository to select only the sub-directory that I want to plan/apply.
To do that I added an option flag to filter the modifications on a specific path.

@codecov
Copy link

codecov bot commented Jun 16, 2018

Codecov Report

Merging #151 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #151      +/-   ##
==========================================
+ Coverage   64.14%   64.18%   +0.03%     
==========================================
  Files          41       41              
  Lines        1969     1971       +2     
==========================================
+ Hits         1263     1265       +2     
  Misses        641      641              
  Partials       65       65
Impacted Files Coverage Δ
cmd/server.go 79.36% <ø> (ø) ⬆️
server/server.go 64.24% <100%> (+0.18%) ⬆️
server/events/project_finder.go 100% <100%> (ø) ⬆️
server/events/plan_executor.go 89.47% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9e5f57a...dae05b3. Read the comment docs.

@lkysow
Copy link
Member

lkysow commented Jun 19, 2018

Hi Laurent, first of all, thank you for your contribution. I appreciate the care you took and how you also updated the tests. I think that I may be close to solving your problem in another way though.

I'm very close to a new release of Atlantis that will affect you in two ways:

  1. running atlantis plan will no longer cause Atlantis to attempt to figure out which directories to run plan in. It will default to just running plan in the root of the repo. This is because...
  2. atlantis will now automatically run plan when you open a new pull request or new commits are pushed to an existing pull request. This would still cause you issues which is why we support a new config file that allows you to configure which paths to run plan in depending on which files are modified.

For example given the following structure:

/
  /tf-project
    main.tf,
  /outscope
    main.tf
  /modules
    /my-module

You could set up an atlantis.yaml file in the repo root as follows:

version: 2
projects:
- dir: tf-project
  autoplan:
    when_modified: ["*.tf", "../modules/my-module/*.tf"]  

The when_modified key supports the .dockerignore syntax (except for matching, not ignoring).

To apply you would run atlantis apply -d tf-project OR, you could name the project:

...
- dir: tf-project
  name: tf-project

And run atlantis apply -p tf-project.

Now when commits come to tf-project and outscope, only tf-project will be planned. The downside of this for you is that you'll have to list all of your directories that you'd like planned. Would that be a real pain for you? I'm open to feedback on this design. I want to move Atlantis to per-repo configuration rather than using global flags that apply to all repos because many users want different settings per repo.

@bewie
Copy link
Contributor Author

bewie commented Jun 19, 2018

Hi Luke, thanks for your reply.

The automatically plan on PR will be awesome!
I have to try the atlantis.yaml configuration per directory if it match with my cases. Yes it could be annoying to list all directories, actually I have 39 projects under the path that I want to watch... But I can deal with it, it's not moving a lot and I have to config it only once.
Do you know when I the new release will be available? :-)

@lkysow
Copy link
Member

lkysow commented Jun 20, 2018

I should have an alpha release out by the end of the week. Yeah listing 39 directories isn't great but for now I think you'll have to. I'm happy to make the config less explicit but I want to see some more use cases so if I change the schema it works for everyone.

I'm going to close this for now since the new release should achieve what you're looking for.

@lkysow lkysow closed this Jun 20, 2018
@lkysow
Copy link
Member

lkysow commented Jul 5, 2018

@bewie I think you already saw this but 0.4 was released yesterday.

jamengual pushed a commit that referenced this pull request Nov 23, 2022
meringu pushed a commit to meringu/atlantis that referenced this pull request May 29, 2023
meringu pushed a commit to meringu/atlantis that referenced this pull request May 29, 2023
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.

2 participants