Commit Graph

690 Commits

Author SHA1 Message Date
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
Sarvar Muminov
ad76385c76 Global atlantis lock new release branch (#1473)
* Orca 679 global atlantis lock new release branch (#49)

* Adding CommandLocker to boltDB and exposing it through locker interface

* Apply lock ui and apply command lock controller

* Minor comments

* Adding more tests and refactorinng

* Linting fixes

* creating applyLockingClient variable to fix interface error

* nullsink for stats

* Addressing PR comments

* fixing e2e tests

* linting fix fml

* Update outdated function descriptions

Address PR comments

* revert stats sink changes

* remove unnecessary dependencies
2021-04-01 15:40:29 -07:00
Mathieu Cantin
71a5dec88d Remove refreshing state 3e (#1433)
* fix(output): Remove Refreshing state... from output

Since Terraform 0.14.0 there are no separator between refreshing plan and the plan.
2021-03-10 12:18:10 -08:00
laurent apollis
d2ef2775c8 Support regexp in command builder on the project name (#1419) 2021-03-05 16:13:23 -08:00
Nish Krishnan
374e826393 Revert "fix(output): Remove Refreshing state... from output (#1352)" (#1431)
This reverts commit 7301febcb4.
2021-02-25 09:35:52 -08:00
Mathieu Cantin
7301febcb4 fix(output): Remove Refreshing state... from output (#1352)
* fix(output): Remove Refreshing state... from output

Since Terraform 0.14.0 there are no separator between refreshing plan and the plan.

* Fix comment typo
2021-02-25 08:34:35 -08:00
Dalton Hubble
00a5bc0fc0 Add a branch regex matcher to the server side repo config (#1383)
* Add a branch regex to the repo.yaml config to allow Atlantis to
accept only pull requests with a given base branch (the branch
a PR would merge _into_).
* `branch` is optional. By default its unset and Atlantis will match
webhooks for pull requests for any branch (no change)

Match any PR,

```
repos:
  - id: /.*/
    branch: /.*/
```

Match only PRs with master or main base branch.

```
repos:
  - id: /.*/
    branch: /(main|master)/
```

Some repos have special pull request branching practices. For example,
plan/apply from feature branches merging into master, but separate flows
for merging master into a release branch (where Atlantis isn't used).
Adding a regex allows for flexible workflow options. For example, you
could have Atlantis ignore "release" branches.
2021-02-24 12:52:30 -08:00
Gábor Lipták
832afeaec1 Correct typo (#1424) 2021-02-23 17:04:35 -05:00
Gábor Lipták
ec84dc861f Correct typo (#1425) 2021-02-23 17:04:07 -05:00
myoung34
a6e5c16608 Feature: Add HEAD_COMMIT env var (#1392) 2021-02-22 21:47:00 -08:00
Nish Krishnan
8598c37671 Support pre-workflow hooks on all comment/auto triggered commands. (#43) (#1418)
Fixes pre-workflow-hooks not logging errors #1371
Prevents pre-workflow-hook from locking and cloning the dir if there are no hooks registered. #1342
2021-02-22 08:34:26 -08:00
Sarvar Muminov
af2a806870 Implement a new policy check workflow (#1317)
* Adding policy_check support into yaml config

* Added policy check model and runtime structs

* Adding BuildPolicyCheckCommand to ProjectCommandBuilder

* Return incorrectly deleted code

* Remove BuildAutoPolicyPlanCommand from ProjectCommandBuilder

* Split runAutoCommand into two functions

runAutoPlanCommand - does what originally RunAutoplancommand was doing
except now it returns CommandResult and []models.ProjectCommandContext
runAutoPolicyCheckCommand - accepts CommandContext, CommandResult, and
[]models.ProjectCommandContext as arguments and runs PolicyCheckStep runner

* Refactor RunCommentCommand
* Remove BuildPolicyCheckCommand and rename StepCmdExec back to TerraformExec
* Add policy step runner logic and conftest interfaces.
* Add show step runner to policy check stage.

* Adding models.PolicyCheckCommand to buildCtx

This also means buildPlanAllCommands call buildCtx twice once with
models.PlanCommand and once with models.PolicyCheckCommand

* Adding new project_command_builder that supports policy_check

* Refactoring PolicyCheck specific logic into a PolicyCheckProjectCommandBuilder

* Moving events.CommandContext to models.CommandContext this will allow me
to remove buildCtx method and move ProjectCommandContext creation into
models package

* Policy Owners might be different types, for that reason we are
refactoring Owners into its own struct with specific keys defining
different owner types

Co-authored-by: Nish Krishnan <nishk@lyft.com>
Co-authored-by: Nish Krishnan <nishkrishnan@users.noreply.github.com>
2021-02-10 18:13:44 -08:00
Nish Krishnan
10d7b282e8 Fix e2e test fixtures for tf0.14. (#1396) 2021-02-10 16:48:35 -08:00
Marc Goujon
434b4f5074 Fixed bug in allowed_workflows logic (#1377) 2021-01-30 20:32:10 -08:00
Mihai Plasoianu
2c4e0c3409 Set TF_WORKSPACE env var (#1363) 2021-01-28 11:56:08 -08:00
Radon Rosborough
63a6e6450e Pass atlantis/apply when there are no plans (#1323) 2021-01-28 10:45:57 -08:00
Thomas Lacroix
6dfa6d55b5 fix(slack): replace slack GetChannels by GetConversations (#1350) 2021-01-28 10:37:01 -08:00
Gerald Barker
1137a82c60 Add the ability to disable Atlantis locking a repo (#1340)
* Add the ability to disable Atlantis locking a repo

* Fix incorrect logic when creating locking Client

Co-authored-by: kbaldyga <kbaldyga@gmail.com>

* Add tests for noOpLocker to improve coverage

Co-authored-by: Gerald Barker <geraldbarker@mail.com>
Co-authored-by: kbaldyga <kbaldyga@gmail.com>
2021-01-14 10:20:27 -05:00
Istvan Tapaszto
68e20b1dc1 Fixing AutoMerge issue with Azure DevOps (#1289)
* Getting Azure DevOps user id on the fly

* mcdafydd/go-azuredevops module version increased

* Additional errorhandling

* Additional errorhandling Part2

* Doc update:  Access permission requirement

* Fixing modules.txt

* Fixing modules.txt

* Modules.txt fixed

* AzureDevops dependencies committed to vendor

* Fixing AzureDevOpsClient tests

* Fixing invalid bitbucket references in docs

* Fixing modules.txt

* Fixing go.mod

Co-authored-by: Tapaszto, Istvan <istvan.tapaszto@msciintegration.onmicrosoft.com>
2021-01-13 09:01:06 -05:00
Nish Krishnan
1513ee6421 Add support for fetching gh app user. (#30) (#1334)
* Add support for fetching gh app user. (#30)

* Upgrade pegomock.

* go mod vendor.
2021-01-05 15:21:31 -08:00
Matija Buriša
43fce15076 add a valid variable definition file extension to list of exceptions (#1331)
* add a valid variable definition file extension to list of exceptions

* run go fmt

Co-authored-by: Matija Burisa <Matija.Burisa@infobip.com>
2021-01-04 12:08:50 -08:00
Alex Castle
d827f2c1d5 chore: correct cast from int to string in error message formating (#1327) 2020-12-22 10:29:22 -05:00
Sarvar Muminov
3456dc934b Add pre workflow custom hooks to run scripts before workflow execution(plan, apply, etc) (#1255)
* Updated runatlantis.io/docs to have `pre-workflow-hooks` use cases and examples
2020-12-14 15:19:52 -05:00
Marc Goujon
5a1e19155d Added support for restricting workflows usage repo-side (#1099)
* Added the ability to restrict server-side workflows on a per repo basis

* Fixed documentation broken links

* Removed unneeded
2020-12-14 10:37:37 -08:00
Laura Martin
b6e8403688 Use regex to filter filenames (#1253)
I ran into an issue where I have a directory of templates I use that I
name `foo.tf.template`. I found that Atlantis was running against this
directory and failing, which was unexpected behaviour.

This is because we're just checking if `.tf` is contained within a
filename, rather than checking if it's the suffix of the filename.

Instead, we can use regex to ensure that we're only filtering on actual
Terraform files, inclusive of `.tf` and `.tfvars` suffixes.

There are obviously some alternative ways I could get around this:
rename my templates to `foo.template` without the `.tf`.

I also really liked the idea of a `.atlantisignore` file previously
cited[1], but it was rejected in favour of explicitly defining exactly
which directories to run it in. We have a large number of directories so
this wasn't appealing to me.

I felt this behaviour was sufficiently unexpected that it was worth
making a more explicit filter.

[1] https://github.com/runatlantis/atlantis/issues/26
2020-12-12 21:18:40 -05:00
chenrui
d51a4706b3 chore(deps): sprig 3.1.0 (#1313)
* chore(deps): sprig 3.1.0

Signed-off-by: Rui Chen <rui@meetup.com>

* go mod vendor

Signed-off-by: Rui Chen <rui@meetup.com>
2020-12-12 21:05:15 -05:00
Alex Castle
8d921a7dc7 Fix >= 0.12.0 version detection for versions with prereleases 2020-12-03 23:20:44 -05:00
Nish Krishnan
1513089988 Merge pull request #1238 from lyft/fix-for-1236
Ensure that refreshed creds are used to update remote.
2020-12-02 16:39:02 -05:00
Gerald Barker
9a0cfd3c53 Set ApplyDisabled on CommentParser to fix help output 2020-11-01 22:58:11 +00:00
Gerald Barker
d2610a78af Add Option to globally disable apply (#1230)
* Add Option to globally disable apply

Co-authored-by: Gerald Barker <geraldbarker@mail.com>
2020-10-27 21:01:39 -07:00
Luke Kysow
c789e1a787 Merge pull request #1177 from dmattia/dmattia/concurrency_flag
Added configurable parallelism pool size
2020-10-26 17:31:12 -07:00
Nish Krishnan
1110c526c5 Ensure that refreshed creds are used to update remote. 2020-10-23 20:06:09 -07:00
Nish Krishnan
0a7d6441fd lint. 2020-10-14 17:41:37 -07:00
Nish Krishnan
9fa0c91bcb [1193] Fix merge strategy for gh apps 2020-10-14 17:35:38 -07:00
Alex Castle
6b6b2640d2 Fix ignore condition for atlantis apply status 2020-10-02 10:45:55 -04:00
Alex Castle
732b19b62c Fix AzureDevops PR status updates 2020-10-01 19:16:47 -04:00
Luke Kysow
f787100b6a Fix bug responding to draft pr updates
Previously any update to a draft PR other than "closed" would default to
being an "open" event due to a bug in the parsing logic.
2020-09-22 09:49:41 -07:00
Rich Stokes
e899a5d5c9 Improve working dir lock error formatting (#1182)
* Improve working dir lock error formatting
2020-09-11 16:46:02 -07:00
dmattia
605dde7b2b Fix typos 2020-09-03 10:57:52 -05:00
dmattia
d1fe029438 Added configurable parallelism pool size 2020-09-03 10:51:40 -05:00
Luke Kysow
7363cce699 Update config-inspect version 2020-08-27 12:26:20 -07:00
Luke Kysow
cd37563857 Merge pull request #1159 from runatlantis/disable-autoplan
Disable autoplan global flag
2020-08-18 15:59:59 -07:00
ValdirGuerra
34f9f3f348 Add support for disable autoplan from server config 2020-08-18 15:55:22 -07:00
Luke Kysow
cbe0b18c0e Refactor --skip-clone-no-changes work. 2020-08-18 15:48:33 -07:00
Quan Hoang
54e3dc2ef0 Skip cloning PR repository in case of no projects configured in repo config file were changed 2020-08-18 15:48:05 -07:00
Luke Kysow
eb46201003 Merge pull request #1135 from mcdafydd/azdo/fixes-1079
NewRepo() encodes spaces in clone URLs.
2020-08-06 15:42:35 -07:00
Luke Kysow
37ab0e2742 Merge pull request #1130 from runatlantis/allowlist
Deprecate --repo-whitelist for --repo-allowlist
2020-08-06 15:37:34 -07:00
Luke Kysow
f91cc27b68 Update go-gitlab 2020-08-06 15:30:20 -07:00
David McPike
0aea14a8ec Fixes #1079
- NewRepo() encodes clone URLs that contain spaces
2020-07-29 23:58:15 -05:00
Luke Kysow
5976b7c1bd Merge pull request #1128 from katenels/master
Log apply start at info level
2020-07-27 09:02:38 -07:00