* 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>
* 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>
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>
* 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>
* 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.
* 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
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`.
* 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>
* 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>
* 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
* feat: state rm
* review feedback
* fix conflict for pegomock generation code
* adopt state command into allow-commands
* fix conflicts
* fix: state rm works on workspace
* notify import/state rm discard plan file
* fix lint
* use repeat instead warning for re-plan
* perl -pi -e 's!\* 🔁 plan file was discarded. to!🚮 A plan file was discarded. Re-plan would be required before applying.\n\n\* 🔁 To!g' server/**/*
* follow main branch
* feat: Update plan GitHub Status summary
* feat: revert result changes for Plan and Apply functions
* docs: Add CommandResult description
* feat: change plan status without ctx.CommandResult
* ensure DefaultCommitStatusUpdater implements runtime.statusUpdater
Co-authored-by: Alberto Rojas <alberto.rojas@n26.com>
* atlantis import not works on workspace
* extract workspace_step_runner_delegate from plan_step_runner
* import step runner requires workspace delegate