Commit Graph

27 Commits

Author SHA1 Message Date
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
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
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
Luke Kysow
0df4d924b3 Update test name 2020-01-20 10:24:54 -06:00
Josh Sinfield
e78cdd9524 Update defaultwhenmodified to include **/terragrunt.hcl (#858)
Update defaultwhenmodified to include **/terragrunt.hcl

This allows a pre-existing TG 0.19+ project to autoplan if no when_modified is set

Closes #803
2020-01-20 10:24:26 -06:00
Luke Kysow
153ac96510 Fix bug when redefining default workflow
Previously, given the config:
  workflows:
    default:
      ...

We wouldn't actually use the redefined default workfow in our always
existing first repo config. This would mean that the redefined default
was never used unless users explicitly set workflow: default in the
repos array.
2019-11-26 16:16:51 -08:00
Max Curran
c2934b4b49 Error out if atlantis.yml is used as config file 2019-10-30 00:12:38 +00:00
Luke Kysow
b81fe9a5e5 Switch to gomod 2019-08-26 18:38:22 +02:00
Luke Kysow
c646f20c34 Actually pass env vars between steps
Also some refactoring and testing.
2019-08-21 15:12:35 +02:00
Luke Kysow
374e7a6a30 Merge in default cfg in other location 2019-04-02 18:06:35 -03:00
Luke Kysow
8982a67b78 Run latest goimports 2019-03-30 20:22:49 -05: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
b12d487cb2 Add new --repo-config-json flag
This flag will allow users to specify repo config as json instead of
writing a file to disk. This is useful in deployments where disk access
is more difficult, ex. Docker.
2019-03-27 19:52:58 -05:00
Luke Kysow
d78b106cab Refactor @jjulien's server-side config work. 2019-03-27 14:47:48 -05:00
John Julien
1fcdaba719 Added new --repo-config option and deprecated --allow-repo-config
This enables atlantis.yaml in all repos, but by default restricts
certain sensitive keys from being used.

The keys apply_requirements, workflow, and workflows can only be
specified in an atlantis.yaml file if explicitly allowed by a
server side repo config.

The repo config file provides the ability to specify a default set of
workflows, and default values for apply_requirements and workflow to use
use on a per repo basis.  It also supports applying to a collection of
repos by using regex to match a repo name.

If more than one repo name matches, the values from last repo matched
are used.

This deprecates the --allow-repo-config option
2019-03-27 14:47:48 -05: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
a6574b897d Change default when_modified to **/*.tf*
This is so .tfvars files match.
2018-07-10 14:24:30 +02:00
Luke Kysow
b2bd90da61 Various fixes
- delete working dir when lock deleted
- check if dir still exists when looking at modified
- check if atlantis.yaml is allowed before parsing
2018-07-03 13:32:17 +02:00
Luke Kysow
f29dc00edf Warn if not using version 2 2018-06-29 20:58:30 +02:00
Luke Kysow
507ce4358a Rename Spec -> Config 2018-06-29 17:33:02 +02:00
Luke Kysow
45d80fc695 Fix gometalint errors. 2018-06-19 20:59:25 +01:00
Luke Kysow
6b507eb721 Add -p flag. 2018-06-19 20:51:59 +01:00
Luke Kysow
8ab4857f77 Fix all tests 2018-06-15 16:16:31 +01:00
Luke Kysow
d70e57e87b Yaml parsing and validation. 2018-06-13 13:54:04 +01:00
Luke Kysow
f59fe33a4c Parse YAML without defaults/validation. 2018-06-12 18:43:22 +01:00
Luke Kysow
d6883e83e4 Move runtime elements to the runtime package 2018-06-08 16:36:04 +01:00