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

[feature] TravisCI now allows per component configuration + allows to set a specific make command to run #305

Merged
merged 10 commits into from
Jun 24, 2019

Conversation

edulop91
Copy link
Contributor

Summary

  • Mostly lifted from the Atlantis implementation

Test Plan

  • unittest
  • run in existing repo

@edulop91 edulop91 requested a review from a team as a code owner June 22, 2019 04:01
plan/plan.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 22, 2019

Codecov Report

Merging #305 into master will increase coverage by 0.01%.
The diff coverage is 86.5%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #305      +/-   ##
==========================================
+ Coverage   81.38%   81.39%   +0.01%     
==========================================
  Files          18       18              
  Lines        1590     1672      +82     
==========================================
+ Hits         1294     1361      +67     
- Misses        172      186      +14     
- Partials      124      125       +1
Impacted Files Coverage Δ
config/v1/config.go 84.61% <ø> (ø) ⬆️
config/v2/validation.go 83.51% <100%> (+0.27%) ⬆️
config/v2/config.go 100% <100%> (ø) ⬆️
plan/plan.go 92.13% <100%> (+0.32%) ⬆️
config/v2/resolvers.go 94.32% <80.95%> (-1.35%) ⬇️
plan/travisci.go 83.95% <82.89%> (-10.5%) ⬇️

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 81bef6d...00c1409. Read the comment docs.

@edulop91 edulop91 changed the title TravisCI now allows per component configuration + allows to set a specific make command to run [feature] TravisCI now allows per component configuration + allows to set a specific make command to run Jun 22, 2019
config/v1/config.go Outdated Show resolved Hide resolved
plan/travisci.go Outdated Show resolved Hide resolved
@czimergebot czimergebot merged commit eb7367a into master Jun 24, 2019
@edulop91 edulop91 deleted the edu/travisci branch June 24, 2019 17:27
echanakira pushed a commit that referenced this pull request Jun 24, 2019
… set a specific make command to run (#305)

[feature] TravisCI now allows per component configuration + allows to set a specific make command to run### Summary
- Mostly lifted from the Atlantis implementation

### Test Plan
- unittest
- run in existing repo
echanakira added a commit that referenced this pull request Jun 26, 2019
…nfig to yaml (#298)

* Adding yaml_migrate files to branch

* Created yaml_migrate command, currently creates a alphabetized fogg.yml

* added yaml support in v1/config.go and init.go supports creation of .json and .yml files

* Added yaml tags to all config structs, minor issue with plugins

* Fixed component aws_provider spelling mistake

* Resolved all initial code review comments

* Added yaml support to all commands; however, unit tests are not yet updated to match the changes

* Fixed all unit tests to work with current json, and added missing yaml tags

* Uncommented golden-files, but YamlIntegration not working

* Fixed potential PR problems

* Changed apply_test.go to work with yaml

* Fixed apply, plan, and golden test files to use yaml

* Passing all tests, fixed: aws-config, plan, apply, and config.go

* Removed code duplication and added a json test for apply_tests

* Passing test apply_test.go and user can now specify any file name, instead of fogg.yml of fogg.json

* fixed config structure within apply_test.go

* Added yaml tests to plan and created new yaml folders in testdata

* Added yaml tests for v2/config and created new yaml folders in testdata

* Fixed: PR Comments, Added: os.IsNotExist to check if error is caused by a non-existent file

* Fixed: added yaml support to all of v2/config

* Fixed trivial PR comments

* Added more config variables to test data

* Fixed: PR comments

* Removed resolveTfLint tests

* Moved file closing

* added (*)json.Number to v1/config.go

* Removed unnecessary flag and consolidated yamlMigrate

* Removed unnecessary comment, and moved file close for clarity

* Removed extra whitespace and moved file close for clarity

* Removed unnecessary comments and commented plan config structs

* Moved yaml-migrate from exp to cmd

* Moved yaml_migrate from exp to util, and renamed to yaml

* Fixed: package import

* removed extra whtiespace and continued make file space consistency

* re added config flag

* Simplified migrate/yaml.go, fixed marshaling, created migrate folder for future upgrade features

* Removed yaml support from v1, tests and helper methods

* fogg v1 minimally supports yaml

* Upgrade now converts to yaml

* Updated: ReadConfig and detectVersion to parse based on file extension

* [feature] atlantis integration (#303)

[feature] atlantis integrationThis PR adds Atlantis (<runatlantis.io>) integration to fogg. The goal is to be able to use fogg to generate an atlantis.yaml configuration file and all related tools, scripts etc.

Happy to take feedback on both the approach and the implementation.

### Approach

The basic approach is, in no particular order–

* To the degree possible it would be great to be able to make changes to how Atlantis works without touching the Atlantis instances, so as much as possible is put into the per-repo config file.
* We allow configuring Atlantis on a per-component basis. I think this is important as I would expect teams to adopt it incrementally.
* We do a 2-phase plan - first . plan for each component (so that we can set a var in each) and then walk those plans and generate a plan for the atlantis.yaml and aws config
* We generate an aws config for atlantis. Because we rely on aws profiles for authentication, we need to find a way to get the Atlantis instance configured with all the right profiles. In the future we may want to think about doing this for other modes.
* If atlantis is enabled for a component, `make apply` will by default fail. You have to add `FORCE=1` to override. This should nudge people in the right direction while allowing a fall-back to running locally (important for adoption phase).
* we add a `make setup` that will install fogg and run `fogg setup` (you can run this from components, not just top-level)
* we no longer run `terraform get` since that is redundant with `terrraform init` and we **don't run -update=true anymore** which means that modules will not get updated. People should be using stable versions anyway and this makes it much faster
* tfenv is now installed inside the repo, rather than homedir. This makes it so that we can use tfenv in atlantis (rather than atlantis' own process for getting terraform versions)

--- 

Note there are also a handful of stylistic changes in this diff. Tried to keep those to a minimum, but also wanted to make some improvements, especially to our makefiles.

## Test Plan
* unit tests
* ran on shared-infra repo for 1 component

## References
* <https://www.runatlantis.io/docs/>
* Fixes #290 
* Fixes #289
* Fixes #278

* release version 0.24.0

* [fix] atlantis autoplan when modules change (#304)

[fix] atlantis autoplan when modules changeThis configures auto-planning when anything in modules changes. In the future we may want to build a dependency graph between modules and components (including data dependencies), but for now the brute force approach will ensure that we don't miss changes.

### Test Plan
* CI
* ran on 1 internal repo

### References
* https://www.runatlantis.io/docs/repo-level-atlantis-yaml.html#configuring-autoplanning

* release version 0.24.1

* [feature] TravisCI now allows per component configuration + allows to set a specific make command to run (#305)

[feature] TravisCI now allows per component configuration + allows to set a specific make command to run### Summary
- Mostly lifted from the Atlantis implementation

### Test Plan
- unittest
- run in existing repo

* release version 0.25.0

* Fixed struct type merge conflicts

* Update config/config.go

Co-Authored-By: Eduardo Lopez <[email protected]>

* Update config/v1/config.go

Co-Authored-By: Eduardo Lopez <[email protected]>

* Update config/v1/config.go

Co-Authored-By: Eduardo Lopez <[email protected]>

* Added .yaml to switch and standardized err name to e

* Update config/config.go

Co-Authored-By: Eduardo Lopez <[email protected]>

* Standardized ReadConfig and error

* Changed WrapUser to allow format variables

* Fixed spacing

* Fixed duplicate key in Plan struct

* Elaborate v2/config.go description

Co-Authored-By: Ryan King <[email protected]>

* Update test name fog v1/config_test.go

Co-Authored-By: Ryan King <[email protected]>

* Rename ReadConfig func description

Co-Authored-By: Ryan King <[email protected]>

* Update plan/plan.go

Co-Authored-By: Ryan King <[email protected]>

* Refactor Print description

Co-Authored-By: Eduardo Lopez <[email protected]>

* updated fogg init to use v2 and made config.go error more detailed

* removed extra whitespace in v1 and v2 configs

* Added Dynamo table to init and fixed init test to match v2 struct

* Removed unnecessary fmt

* remove duplication of InitConfig

Co-Authored-By: Ryan King <[email protected]>

* fixed v1/config project tag

* Removed TODO and added description to FindAndReadConfig
echanakira added a commit that referenced this pull request Jul 1, 2019
…nfig to yaml (#298)

* Adding yaml_migrate files to branch

* Created yaml_migrate command, currently creates a alphabetized fogg.yml

* added yaml support in v1/config.go and init.go supports creation of .json and .yml files

* Added yaml tags to all config structs, minor issue with plugins

* Fixed component aws_provider spelling mistake

* Resolved all initial code review comments

* Added yaml support to all commands; however, unit tests are not yet updated to match the changes

* Fixed all unit tests to work with current json, and added missing yaml tags

* Uncommented golden-files, but YamlIntegration not working

* Fixed potential PR problems

* Changed apply_test.go to work with yaml

* Fixed apply, plan, and golden test files to use yaml

* Passing all tests, fixed: aws-config, plan, apply, and config.go

* Removed code duplication and added a json test for apply_tests

* Passing test apply_test.go and user can now specify any file name, instead of fogg.yml of fogg.json

* fixed config structure within apply_test.go

* Added yaml tests to plan and created new yaml folders in testdata

* Added yaml tests for v2/config and created new yaml folders in testdata

* Fixed: PR Comments, Added: os.IsNotExist to check if error is caused by a non-existent file

* Fixed: added yaml support to all of v2/config

* Fixed trivial PR comments

* Added more config variables to test data

* Fixed: PR comments

* Removed resolveTfLint tests

* Moved file closing

* added (*)json.Number to v1/config.go

* Removed unnecessary flag and consolidated yamlMigrate

* Removed unnecessary comment, and moved file close for clarity

* Removed extra whitespace and moved file close for clarity

* Removed unnecessary comments and commented plan config structs

* Moved yaml-migrate from exp to cmd

* Moved yaml_migrate from exp to util, and renamed to yaml

* Fixed: package import

* removed extra whtiespace and continued make file space consistency

* re added config flag

* Simplified migrate/yaml.go, fixed marshaling, created migrate folder for future upgrade features

* Removed yaml support from v1, tests and helper methods

* fogg v1 minimally supports yaml

* Upgrade now converts to yaml

* Updated: ReadConfig and detectVersion to parse based on file extension

* [feature] atlantis integration (#303)

[feature] atlantis integrationThis PR adds Atlantis (<runatlantis.io>) integration to fogg. The goal is to be able to use fogg to generate an atlantis.yaml configuration file and all related tools, scripts etc.

Happy to take feedback on both the approach and the implementation.

### Approach

The basic approach is, in no particular order–

* To the degree possible it would be great to be able to make changes to how Atlantis works without touching the Atlantis instances, so as much as possible is put into the per-repo config file.
* We allow configuring Atlantis on a per-component basis. I think this is important as I would expect teams to adopt it incrementally.
* We do a 2-phase plan - first . plan for each component (so that we can set a var in each) and then walk those plans and generate a plan for the atlantis.yaml and aws config
* We generate an aws config for atlantis. Because we rely on aws profiles for authentication, we need to find a way to get the Atlantis instance configured with all the right profiles. In the future we may want to think about doing this for other modes.
* If atlantis is enabled for a component, `make apply` will by default fail. You have to add `FORCE=1` to override. This should nudge people in the right direction while allowing a fall-back to running locally (important for adoption phase).
* we add a `make setup` that will install fogg and run `fogg setup` (you can run this from components, not just top-level)
* we no longer run `terraform get` since that is redundant with `terrraform init` and we **don't run -update=true anymore** which means that modules will not get updated. People should be using stable versions anyway and this makes it much faster
* tfenv is now installed inside the repo, rather than homedir. This makes it so that we can use tfenv in atlantis (rather than atlantis' own process for getting terraform versions)

--- 

Note there are also a handful of stylistic changes in this diff. Tried to keep those to a minimum, but also wanted to make some improvements, especially to our makefiles.

## Test Plan
* unit tests
* ran on shared-infra repo for 1 component

## References
* <https://www.runatlantis.io/docs/>
* Fixes #290 
* Fixes #289
* Fixes #278

* release version 0.24.0

* [fix] atlantis autoplan when modules change (#304)

[fix] atlantis autoplan when modules changeThis configures auto-planning when anything in modules changes. In the future we may want to build a dependency graph between modules and components (including data dependencies), but for now the brute force approach will ensure that we don't miss changes.

### Test Plan
* CI
* ran on 1 internal repo

### References
* https://www.runatlantis.io/docs/repo-level-atlantis-yaml.html#configuring-autoplanning

* release version 0.24.1

* [feature] TravisCI now allows per component configuration + allows to set a specific make command to run (#305)

[feature] TravisCI now allows per component configuration + allows to set a specific make command to run### Summary
- Mostly lifted from the Atlantis implementation

### Test Plan
- unittest
- run in existing repo

* release version 0.25.0

* Fixed struct type merge conflicts

* Update config/config.go

Co-Authored-By: Eduardo Lopez <[email protected]>

* Update config/v1/config.go

Co-Authored-By: Eduardo Lopez <[email protected]>

* Update config/v1/config.go

Co-Authored-By: Eduardo Lopez <[email protected]>

* Added .yaml to switch and standardized err name to e

* Update config/config.go

Co-Authored-By: Eduardo Lopez <[email protected]>

* Standardized ReadConfig and error

* Changed WrapUser to allow format variables

* Fixed spacing

* Fixed duplicate key in Plan struct

* Elaborate v2/config.go description

Co-Authored-By: Ryan King <[email protected]>

* Update test name fog v1/config_test.go

Co-Authored-By: Ryan King <[email protected]>

* Rename ReadConfig func description

Co-Authored-By: Ryan King <[email protected]>

* Update plan/plan.go

Co-Authored-By: Ryan King <[email protected]>

* Refactor Print description

Co-Authored-By: Eduardo Lopez <[email protected]>

* updated fogg init to use v2 and made config.go error more detailed

* removed extra whitespace in v1 and v2 configs

* Added Dynamo table to init and fixed init test to match v2 struct

* Removed unnecessary fmt

* remove duplication of InitConfig

Co-Authored-By: Ryan King <[email protected]>

* fixed v1/config project tag

* Removed TODO and added description to FindAndReadConfig
palasha pushed a commit to palasha/fogg that referenced this pull request Apr 7, 2020
… set a specific make command to run (chanzuckerberg#305)

[feature] TravisCI now allows per component configuration + allows to set a specific make command to run### Summary
- Mostly lifted from the Atlantis implementation

### Test Plan
- unittest
- run in existing repo
palasha pushed a commit to palasha/fogg that referenced this pull request Apr 7, 2020
…nfig to yaml (chanzuckerberg#298)

* Adding yaml_migrate files to branch

* Created yaml_migrate command, currently creates a alphabetized fogg.yml

* added yaml support in v1/config.go and init.go supports creation of .json and .yml files

* Added yaml tags to all config structs, minor issue with plugins

* Fixed component aws_provider spelling mistake

* Resolved all initial code review comments

* Added yaml support to all commands; however, unit tests are not yet updated to match the changes

* Fixed all unit tests to work with current json, and added missing yaml tags

* Uncommented golden-files, but YamlIntegration not working

* Fixed potential PR problems

* Changed apply_test.go to work with yaml

* Fixed apply, plan, and golden test files to use yaml

* Passing all tests, fixed: aws-config, plan, apply, and config.go

* Removed code duplication and added a json test for apply_tests

* Passing test apply_test.go and user can now specify any file name, instead of fogg.yml of fogg.json

* fixed config structure within apply_test.go

* Added yaml tests to plan and created new yaml folders in testdata

* Added yaml tests for v2/config and created new yaml folders in testdata

* Fixed: PR Comments, Added: os.IsNotExist to check if error is caused by a non-existent file

* Fixed: added yaml support to all of v2/config

* Fixed trivial PR comments

* Added more config variables to test data

* Fixed: PR comments

* Removed resolveTfLint tests

* Moved file closing

* added (*)json.Number to v1/config.go

* Removed unnecessary flag and consolidated yamlMigrate

* Removed unnecessary comment, and moved file close for clarity

* Removed extra whitespace and moved file close for clarity

* Removed unnecessary comments and commented plan config structs

* Moved yaml-migrate from exp to cmd

* Moved yaml_migrate from exp to util, and renamed to yaml

* Fixed: package import

* removed extra whtiespace and continued make file space consistency

* re added config flag

* Simplified migrate/yaml.go, fixed marshaling, created migrate folder for future upgrade features

* Removed yaml support from v1, tests and helper methods

* fogg v1 minimally supports yaml

* Upgrade now converts to yaml

* Updated: ReadConfig and detectVersion to parse based on file extension

* [feature] atlantis integration (chanzuckerberg#303)

[feature] atlantis integrationThis PR adds Atlantis (<runatlantis.io>) integration to fogg. The goal is to be able to use fogg to generate an atlantis.yaml configuration file and all related tools, scripts etc.

Happy to take feedback on both the approach and the implementation.

### Approach

The basic approach is, in no particular order–

* To the degree possible it would be great to be able to make changes to how Atlantis works without touching the Atlantis instances, so as much as possible is put into the per-repo config file.
* We allow configuring Atlantis on a per-component basis. I think this is important as I would expect teams to adopt it incrementally.
* We do a 2-phase plan - first . plan for each component (so that we can set a var in each) and then walk those plans and generate a plan for the atlantis.yaml and aws config
* We generate an aws config for atlantis. Because we rely on aws profiles for authentication, we need to find a way to get the Atlantis instance configured with all the right profiles. In the future we may want to think about doing this for other modes.
* If atlantis is enabled for a component, `make apply` will by default fail. You have to add `FORCE=1` to override. This should nudge people in the right direction while allowing a fall-back to running locally (important for adoption phase).
* we add a `make setup` that will install fogg and run `fogg setup` (you can run this from components, not just top-level)
* we no longer run `terraform get` since that is redundant with `terrraform init` and we **don't run -update=true anymore** which means that modules will not get updated. People should be using stable versions anyway and this makes it much faster
* tfenv is now installed inside the repo, rather than homedir. This makes it so that we can use tfenv in atlantis (rather than atlantis' own process for getting terraform versions)

--- 

Note there are also a handful of stylistic changes in this diff. Tried to keep those to a minimum, but also wanted to make some improvements, especially to our makefiles.

## Test Plan
* unit tests
* ran on shared-infra repo for 1 component

## References
* <https://www.runatlantis.io/docs/>
* Fixes chanzuckerberg#290 
* Fixes chanzuckerberg#289
* Fixes chanzuckerberg#278

* release version 0.24.0

* [fix] atlantis autoplan when modules change (chanzuckerberg#304)

[fix] atlantis autoplan when modules changeThis configures auto-planning when anything in modules changes. In the future we may want to build a dependency graph between modules and components (including data dependencies), but for now the brute force approach will ensure that we don't miss changes.

### Test Plan
* CI
* ran on 1 internal repo

### References
* https://www.runatlantis.io/docs/repo-level-atlantis-yaml.html#configuring-autoplanning

* release version 0.24.1

* [feature] TravisCI now allows per component configuration + allows to set a specific make command to run (chanzuckerberg#305)

[feature] TravisCI now allows per component configuration + allows to set a specific make command to run### Summary
- Mostly lifted from the Atlantis implementation

### Test Plan
- unittest
- run in existing repo

* release version 0.25.0

* Fixed struct type merge conflicts

* Update config/config.go

Co-Authored-By: Eduardo Lopez <[email protected]>

* Update config/v1/config.go

Co-Authored-By: Eduardo Lopez <[email protected]>

* Update config/v1/config.go

Co-Authored-By: Eduardo Lopez <[email protected]>

* Added .yaml to switch and standardized err name to e

* Update config/config.go

Co-Authored-By: Eduardo Lopez <[email protected]>

* Standardized ReadConfig and error

* Changed WrapUser to allow format variables

* Fixed spacing

* Fixed duplicate key in Plan struct

* Elaborate v2/config.go description

Co-Authored-By: Ryan King <[email protected]>

* Update test name fog v1/config_test.go

Co-Authored-By: Ryan King <[email protected]>

* Rename ReadConfig func description

Co-Authored-By: Ryan King <[email protected]>

* Update plan/plan.go

Co-Authored-By: Ryan King <[email protected]>

* Refactor Print description

Co-Authored-By: Eduardo Lopez <[email protected]>

* updated fogg init to use v2 and made config.go error more detailed

* removed extra whitespace in v1 and v2 configs

* Added Dynamo table to init and fixed init test to match v2 struct

* Removed unnecessary fmt

* remove duplication of InitConfig

Co-Authored-By: Ryan King <[email protected]>

* fixed v1/config project tag

* Removed TODO and added description to FindAndReadConfig
@vincenthsh vincenthsh mentioned this pull request Nov 12, 2024
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.

3 participants