Commit Graph

54 Commits

Author SHA1 Message Date
Andrew Carter
dcae47bddb fix: parallel plan and apply also in a single workspace (rebased) (#5264)
Signed-off-by: Andrew Carter <andrew@emailcarter.com>
Signed-off-by: Luke Massa <lukefrederickmassa@gmail.com>
Co-authored-by: Finn Arne Gangstad <finnag@gmail.com>
Co-authored-by: Rui Chen <rui@chenrui.dev>
Co-authored-by: PePe Amengual <2208324+jamengual@users.noreply.github.com>
Co-authored-by: Luke Massa <lukefrederickmassa@gmail.com>
2025-04-22 13:57:17 -04:00
Pierre Guinoiseau
90b1b13b71 feat: Add support for GitLab groups (#4001)
Signed-off-by: Pierre Guinoiseau <pierre@guinoiseau.nz>
2025-01-25 18:39:37 +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
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
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
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
Simon Heather
b221fdc0af feat: Refine the logging in the Working Dir Package (#4294)
Co-authored-by: Dylan Page <dylan.page@autodesk.com>
2024-03-27 16:20:45 +00:00
Luke Massa
6142b460bf fix: Change message for when request is not approved to be more accurate (#3744)
* Change message for when request is not approved

* Updates

* Fix

* Fix tests
2023-09-06 14:04:55 -07:00
Simon Heather
b024cef470 chore: Update server/events/working_dir Logging Configuration (#3636)
* Update server/events/working_dir logging

* Add e2e FileWorkspace logger

* Fix github app working dir test logger

* Update working_dir_test

---------

Co-authored-by: Dylan Page <dylan.page@autodesk.com>
2023-07-31 22:10:03 -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
Ross Strickland
434bab5c70 [Feature] - Add clear policy approval functionality. (#3351)
* Add clear policy approval functionality.

* Fix param name, update doc.

* fix test, add e2e test

* empty commit to re-trigger tests.

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-05-02 11:02:04 -04: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
Luke Young
5d47eeb63b feat: add plan_requirements capability (#2979)
* Add plan_requirements

* Pass pull request fetcher down to plan runner

* Adding tests

* Replace sliceContainsF with slice.Contains

* Remove policy check for plan

Co-authored-by: Casey Miller <camiller@confluent.io>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: Casey Miller <47993553+camillsir@users.noreply.github.com>
2023-01-21 00:20:04 -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
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
4d957836ad Enable or disable repo_locking per repo in repos.yaml and atlantis.yaml (#2700)
* disable repo locking repos.yaml and atlantis.yaml with allow override

* rename disable_repo_locking into repo_locking

* add both enable/disable repo_locking test

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2022-12-09 16:13:31 -06:00
FBLGit
f8b1ea9b88 Detect terraform versions using >= and ~> specifiers (#1776)
* Refactor TFVersion from Dir with tfswitch lib

* Added tests and cleaned up code

* linted fmtd

* fixed conflict go.mod

* bumped to tf1.0.6

* bumped go.mod

* Update project_command_context_builder.go

* Bump warrensbox/terraform-switcher

* Fix tests

* rm redundant mocks library import

Co-authored-by: xmurias <xmurias@gmail.com>
Co-authored-by: Xavier <77047592+xavipanda@users.noreply.github.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2022-11-20 21:27:17 -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
Aiden Scandella
ff1094fa04 feat: stream output for custom workflows (#2261)
* Start threading job output to RunStepRunner

* Strip ANSI

* Fix lint

* Use waitgroup to avoid test flakiness

* Move waitgroup higher

* Add ANSI test and use strings.Builder

* Fix lint

* Use errors.Wrap per style guide

* Create ShellCommandRunner to encapsulate streaming

* WIP: shell command runner

* Update signatures to propagate error finding version

* Fix log output

* Fix error checking

* Fix accidental whitespace stripping

* Remove unused struct field

* Fix error checking in terraform client

* Add unit tests to verify command output handler was called

* Remove err from async interface

* Remove duplicative log now that shell command runner does it

* Hide output in stream for env/multienv

* Add comment explaining goroutines

* Use printf for better macOS compatibility
2022-06-22 09:29:41 -07:00
PePe Amengual
485c4b508f Revert "fix: add path to WorkingDir methods (#2180)" (#2253)
This reverts commit 1a8344489f.
2022-05-13 10:19:29 -07:00
KevinSnyderCodes
1a8344489f fix: add path to WorkingDir methods (#2180)
* fix: add path to WorkingDir methods

`WorkingDirLocker` and `WorkingDir` are closely related -- the former acquires a lock, which ensures that the latter can safely operate on a given file path.

In #2131 we added `path` to the `WorkingDirLocker` lock key, but neglected to add the same to `WorkingDir`.

This commit adds `path` as an argument to certain `WorkingDir` methods, and includes `path` in the directory that we use to clone the repository for a given project.

Since `path` can include certain special characters such as `/`, we encode `path` as base32 when using it as part of a file path. This should ensure no special characters are used in the filesystem, and that the value can be decoded if desired (unlike hashes such as md5).

Additional changes:

- All calls to changed methods have been updated, including unit tests
- Mocks have been regenerated for `WorkingDir` and `WorkingDirLocker`
- `working_dir_test.go`
  - Commands that operate on filesystem paths have been updated to include the base32 encoded `path` value
  - When running `git init`, we include `-b master` as additional arguments, to ensure that `master` is our default branch (expected by the unit tests)

* Try fixing E2E tests

* Fix DefaultPendingPlanFinder

In addition to iterating over `workspaceDirs`, also iterate over `pathDirs`, and use both `workspace` and `path` to build `repoDir`.

* Fix DefaultPendingPlanFinder unit tests

* Fix DefaultProjectCommandBuilder unit tests

Co-authored-by: Kevin Snyder <kevinsnyder@KevinSnydersMBP.lan>
Co-authored-by: Kevin Snyder <kevinsnyder@ip-192-168-1-188.ec2.internal>
2022-04-08 11:55:35 -07:00
Sarvar Muminov
90e92e3a13 chore: move CommandContext and CommandResult to models (#193) (#2093)
* Moved CommandContext and CommandResult to models (#193)

* Moved CommandContext and CommandResult to models

* move from models to command

rename CommandContext -> Context
rename CommandResult -> Result

* moved command related helpers into command package

* move ProjectCommandContext and ProjectResult to command/project package

* move project command context and project result

* revert unrelated code

* move tests

* fix left over

* fix linting

* fix tests

* remove unused import

* fix project context dependencies

* fix depenedecies

* fix typo
2022-03-21 10:36:13 -07:00
Aayush Gupta
58e9b42bbc feat: Use UUIDs to identify log streaming jobs (#2051)
* Add UUID for Log Streaming Job ID (#167)

* Update log handler to close buffered  channels when an operation is complete (#170)

* Add preliminary check before registering new receivers in the log handler (#173)

* Using projectOutputBuffers to check for jobID instead of receiverBuffers (#181)

* Refactor log handler  (#175)

* Reverting go.mod and go.sum

* Fix lint errors

* Fix linting
2022-02-09 13:15:49 -08:00
Sarvar Muminov
7a927c050b Moving config files to core/config (#2036)
* Moving config files to core/config

* fix package names

* fix package dependencies

* linting fixes

* more linting fixes

* ran golangci-lint run --fix
2022-02-03 11:06:04 -08:00
Aayush Gupta
004074a29f feat: streaming terraform logs in real-time (#1937) 2021-12-30 09:52:52 -05:00
Nish Krishnan
33b4d6325a refactor: Add PullStatusFetcher interface (#1904) 2021-11-18 11:42:36 -08:00
Aayush Gupta
bb2c239dd9 Updating client interface and adding ApprovalStatus model (#1827) 2021-09-22 12:41:05 -07:00
Aayush Gupta
44e898c33a Refactor Apply Requirements into a Handler. (#1729) 2021-08-06 14:03:12 -07:00
Nish Krishnan
d914eafd2a Move core workflow packages under core. (#1684)
* Move core workflow packages under core.

* lint.
2021-07-01 12:54:44 -07:00
Paul Calley
6b50e84ab9 Add undiverged apply requirement (#1587)
* ORCA-731 Force PR authors to rebase if master has diverged (#70)

* initial commit for undiverge apply req

* Update documentation

* Fix existing unit tests

* HasDiverged unit test

* project command runner unit test

* Global config tests cases

* update parser unit tests

* Update project_test unit tests

* Fix linting

* fix test case with logging output

* add space on readme markdown

* Remove unused variable

* remove deprecated flag option

* Use global args struct instead of passing in args

* Fix merge issue
2021-06-03 14:35:30 -07:00
Nish Krishnan
7ac8106f8a Add structured logger (#54) (#1467)
This is two changes:

Replacing all usages of SimpleLogger with it's interface SimpleLogging which makes it easier to swap out loggers going forward
Nukes SimpleLogger in favor of StructuredLogger which allows us to better analyze logs in our log management system we choose.
2021-04-06 12:02:25 -07:00
Nish Krishnan
9fa0c91bcb [1193] Fix merge strategy for gh apps 2020-10-14 17:35:38 -07:00
Luke Kysow
8979a5fd09 Update pegomock 2020-05-25 11:58:50 -07:00
John Reese
26467c7b66 Update approved requirement documentation to be consistent 2020-04-15 20:44:32 -07:00
Luke Kysow
ec92e43d4b Refactor --vcs-status-name flag. 2020-01-20 10:16:59 -06:00
Marco Rinalducci
a824ad4d23 Detects if master branch has diverged and warn to pull new commits in comment 2019-11-27 10:52:39 -08:00
Luke Kysow
c646f20c34 Actually pass env vars between steps
Also some refactoring and testing.
2019-08-21 15:12:35 +02:00
Andrii Nasinnyk
33c0a72add Add var step to workflows
Add new var step for setting environment variable in workflows.
2019-08-21 15:06:49 +02:00
Luke Kysow
25fed35728 New version 3 of atlantis.yaml
This version changes how we parse custom run steps.
Previously we used the go-shlex library to parse the steps but this
caused users issues because they'd have to use weird escaping.

Now we simply pass the step directy to sh -c without any parsing. The
parsing was unnecessary.
2019-03-28 13:45:12 -05:00
Luke Kysow
d78b106cab Refactor @jjulien's server-side config work. 2019-03-27 14:47:48 -05:00
Luke Kysow
4e429581b0 Refactor changes to get mergeability early 2019-02-11 14:46:18 -06:00
Pratik Mallya
09782c4b6d Allow "Mergeable" apply requirement to work
Get the Mergeable status of the PR before updating the
Status. This allows for the Status to be a required
Status for merging the PR. This allows us to use the
atlantis status as a Required status, which is the
configuration often used, since most deployments
want to ensure tf plans have all been successfully
applied before merging

Issue: https://github.com/runatlantis/atlantis/issues/453
2019-02-09 03:26:26 -08:00
Luke Kysow
74e9bbb82b Add automerge feature.
Automerging merges pull requests automatically if all plans have been
successfully applied.

* Save status of PR's to BoltDB so after each apply, we can check if
there are pending plans.
* Add new feature where we delete successful plans *unless* all plans
have succeeded *if* automerge is enabled. This was requested by users
because when automerge is enabled, they want to enforce that a pull
request's changes have been fully applied. They asked that plans not be
allowed to be applied "piecemeal" and instead, all plans must be
generated successfully prior to allowing any plans to be applied.
2019-02-06 16:27:43 -06:00
Brenden Matthews
e001353ae9 Add mergeable requirement.
Introduce new `mergeable` requirement, in similar vein to the `approved`
requirement. Ran `make go-generate` to update mocks accordingly.

This addresses issue #43.
2018-12-11 16:00:04 -05:00
Luke Kysow
e9b7001266 Add godocs. Refactor ProjectResult. Golint errors. 2018-08-30 16:47:17 -06:00