Commit Graph

107 Commits

Author SHA1 Message Date
Jaden Lee
df0003197d feat: selfapprove flag for approving policies (#4794)
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2024-08-08 09:11:06 -07:00
Rui Chen
8dccb2beb4 chore(lint): linting the codebase (#4668)
Signed-off-by: Rui Chen <rui@chenrui.dev>
2024-06-17 11:22:30 -04:00
James Brookes
a6a3b21787 refactor: use hc-install for TF downloads + constraints (#4494)
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2024-06-16 01:54:45 +00:00
Andrej Svenke
78373f690e feat: add silence_pr_comments on plan and apply (#4543) 2024-05-31 21:52:22 -04:00
Andrej Svenke
ded89a3e1c feat: optionally hide multienv output (#4422)
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: Rui Chen <rui@chenrui.dev>
2024-05-29 15:27:46 -04:00
Ross Strickland
821de05ddd fix: apply strip_refreshing to output for errors (#4443)
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2024-05-21 16:32:20 -04:00
Pierre Guinoiseau
82bec78dff feat: Add option to lock on apply instead of plan (#3879)
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2024-05-16 22:27:27 -07:00
Rui Chen
a630646b8f chore(deps): terraform 1.8.3, opentofu 1.7.1, conftest 0.52.0 (#4534)
Signed-off-by: Rui Chen <rui@chenrui.dev>
2024-05-14 10:38:50 -07:00
Christian Winther
f35b8c69aa fix: os.Remove should ignore non existing errors (#4502) 2024-05-04 14:59:22 -05:00
lvyaoting
5e25c00e17 chore: fix function names in comment (#4412)
Signed-off-by: lvyaoting <lvyaoting@outlook.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2024-04-26 09:46:07 -07:00
Stas Ostrovskyi
cf9137b512 fix: Prevent download terraform with version 1.8.2 or higher (#4474) 2024-04-24 20:09:27 +00:00
Hans Arnholm
d40b762ac0 revert: regression: remote ops detection TF v1.1 (#4169)
Reverts linter change from #3690 which breaks TF v1.1 detection
2024-03-05 10:31:40 -05:00
Simon Heather
67b5740053 feat: Refine The Atlantis VCS Logging Configuration (#4285)
* Refine VCS Logging

* Remove github/gitlab client logger

* Remove fmtLogSrc from instrumented_client and format

* Add staticcheck lint exception for NewGitHubClient

* Fix tests
2024-02-26 13:07:41 -05:00
Luke Massa
783c011d02 feat: Add logic for project name into lock (#4192)
* feat: Add logic for project name into lock

* More logic

* Fix tests

* Add tests
2024-02-12 14:02:04 -05:00
Luke Massa
34ef59d132 chore: Upgrade yaml v3 (#4172)
* fix(deps): update module gopkg.in/yaml.v2 to v3 in go.mod

* chore: Upgrade to go-yaml v3

* Fix comment

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2024-01-25 13:09:34 -05:00
Isaac Gaskin
fe32f8645c feat(4157): adding option to hide UI button to disable apply commands (#4158) 2024-01-24 00:10:44 -05:00
Luke Massa
0b51afc4ab chore: fix linting issues (#4110) 2024-01-02 10:54:27 -05:00
Luke Massa
6cad7e6482 chore: Remove settings for require approval, mergeable, undiverged (#4047)
* Remove settings for require approval, mergeable, undiverged

* Fix
2023-12-27 16:11:45 +00:00
Prajith
b7a06faee1 fix: download conftest binary for correct arch (#4089)
* download conftest binary for correct arch

Signed-off-by: Prajith P <prajithpalakkuda@gmail.com>

* remove default constant

Signed-off-by: Prajith P <prajithpalakkuda@gmail.com>

---------

Signed-off-by: Prajith P <prajithpalakkuda@gmail.com>
2023-12-27 15:49:27 +00:00
Luke Massa
d643c521ab feat: Remove flag for allow repo config (#3911)
* Remove option to allow repo

* Fix internal test

* Fix fmt

* Fmt

* Fix rebase

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: Dylan Page <dylan.page@autodesk.com>
2023-12-12 03:24:38 +00:00
Daniel Martins
95c5fe0fb3 fix: Enforce policy checks for overridden apply reqs (#3960)
* Enforce policy checks for overriden apply reqs

* Another take on the fix

This new version only includes the 'policies_passed' req back if
policy checks are enabled for the project.

* Fix test

* Fix comment

* Fix spelling

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-12-11 21:48:23 -05:00
Luke Massa
fb484ad8eb feat: Remove flag for disable apply (#3912)
* Add code for disabling apply flag

* Better comment
2023-12-11 20:29:21 -05:00
Luay-Sol
f79ece8243 feat: Add project depends on functionality (#3292)
* feat: implemented the code for the depends on functionality

Co-authored-by: Vincent <106497818+vincentgna@users.noreply.github.com>
2023-12-11 12:43:34 -08:00
Gabriel Martinez
56e38b4151 chore(atlantis): fix linter errors (#3690)
* chore(atlantis): fix linter errors

* fix superfluous-else

* revert gitlab check

* ignore stub funcs on azuredevops_client

* remove fetch-depth

* remove fail_on_error

* fix plan_step_runner_test.go

* more lint fixes

---------

Co-authored-by: Dylan Page <dylan.page@autodesk.com>
2023-12-11 19:02:16 +00:00
jskrill
00aae565b2 feat: add autodiscover enabled feature (#3895)
* add flag to allow the user disable the autodiscover

* add global config and doc

* feat: Implement autodiscover.mode

* fix: Minor doc fixes

* fix: Small fixes to docs/indent/tests

* fix: Line length, quoting, function comments

* fix: Add a few more tests and remove newlines

* fix: Always camel case never snake

---------

Co-authored-by: Marcelo Medeiros <m.medeiros@carepay.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-11-29 15:43:53 -08:00
Eng Zer Jun
fd600d3bb1 perf: avoid allocations with (*regexp.Regexp).MatchString (#3881)
We should use `(*regexp.Regexp).MatchString` instead of
`(*regexp.Regexp).Match([]byte(...))` when matching string to avoid
unnecessary `[]byte` conversions and reduce allocations.

Example benchmark:

func BenchmarkMatch(b *testing.B) {
	for i := 0; i < b.N; i++ {
		if match := branchRegex.Match([]byte("main")); !match {
			b.Fail()
		}
	}
}

func BenchmarkMatchString(b *testing.B) {
	for i := 0; i < b.N; i++ {
		if match := branchRegex.MatchString("main"); !match {
			b.Fail()
		}
	}
}

goos: linux
goarch: amd64
pkg: github.com/runatlantis/atlantis/server/core/config
cpu: AMD Ryzen 7 PRO 4750U with Radeon Graphics
BenchmarkMatch-16          	 8269699	       141.4 ns/op	       4 B/op	       1 allocs/op
BenchmarkMatchString-16    	14298446	        95.81 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	github.com/runatlantis/atlantis/server/core/config	2.784s

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-11-15 09:00:00 -08:00
Leandro López
bb18da218d fix(multienv): allow commas and quoted values (#3542)
* Make code more Go-idiomatic

While at it makes it more readable.

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>

* Add internal function to parse multienv step input

This new function properly deals with quotes and commas in values.

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>

* Add regression test for multienv output with comma in values

See #2765 for an issue report.

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>

* Use parseMultienvLine for parsing multienv steps output

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>

* Add internal function to parse multienv step input

This new function properly deals with quotes and commas in values.

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>

---------

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-10-06 12:05:19 -04:00
PePe Amengual
d083aa119f Revert "feat: Add project depends on functionality (#3821)" (#3825)
This reverts commit cf2b7911f4.
2023-10-06 11:35:38 -04:00
Finn Arne Gangstad
4a921b3d65 fix: make go-generate now creates working mocks out of the box (#3802)
* Rename arguments in mocked functions from result to res

The code generated by pegomock is broken if any of the arguments to the
mocked function are named "result", so they must be named something else.

* Regenerate all mocks with make go-generate

The mocks now work without further modification after running go-generate.
2023-10-06 11:04:34 -04:00
Brett Galkowski
22060fe5d2 feat: Add option allowing usage of custom policy check tools (#3765)
* Adding new flag everywhere relevant, implementing policy result workaround

* Fixing unit test str matching, adding custom policy conditional to step_runner

* Adding documentation steps for custom policy tools

* Refactoring ConftestOutput attribute to PolicyOutput
2023-10-06 10:57:29 -04:00
Vincent
cf2b7911f4 feat: Add project depends on functionality (#3821)
* feat: implemented the code for the depends on functionnality

* chore: Address PR comments

---------

Co-authored-by: Luay-Sol <luay.grira@solace.com>
2023-10-06 10:10:40 -04:00
Simon Heather
64f7d2e1a1 feat: Add Targeted Execution to the Pre/Post Workflow Hooks (#3708)
* Add Workflow hook target filter

* Fix post workflow hook example

* Update WokrflowHook in global_cfg

* Fix linting

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-10-06 09:37:07 -04:00
Finn Arne Gangstad
ef33bac0b9 Latest terraform 1.3.* is now 1.3.10 (#3770) 2023-09-15 13:26:35 -07:00
Luke Massa
6a0512a579 feat: add portability to command invocation unit tests (#3758)
* Add portability to command invocation unit tests

* Fix linting
2023-09-11 11:13:26 -04:00
Shouichi Kamiya
2bd778b01e fix: auto plan when .terraform.lock.hcl changed (#3473)
Problem

When `projects` are specified and `when_modified` is not specified via
the config file, changing `.terraform.lock.hcl` file won't trigger auto
plan. This is because the default `raw.WhenModified` does not include
`.terraform.lock.hcl`.

Note that when projects are auto detected, changing
`.terraform.lock.hcl` triggers auto plan. This is because the
`cmd.DefaultAutoplanFileList` includes `.terraform.lock.hcl`.

Solution

Include `.terraform.lock.hcl` to the default `raw.WhenModified`.
2023-07-31 11:29:33 -04:00
Simon Heather
9aae60f1d3 Conftest Log Fix (#3632) 2023-07-28 19:49:38 +00:00
Simon Heather
b8994190be feat: Add Support for Customising the Shell for Pre and Post Workflow Hooks (#3451) 2023-07-07 18:34:01 -04:00
Ross Strickland
76c482b83a feat: global repo params (#3379) 2023-07-07 18:33:21 -04:00
Simon Heather
847cab74c4 feat: Add Command Name Environment Variable to Pre/Post Workflow Executions (#3571)
* Add Workflow Command Name env var

* Update tests

* Update command runner

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-07-07 16:21:32 -04:00
Andre Ziviani
974eed3803 feat: Disable policy check on some repositories (#3503)
* feat: Allow enabling policy check per repository

* chore: Tests

* chore: Docs

* chore: Improve tests

* chore: E2E tests
2023-07-06 16:39:36 -04:00
Yunchi Luo
a6161c9926 feat: Add an output option to filter output for custom run steps (#3518)
* feat: Add an `output` option to filter output for custom run steps
2023-06-30 10:00:31 -04:00
Ken Kaizu
3954955e13 fix(deps): update module github.com/petergtz/pegomock/v3 to v4 (#3534)
* fix(deps): update module github.com/petergtz/pegomock/v3 to v4 in go.mod

* remove pegomock generate m option, which is not support after v4

* make regen-mocks

* replace pegomock v4 primitive eq/matchers

* convert pegomock v4 Eq/Any matchers

* remove custom models.Repo matcher

* pegomock v4 cannot use result method args

ref https://github.com/petergtz/pegomock/issues/123

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-20 15:05:23 -04:00
nitrocode
e505817a7d chore(deps): bump pegomock v3.0.1 (#3515) 2023-06-13 11:36:09 -07:00
Leandro López
c709fd0cff feat: Add Terraform command duration to log messages (#3484)
* Log duration of Terraform commands

Closes #3413.

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>

* Make log message casing consistent

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>

* Add tests for passing duration to Terraform comamnds logs

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>

* Add logging mocks for testing Terraform client

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>

---------

Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
2023-06-09 21:03:36 -05:00
Simon Heather
50b1e48b4a fix(workflow-hook): multiline output formatting (#3425)
* Fix Workflow Hool Scripts Multiline Output

* Update unit tests

* revert bash cmd

* Fix tests
2023-05-30 09:21:56 -05:00
Simon Heather
4915d8db5e fix(workflow-hook): log output with or without errors (#3422)
* fix: Errors in Pre or Post Workflow Hook Scripts do not Produce any Output

* Fix post workflow

* Update unit tests
2023-05-23 17:12:28 -05:00
oysteingraendsen
4e867fc36e feat: when using order group, abort plan/apply if any fail (#3323)
* feat: when using order group, abort plan/apply if any fail

* feat: add 'abort_on_execution_order_fail' flag on repo level

* feat: use runProjectCmdsParallelGroups in version_command_runner

* chore: add plan tests

---------

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2023-05-12 13:24:33 -04:00
Marcus Ramberg
f8b293ada0 feat: Github reaction emojis on PR comments (#2706)
* feat: Basic implementation of github reactions on PRs

Adds eyes whenever it detects an `atlantis` command.

* feat: Make the emoji reaction configurable

* tests: Add a mocked test for EmojiReaction being called in github

* ci: Disable revive linter for stubs
2023-04-25 17:22:51 -04:00
Shouichi Kamiya
f4fa3138d7 feat: add PULL_URL to environment variables (#3302)
Background:

It is convenient to have the PR URL available so that we can link the PR
that triggers the infrastructure changes from the audit logging system.
For example, the google cloud provider adds user-supplied justification
into google cloud audit logging via `CLOUDSDK_CORE_REQUEST_REASON`
environment variable.

https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#request_reason
2023-04-21 02:21:27 +00:00
Ross Strickland
684f2fa7e0 feat(policies): Add granular policy_sets (#3086)
* Initial work.

* Periodic push.

* Fmt and start adding args to approve_policies cmd.

* keep funcs for now.

* Periodic push.

* Periodic push.

* fmt.

* Move approve policies logic to project_command_runner.

* update some tests

* More test fixes.

* update more tests. fix som logic.

* more tests. add additional info to common data for custom templates.

* fix apply with policies bug. update more tests/fmt

* file perms

* fix error parsing for conftest results.

* Update more tests and linting.

* update documentation.

* Address no-fail case. Address comments.

* Forgot changes.

* fix markdown renderer

* Fix policy fail logic. remove uneeded tmpl var

* targeted policy approvals fix

* Address PR comments.

* empty commit to trigger build

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: rkstrickland <ross.strickland@instacart.com>
Co-authored-by: Dylan Page <dylan.page@autodesk.com>
2023-04-20 21:53:46 -04:00