* 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
* 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: 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
* disable pegomock --use-experimental-model-gen, cause random fail by segv
* make regen-mocks
* fix mock code which uses non experimental pegomock codes
* Add pre and post workflow hook status
* fix missing mocks
* fix pre/post workflow hooks tests
* add cmd output to file
* fix typo
* add cmd output to file on pre workflow hooks
* Add hooks output to web UI
* Remove unnecessary dependencies
* Clean the code and make tests work again
* Make lint happy
* Small fixes, create dedicated UUID generator and docs
* Add missing commentary
* Use matchers instead of mocking for tests and fix e2e tests
* Change 'OUTPUT_FILE' to 'OUTPUT_STATUS_FILE'
* Reduce SendWorkflowHook calls on hooks
* Apply suggestions from code review
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
* Fix remote execution on Terraform Cloud after v1.1.0
* Do not check terraform version for -no-color
* Move string comparison for newer version earlier
* Update remote apply test
* Bump github.com/zclconf/go-cty@v1.12.1
* Bump github.com/zclconf/go-cty@v1.11.1
* Bump github.com/zclconf/go-cty@v1.12.1
* Bump testing-env to latest
* Set conftest to 0.35.0
* conftest to 0.45.0, run docker tests locally
* set gha test.yml to latest testing-env image
* Update Makefile target descs, rm sudo
* Use testing-env:2022.11.17
* Add sudo back in for gha workflow
* Set conftest to 0.35.0
* test gha: rm setup
* Rename "Version" to "Conftest" for version regex
* Use cases and language import
* Use io instead of ioutil
This commit replaces `os.MkdirTemp` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests complete.
Prior to this commit, temporary directory created using `os.MkdirTemp`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
defer func() {
if err := os.RemoveAll(dir); err != nil {
t.Fatal(err)
}
}
is also tedious, but `t.TempDir` handles this for us nicely.
Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>