Commit Graph

887 Commits

Author SHA1 Message Date
Ken Kaizu
2d29db6893 fix: Policy check summary not shown outside of "Show Output" details (#2837) 2022-12-20 07:28:12 -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
Ken Kaizu
08e9c5a17e feat: customize atlantis.yaml file name in server side config (#2798)
* feat: customize atlantis.yaml file name in server side config

* Update server/events/vcs/bitbucketcloud/client.go

* Update server/events/vcs/bitbucketserver/client.go

* Update server/events/vcs/not_configured_vcs_client.go

* Update server/events/vcs/azuredevops_client.go

* docs: repo_config_file multiple atlantis servers usecase example

* docs: multiple atlantis server usage which show how to call one atlantis server

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

* Apply suggestions from code review

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

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2022-12-18 23:02:38 -06:00
Sebastian Poxhofer
01a9a5f5a7 feat: dismiss approvals when planning (#2696)
* feat: dismiss approvals when planning

* feat: add pagination and move query in separate method

* tests: add test for dismissing

* refactor: fix linting issue

* implement change requests

* Update cmd/server.go

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

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2022-12-18 22:31:10 -06:00
renovate[bot]
037c064a79 chore(deps): update dependency open-policy-agent/conftest to v0.36.0 (#2820)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-12-18 21:02:27 -06:00
James Williams
71819a28f4 Switch clone URL structure for *.visualstudio.com URLs for AzureDevOps (#2810)
* Switch clone URL structure for visualstudio.com URLs

* Add comment for ADO URL if statement. Add test

* Test else statement in ParseAzureDevopsRepo
2022-12-18 18:32:46 -06:00
Ken Kaizu
bbc7b9969a feat: renovate handle regexManagers to update conftest/tf versions (#2807)
* chore(deps): add renovate.json

* feat: renovate handle regexManagers to update conftest/tf versions

* Update .github/renovate.json5

* Update .github/renovate.json5

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2022-12-18 18:21:01 -06:00
Ken Kaizu
063bbb93c9 refactor: e2e test ensure conftest command to check conftest version is greater or equal to specific version (#2812) 2022-12-18 03:31:40 -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
SSKLCP
a96a88ec97 Adding a check for deleted comments in AzureDevOps event handler (#2804)
* Adding a check for deleted comments in AzureDevOps event handler

* adding test for ignoring azure devops deleted comments

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2022-12-16 22:18:29 -06:00
Ken Kaizu
8d74878f9d feat: customize vcs comment command executable name (#2805) 2022-12-16 19:16:36 -08: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
Ken Kaizu
6ecb7a6f76 replace www.terraform.io doc urls (#2797) 2022-12-14 18:07:40 -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
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
Michel Z. Santello
c800f706e4 fix(gitlab_client): prevent duplicate pipelines in gitlab merge requests (#2745)
* fix(gitlab_client): change CommitStatus update logic to prevent duplicated pipelines in MRs

* chore: refactor refTarget logic

* chore: fix tests

* chore: fix lint

* chore: remove nested if
2022-12-07 13:14:39 -08:00
Chris Sainty
e60dd843f4 feat: support atlantis.yaml without defined projects (#2300)
* Support atlantis.yaml without defined projects

* Update server/events/project_command_builder.go

* Update server/events/project_command_builder.go

* Correct test of no modified projects

* Flip if statement

* Remove duplicate check on hasRepoCfg

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2022-12-01 01:03:27 -08: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
nitrocode
629e688b0c Allow --gh-team-allowlist to work with team names and slugs (#2719)
* Add team slugs

* Expand test to include both names and slugs

* docs: add version document of flag before/after

* docs: this will be merged for next release
2022-11-25 12:47:49 -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
Ken Kaizu
cde8faaf57 Fix GitHub app uses slug as user name to work --hide-prev-plan-comments correctly (#2697)
* Fix GitHub app uses slug as user name

* Update server/events/vcs/github_credentials_test.go

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

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2022-11-20 16:18:34 -06:00
Alberto Rojas
949ee3fa5f metrics: Add Metrics tags to multiple Scopes (#2687)
* metrics: Add Metrics tags to multiple Scopes

* metrics: Fix base_repo and pr_number

* metrics: Refactor SetScope to SetScopeTags

* metrics: Add SetGitScopeTags function

* metrics: docs reword project_context SetScopeTags description

* metrics: test Add TestNewScope_PrometheusTaggingCapabilities
2022-11-19 08:31:46 -06:00
ribejara-te
020eeba85d upgrade Git clone locking mechanism to go1.19 (#2521)
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2022-11-18 18:19:24 -06: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
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
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
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
Luke Massa
752d86173e feat: Add status to the real-time logs page (#2426)
* Add status of the terminal to the footer

* Change function call

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2022-11-13 21:08:25 -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
Thomas Lorreyte
7f75002b6b feat: add policy check summary in wrapped messages (#2452)
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2022-11-12 22:45:19 -06:00
nitrocode
ac6a8239aa Use official slack/slack-go library (#2669)
* Use slack-go

* rm'ed a couple tests due open issue in pegomock
2022-11-12 20:32:19 -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
Anton Bronnikov
4cacaeb0c7 Implement branch matching in repo-level config (#2522) 2022-11-08 22:08:20 -08:00
Adam Verigin
c3462f9073 Add COMMENT_ARGS to pre/post-workflow hook execution environment (#2621) 2022-11-07 14:50:49 -06:00
Michel Z. Santello
479f2b7edb fix: prevent commit status update in incorrect MR (#2636)
* fix: prevent commit status in incorrect MR
  - closes https://github.com/runatlantis/atlantis/issues/2484

* chore: update test 'TestGitlabClient_UpdateStatus'
2022-11-04 09:22:55 -07:00
Volodymyr Stupnytskyi
4cc5cf6848 Updating diffKeywordRegex to properly handle new test case (#2551)
* new resource was added to test TestRenderProjectResultsWithEnableDiffMarkdownFormat

* Correct test case

* 1st regex change

* Adding one more pattern to regex

Co-authored-by: dyurovskykh-tivo <Dmytro.Yurovskykh@tivo.com>
2022-11-04 09:19:39 -07:00
Devan Patel
c03ef1d68f Bitbucket Server: Send password as Bearer instead of Basic Auth (#2461)
* Bitbucket Server: Send password as Bearer instead of Basic Auth

Signed-off-by: Devan Patel <Dev25@users.noreply.github.com>

* docs: Add Bearer note for Bitbucket Server auth

Signed-off-by: Dev <Dev25@users.noreply.github.com>

Signed-off-by: Devan Patel <Dev25@users.noreply.github.com>
Signed-off-by: Dev <Dev25@users.noreply.github.com>
2022-10-31 14:48:07 -07:00
Tyler Lubeck
9ab3fd2416 Add tags to project metrics (#2623)
* Add tags to project metrics

This adds a few tags that I've found useful for our monitoring of a
many-project terraform repository. There are likely more tags that can
be added in other areas, but I figured I'd start small and get feedback
before increasing the blast radius

* Add labels, handle nils, alphabetize

* Move //nolint to line of assignment
2022-10-27 20:04:06 -05: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
Forest Oden
d0715faee1 fix: typo in log message when running parallel plans (#2620)
Signed-off-by: Forest Oden <forest.oden@beatport.com>
2022-10-25 17:28:34 -04:00
Joel Llacer Martinez
8e27a471d1 Silence allow list errors works again (#2535) 2022-10-10 21:35:23 -07:00
chavacava
57b01166a6 fix #2537 by removing redundant conditional branch (#2545) 2022-10-10 21:13:24 -07:00
Quan Hoang
8b20bebf16 Determine Terraform Cloud workspace from configuration (#2432) 2022-09-30 13:36:53 -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
Alberto Llamas
9829fa23c2 Fix: Error when enabling prometheus metrics (#2379) (#2528)
Prometheus metrics names have some restrictions that must match the regex `[a-zA-Z_:][a-zA-Z0-9_:]*`
2022-09-20 21:27:30 -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
Rui Chen
6fd8130fe1 lint: gofmt -w -s . (#2504)
Signed-off-by: Rui Chen <rui@chenrui.dev>

Signed-off-by: Rui Chen <rui@chenrui.dev>
2022-09-12 18:08:46 -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
Stas Ostrovskyi
b8297bb1f8 fix: Set mergeable correctly when branch protection doesn't require reviewers (#2470)
* Allow no required reviewers

* Fix comment in tests

Co-authored-by: Stas Ostrovskyi <stasostrovskyi@users.noreply.github.com>
2022-09-08 13:54:50 -07:00