Commit Graph

297 Commits

Author SHA1 Message Date
Andrei Vydrin
f7f35ceb29 feat: add hide-unchanged-plan-comments option (#3158)
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-02-25 15:50:33 -06:00
nitrocode
ad2274f114 feat: shallow repo clone in merge checkout strategy (#2758)
* Implement shallow repo clone in merge checkout strategy

---------

Co-authored-by: Ilya Lukyanov <il@joom.com>
Co-authored-by: Nikolai Røed Kristiansen <nikolaik@gmail.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: Ken Kaizu <k.kaizu38@gmail.com>
2023-02-22 13:29:29 -08:00
Ken Kaizu
fdcb1adfb0 feat: suppress log package logging (#3076)
To suppress uber-go/tally logs which are not structured logs.
2023-01-30 23:55:01 -06:00
Adam Zahumenský
953de00f80 feat: --silence-no-projects to comments with -d and -p (#2969)
* Expand --silence-no-projects to targeted commands

* Cover other commands, test+docs

* Add more tests, refactor doc

* fix tests

* fix dangling pending VCS statuses

* fix: codeql yaml

* fix: lint
2023-01-24 08:26:24 -06: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
f8eba4bce6 fix: markdown renderer use invalid disableApply flag with disableMarkdownFolding (#3016) 2023-01-19 15:58:05 -08: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
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
Darren Worrall
7746655eb1 Support team owners for policies (#2953) 2023-01-10 16:53:05 -06:00
Ken Kaizu
ca507560f4 fix: set ctx.PullRequestStatus in import_command_runner for import_requirements (#2936)
* refactor: pull_status_fetcher contains vcsStatusName in struct / reduce FetchPullStatus parameter

* import_command_runner need to set ctx.PullRequestStatus for import_requirements
2023-01-08 10:22:33 -05:00
Ken Kaizu
46bf0466c0 fix: markdown renderer use ExecutableName instead atlantis (#2939)
* make MarkdownRenderer private

* ExecutableName is available on markdown renderer common data

* replace template atlantis name with .ExecutableName

* MarkdownRenderer fields can be private, but itself needs public

* reuse commonData anywhere in renderer

* revert
2023-01-06 16:20:14 -06:00
Sebastian Poxhofer
a508bdb255 fix(discardApprovalOnPlan): add missing conditional and tests (#2913)
* fix(discardApprovalOnPlan): add missing conditional and tests

* tests(discardApprovalOnPlan): match for any Pull request or repo for turned off discarding

* Apply suggestions from code review

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

* Update server/events/plan_command_runner.go

* Update server/events/plan_command_runner.go

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2023-01-03 10:21:37 -06:00
Ken Kaizu
f09a9d4c01 feat: --allow-commands restricts available atlantis commands (#2877)
* feat: --allow-command configuration restricts available atlantis commands

* add version and approve_policies into allow commands defaults

* allow-commands accept all keyword which allows all commands

* remove redundant nest

* more detail abount allow-commands all keyword

* Update server/events/comment_parser.go
2022-12-27 22:52:39 -06:00
nitrocode
9345d55127 Upgrade negroni to v3 (#2867) 2022-12-23 11:58:10 -06:00
Ken Kaizu
b3d0847ac7 remove urfave/cli. this is introduced for cli.NewApp, but currently atlantis use cobra, so no meanings (#2866)
- 5f47524655/main.go (L51)
- 5f47524655
2022-12-23 08:17:08 -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
Adam Verigin
faa027acbd feat: Add flag to disable downloading tf for airgapped environments (#2843)
* Move terraform version listing into Terraform client

* Add flag to disable Terraform downloads

* Fallback to exact version matching if unable to list TF versions

* Add new config option to documentation

* Fix and update tests

* Fix check-lint errors

* Change option name

* Remove obsolete commented code

* Migrate version detection logic into terraform client

* Improve consistency in new function signatures & log statements

* Test requests before calling terraform-switch, to prevent unnecessary crashes

* Fix broken tests

* Silence gosec error

* Close response body
2022-12-22 13:37:35 -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
Fabiano Soares Honorato
6a7f79e749 Metrics initialization (#2767)
* Add builder metrics initialization

* Add pull_closed metrics initialization

* Add builder metrics initialization

* use InitCounter from metrics package to initialize prometheus counters
2022-12-16 22:22:06 -06:00
Ken Kaizu
8d74878f9d feat: customize vcs comment command executable name (#2805) 2022-12-16 19:16:36 -08: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
Fabiano Soares Honorato
66dc30e755 feat: prevent planning and applying directories outside PR scope using --restrict-file-list (#2440)
* Add --strict-plan-file-list config

* Update server.go

* Update server-configuration.md

* Update server_test.go

* Run gofmt -w

* Add --strict-plan-file-list for projects

* Add --strict-plan-file-list tests

* Change --strict-plan-file-list to --restrict-file-list

* Update --restrict-file-list documentation

* Update --restrict-file-list and --enable-regexp-cmd documentation

Co-authored-by: Fabiano Honorato <fabiano.honorato@ifood.com.br>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2022-12-09 09:33:40 -06:00
noah
61bcfbab2b feat: auto-plan projects when modules change (#2507)
* feat: auto-plan projects when modules change

Fixes #920

* rename Downstream->Dependent; docs cleanup

* chore: gofmt -s
2022-11-28 14:12:29 -08:00
Casey Miller
9b90f2e4f4 Adding reloading of TLS certificates (#2656)
* Adding reloading of TLS certificates

* Update server/server.go

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

* Adding test and test data

* Set minimum tls version

* Adding read header timeout

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2022-11-14 12:49:34 -06:00
nitrocode
ec995dd794 Bump all dependencies (#2675)
* Bump all dependencies using go get -u

* Added nolint: gosec for writing git creds
2022-11-14 00:50:57 -06:00
Ross Strickland
d620d5de98 Add custom templating support (#2647)
* added custom templates support

* made default templates DRY

* Change init to anonymous function.

* Initialize anonymous function inside var

* - Add flag/cfg param for custom template dir
- Add test for custom template

* Add documentation.

* Address PR comments.

Co-authored-by: Ricard Bejarano <ribejara@thousandeyes.com>
2022-11-11 09:56:33 -06:00
Eirik Nygaard
5e3f1a9f90 Add argument for enabling same origin check for websocket connections (#2659)
* Add argument for enabling same origin check for websocket connections

* Remove else clause and outdent return

* Add unit test for websocket origin check
2022-11-11 09:50:15 -06:00
Marc Barlo
3bfd769211 feat: add a flag to silence policy checks comments when there's no error (#2405)
* Add a flag to silence policy checks comments when there's no error

* Add e2e test cases for the quiet policy checks flag

* add documentation for quiet-policy-checks flag

* Update user_config.go

Fix indentation

* Update user_config.go

* fmt
2022-10-26 23:35:49 -07:00
giuli007
2cd8bd9ccc Delete previous plans on autoplan or atlantis plan (#1633)
* Delete previous plans on autoplan or atlantis plan

When using non-default workspaces, plans are stored
in pr-and-workspace-specific directories.
If a PR is subsequently updated it might happen that
some of the plans are no longer relevant with regards
to the latest changes.
This change ensures that plans are always deleted
when a generic plan is triggered either by autoplan
or by a "atlantis plan" command.
NB Plans are not cleaned up when specific projects are
planned explicitly with "atlantis plan -p/-d/-w".

* Also delete locks along with plans when running
autoplan or generic plan command

* Fix Plan deletion tests after 0.19.8 rebase

* Fix Plan deletion tests after v0.19.9-pre.20220912 rebase

* Rename struct field to follow camelCase naming convention

Co-authored-by: giuli007 <giuglioz@gmail.com>
2022-09-23 14:31:24 -07:00
Brian Zoetewey
1bcf938644 Adding Redis DB option (#2527)
* Adding Redis DB option
This allows selecting something other than the default database of 0.

* Add missing db argument to fix failing tests.
2022-09-20 21:27:16 -07:00
Daniel Thompson
d5d8e38117 Adding Redis TLS Option (#2510)
* Adding Redis TLS option

* Test fixes and allow for tls skip verify

* Test fixes and allow for tls skip verify
2022-09-09 20:02:26 -07:00
Daniel Thompson
ab2cdb833a External Locking DB: Redis (#2491)
* Initial build out of redis backend

* Regenerate locking mocks and matchers

* More test cleanup

* More test fixes

* Added tests for redis

* Test fix

* Linting fix

* Dcos update

* Update redis.go

* Update server.go

* Adding nolint to RedisDB struct
2022-09-07 16:57:06 -07:00
Ray Terrill
89d33a0737 Make required atlantis/apply status check work with mergeable (#2436)
* Make required apply work with mergeable

* Fix lint hint

* Migrate mergeable approval check to graphql, update tests

* Adding support for check suites

* Adding feature flag protection for new functionality

* Fix linting falsepos

* Adjusted logic to handle required check runs, added doc
2022-08-18 09:46:50 -07:00
Rémi Lapeyre
b409cb8470 Add the /plan and /apply endpoints (#997)
* Add the /plan and /apply endpoints

* Resolve conflicts

* Fix wrong merge

* Add missing methods for mocks

* Fix linting error

* Fix linting error

* Move api plan/apply into APIController

* Extract commond code into helper functions

* Implement GetCloneURL for GitHub

Co-authored-by: Li Lin <li.lin@hashicorp.com>
2022-07-27 11:36:49 -07:00
Casper Biering
abb9e41787 fix: Log streaming broken with TFE local execution mode (#2364) 2022-07-12 08:53:55 -07:00
Li Lin
6b0fe76f4e Add --var-file-allowlist in server configuration (#2362) 2022-07-07 10:32:18 -07:00
PePe Amengual
77706cb578 Revert "fix: Delete locks and workdirs with potentially stale previous plans which fixes 1624 (#1704)" (#2316)
This reverts commit 82ac706273.
2022-06-28 17:54:57 -07:00
Steve Yoon
e90aa575e0 feat: Prometheus metrics support (#2204)
* support prometheus metrics

* remove redundant error checking

* load prometheus metrics config

* dynamic separator for subscopes

* removing unnecessary config file

* adding a few more metrics test cases

* remove testing handler

* fix upstream merge error
2022-06-28 08:58:15 -07: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
Michel Z. Santello
df0d58d29b fix: vcs-status-name hardcoded in PullIsMergeable function (#2312)
* feat: add userConfig.VCSStatusName to applyCommandRunner context

* fix: use vcsstatusname from context

* chore: normalize tests

* chore: update interface mock
2022-06-16 09:26:20 -07:00
giuli007
82ac706273 fix: Delete locks and workdirs with potentially stale previous plans which fixes 1624 (#1704)
* Delete previous plans on autoplan or atlantis plan

When using non-default workspaces, plans are stored
in pr-and-workspace-specific directories.
If a PR is subsequently updated it might happen that
some of the plans are no longer relevant with regards
to the latest changes.
This change ensures that plans are always deleted
when a generic plan is triggered either by autoplan
or by a "atlantis plan" command.
NB Plans are not cleaned up when specific projects are
planned explicitly with "atlantis plan -p/-d/-w".

* Use DeleteLockCommand to delete locks and workdirs
containing previous plans

Co-authored-by: giuli007 <giuglioz@gmail.com>
2022-06-10 21:18:01 -07:00
nitrocode
2b772541f5 Add version to /status endpoint (#2295)
* Add version to /status endpoint

* Add version to test

* Fix linting errors
2022-06-05 20:06:37 -07:00
Istvan Tapaszto
a491542b48 feat: MultiEnv step added (#1793)
* MultiEnv step added

* Values removed from the output

* Fixing tests

* multienv_step_runner_test added

* Documentation of new feature added

* Documentatation of new feature  modified

* multienv_step test file extension changed

* Fixed multinev_step_runner test

* Enhanced debug logging in multienv_step_runner

* Enhanced errorhandling

* Test command modified

* Test command modified

* Test command modified

* Test command modified

* Errorhandling modified

* Test command modified

* Test command modified

* Create empty map in test

* Fixing test ExpOut

* Testing, refactoring, eliminating extra debug log

* MultiEnv result modified from json to plain string

* MultiEnv step Run parameter updated

* Import added

* project_command_runner updated

* project_command_runner updated

* multienv_step_runner_test updated

* multienv doc modified

* Update runatlantis.io/docs/custom-workflows.md

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>

Co-authored-by: Istvan Tapaszto <istvan.tapaszto@msci.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2022-05-13 14:30:08 -07:00
Joshua S
25eea31689 fix: allow Github App to clone forks of a private repository (#2044)
fix: only fetch "pull/$PR_NUMBER/head" when githubAppEnabled
2022-04-08 11:51:31 -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
Nish Krishnan
d1d1539ced feat: Add stats support for basic operations (#2147) 2022-03-18 15:18: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
Leandro López
ca28b577a4 chore: improve /healthz endpoint performance (#2014)
* Add benchmark for /healthz endpoint

This benchmark will measure not only speed but also how much memory
each request to /healthz allocate. I'm adding the benchmark to have a
baseline to compare.

Signed-off-by: Leandro López (inkel) <inkel.ar@gmail.com>

* Hardcode /healthz body into a variable

We know it will always be this value, there's no need to import and
call json.MarshalIndent.

Signed-off-by: Leandro López (inkel) <inkel.ar@gmail.com>

* Initialize /healthz body only once

Signed-off-by: Leandro López (inkel) <inkel.ar@gmail.com>
2022-01-22 23:08:12 -05:00
Aayush Gupta
e06d181272 fix: add back basic auth support (#2008)
* Fix issue 1980

* Adding comment
2022-01-20 00:32:14 -05:00