Commit Graph

72 Commits

Author SHA1 Message Date
Hirotake Kobayashi
5dfe5f92a9 fix: Set Env variables when output: hide in multienv (#5319)
Signed-off-by: Hirotake Kobayashi <h.kobayashi@raksul.com>
Co-authored-by: PePe Amengual <2208324+jamengual@users.noreply.github.com>
2025-05-23 22:57:11 -07:00
Simon Heather
4bea4e934a chore: Add Struct required tags and Server Struct Validator (#5371)
Signed-off-by: X-Guardian <32168619+X-Guardian@users.noreply.github.com>
2025-03-09 11:34:48 +00:00
Luke Massa
cf0b3f3295 chore: Add nil checks before returning wrapped error (#5309)
Signed-off-by: Luke Massa <lukefrederickmassa@gmail.com>
2025-02-11 00:10:58 -05:00
Alexey Kosenko
1f9b90e715 feat(post-workflow-hook): pass the result status of executed command to the post hook envs (#5308)
Signed-off-by: a1k0u <alko7enko@gmail.com>
2025-02-10 21:27:30 +00:00
Luke Massa
aa4a98032e chore: Remove dependency on multierror (#5275)
Signed-off-by: Luke Massa <lukefrederickmassa@gmail.com>
2025-02-02 12:44:39 -05:00
Eka Cahya Pratama
e2eacdcd34 fix: Return correct status when using custom policy (#5156)
Signed-off-by: bakuljajan <eka.pratama@finaccel.co>
2025-01-25 17:30:38 +00:00
Andrew Borg
9e0f3d1bb5 feat: Support project-level Terraform distribution selection (#5167)
Signed-off-by: Andrew Borg <andrew.b.borg@gmail.com>
Co-authored-by: PePe Amengual <2208324+jamengual@users.noreply.github.com>
Co-authored-by: Simon Heather <32168619+X-Guardian@users.noreply.github.com>
2025-01-02 21:06:01 -08:00
Rui Chen
591931a81c chore: fix typos (#5202)
Signed-off-by: Rui Chen <rui@chenrui.dev>
2024-12-28 17:50:53 -05:00
Simon Heather
e468a23e0b feat: Refine the Atlantis Info Message Logging (#5034)
Signed-off-by: Simon Heather <32168619+X-Guardian@users.noreply.github.com>
2024-11-19 12:54:55 -05:00
Takahiro Suzuki
5e0f854cea chore: Regenerates mock files with pegomock v4.1.0 (#5090)
Signed-off-by: tkasuz <63289889+tkasuz@users.noreply.github.com>
2024-11-16 15:00:42 +00:00
Andrej Svenke
8285a0faf2 feat: set the shell for workflow command steps (#5024)
Signed-off-by: anryko <andrej.svenke@deliveryhero.com>
2024-11-04 18:29:47 +00:00
Henry Muru Paenga
9c7e5fcac8 feat: OpenTofu support (#4499)
Co-authored-by: PePe Amengual <2208324+jamengual@users.noreply.github.com>
2024-09-29 18:13:20 -07:00
Nick King
9a0c648748 feat: add ability to delegate authorization to external sources (#4864) 2024-09-03 15:39:04 -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
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
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
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
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
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
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
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
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
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
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
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
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
Fabiano Soares Honorato
40f4e8ca6b fix: workflow output not sending output (#3091) 2023-02-18 08:26:33 -06:00
Ken Kaizu
cb0aadf571 feat: state rm (#2880)
* 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
2023-01-18 22:02:18 -06:00
Ken Kaizu
ee7a5cadfb feat: PR check status to show summary e.g. Plan: 1 to add, 0 to change, 1 to destroy (#2983)
* 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>
2023-01-14 15:08:56 -06:00
Ken Kaizu
c77149396a fix: atlantis import on workspaces (#2937)
* atlantis import not works on workspace

* extract workspace_step_runner_delegate from plan_step_runner

* import step runner requires workspace delegate
2023-01-11 17:53:45 -06:00
Ken Kaizu
27b9897517 chore(build): rm pegomock experimental feature for smooth mock generation (#2886)
* disable pegomock --use-experimental-model-gen, cause random fail by segv

* make regen-mocks

* fix mock code which uses non experimental pegomock codes
2022-12-27 19:58:15 -06:00
Ken Kaizu
4e0d4ecc40 feat: atlantis import (#2783)
* feat: atlantis import

* feat: atlantis import

* regenerate mock comment builder

* remove duplicate err check

* instrumented import command runner/builder

* atlantis import subcommand accept args before hyphen

* fix link checker

* docs: review feedback

* fix atlantis import options order

* Update runatlantis.io/docs/using-atlantis.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/using-atlantis.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/using-atlantis.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/using-atlantis.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/using-atlantis.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update server/events/comment_parser.go

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update server/events/comment_parser.go

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/server-side-repo-config.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update runatlantis.io/docs/command-requirements.md

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update server/events/command_requirement_handler.go

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* Update server/events/command_requirement_handler_test.go

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>

* fix test import usage

* fix e2e expected txt

* fix doc link

* docs: workflow import stage/step

* docs fixup

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2022-12-22 18:37:29 -06:00
Ken Kaizu
b78c4e8ef9 refactor: e2e test use conftest command instead command$version (#2851) 2022-12-22 07:56:26 -06:00
Fabiano Soares Honorato
cb485f11ee feat: Add pre and post workflow hook status (#2441)
* 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>
2022-12-19 14:20:34 -06:00
Li Lin
812db63dfd Fix remote execution on Terraform Cloud after v1.1.0 (#2793)
* 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
2022-12-15 12:54:43 -08:00
nitrocode
b760e8c869 Bump testing-env and go-cty@v1.12.1 (#2686)
* 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
2022-11-17 16:57:04 -06:00
nitrocode
d85662cdf1 Rename default branch to main (#2662)
* Rename default branch to main

* Bump git, curl, and openssl packages
2022-11-14 11:28:29 -06:00
Eng Zer Jun
49c5eba458 test: use T.TempDir to create temporary test directory (#2671)
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>
2022-11-13 14:13:29 -06:00