Commit Graph

44 Commits

Author SHA1 Message Date
Clement Debiaune
69054861af feat: Trim backticks from MR comments (for Gitlab) (#5244)
Signed-off-by: Clement Debiaune <clement@yulife.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-21 20:56:22 -08:00
Alexey Kosenko
13fa635523 feat(automerge): implement GitHub --auto-merge-method flag for apply command (#4895)
Signed-off-by: a1k0u <alko7enko@gmail.com>
Signed-off-by: X-Guardian <simonheather99@gmail.com>
2024-11-02 20:09:17 +00:00
Martijn van der Kleijn
722c4a9372 feat: Add Gitea support (#4229)
* Add initial Gitea client structure

* Add various missing config flags

* initial gitea support added

* Fix some post-merge issues

* Replace HidePrevCommandComments by version from @florianbeisel

* Update mocks

* feat: add Webhook Signature Verification

This changes adds support for Gitea Webhook Signatures by wrapping the
function from the Gitea SDK and calling it from `handleGiteaPost()`.

* fix: use release version in go.mod

1.22 as in the previous go.mod is a development version. When referencing
a minimum release version the correct format is 1.22.0

* Set default Gitea url to cloud.gitea.com

* Fix and Add tests for Gitea

* Fix missing copyright header

* Changed comment to reflect no max comment length

Apparently there's no max comment length in Gitea at this point in time.

* Implement GetCloneURL()

* Decode Base64 before passing on downloaded file content

* Enable Gitea client as API Client

* Remove unneded comments

* Remove old redundant file

* fix: invalid version number in go.mod

* fix: remove unnecessary type conversions

* fix: removed unused function

* fix: remove unnecessary type conversion of decodedData

* fix: fixes some tests

* Correct gitea.com URL

* Add Gitea to website docs

* fix: TestPost_UnsupportedGiteaEvent

* revert version downgrades

* docs: add Gitea documentation to Guide section

* docs: fix copy paste mistake

* Update cmd/server_test.go

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

* Clarify usage msg for --gitea-base-url

* Apply suggestions from code review

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

* Turn ebreak number into const with comments

* Add --gitea-page-size server argument

Defaults to 30 based on https://docs.gitea.com/1.18/advanced/config-cheat-sheet#api-api

* Fix broken test

* Fix event parser and comment parser

* Add missing app permission to docs

* Make Gitea client conform to updated interface

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

Co-authored-by: Simon Heather <32168619+X-Guardian@users.noreply.github.com>

* Remove no longer needed logger

* Add extra logging statements for Gitea client

* Add debug statements

---------

Co-authored-by: Florian Beisel <florian@pacey.me>
Co-authored-by: Florian Beisel <florian@beisel.it>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Co-authored-by: Rui Chen <rui@chenrui.dev>
Co-authored-by: Simon Heather <32168619+X-Guardian@users.noreply.github.com>
2024-03-18 14:21:45 +00:00
Xavi Mabras
9295fabb9f feat: case insensitive pr comments (#3361)
* Basic case insensitive for pr comments.

* Add test for uppercase/lowercase case.

* Merge test functions that check similar behaviors.

---------

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-05-04 07:33:47 -05: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
Ed Laur
9b61288540 feat: Add check for misspelled executable name command (#3059)
* feat: Add check for misspelled executable name command

* Update server/utils/spellcheck_test.go

Co-authored-by: Ken Kaizu <k.kaizu38@gmail.com>

---------

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Co-authored-by: Ken Kaizu <k.kaizu38@gmail.com>
2023-02-22 00:45:14 +00: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
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
Marcus Ramberg
de953fe255 fix(command_parser): Update command parser help text (#2878)
Change it to use the new customizable executable command
2022-12-25 08:37:17 -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
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
Ken Kaizu
8d74878f9d feat: customize vcs comment command executable name (#2805) 2022-12-16 19:16:36 -08:00
Dominic Barnes
5da69620cf trim whitespace from comments before parsing (#2287) 2022-06-22 11:34:12 -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
Alexander Dupuy
dc4cc2f614 docs: document approve_policies command in comment_parser (#1886)
* docs: document approve_policies command in help

The `approve_policies` command was added with policy checking but was
never included in the command parser help.

Also update the comments in the file to reflect all of the commands.

* feat: Better message on policy failure

Include the specific command `approve_policies` in the message.
2021-11-17 17:25:29 -05:00
Pat Sier
d358857e80 feat: add version command (#1691) 2021-07-12 11:10:15 -04:00
Spiros Economakis
e48f80359b Add an extra flag to disable automerge with comment apply (#1533)
```
atlantis apply --auto-merge-disabled
```

Issue: #1245
2021-06-22 09:33:07 -07: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
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
Paris Morali
aed8d22b52 Implement atlantis unlock
This command is run on a pr and deletes all locks for the pr
2020-06-23 20:42:03 -07:00
David McPike
eeaab9f6d7 Merge tag 'v0.8.3' into azure-devops 2019-07-12 23:27:43 -05:00
Luke Kysow
9a21eef7a0 Escape additional comment args. (#699)
Remove extra quoting and instead add a backslach to each character in
the extra args before appending it to the command.
ex. atlantis plan -- -var key=val will result in:
  sh -c "atlantis plan \-\v\a\r \k\e\y\=\v\a\l"
Fixes #697.
2019-07-11 17:42:32 +01:00
David McPike
03bfefe9f4 continue azure devops support 2019-04-03 23:52:48 -05:00
Luke Kysow
2fb49130c5 Respond to bitbucket cloud/server username.
Looks like we forgot to add the ability for bitbucket cloud/server users
to invoke Atlantis using the name of the user they're running it as.
2019-03-13 16:13:52 -05:00
Luke Kysow
2bcf17b474 Fixes #533, a regression where Atlantis will respond with errors to
comments that aren't intended to invoke Atlantis.
2019-03-13 16:13:52 -05:00
Luke Kysow
30577a4c4d Support dirs with spaces.
Allow running atlantis plan -d "dir with spaces" to target a directory
that contains spaces.

Fixes #423
2019-03-05 16:16:16 -05:00
Luke Kysow
5f4a94b0af Move CommandName to models package 2019-02-26 12:03:25 -05:00
Luke Kysow
e9b7001266 Add godocs. Refactor ProjectResult. Golint errors. 2018-08-30 16:47:17 -06:00
Luke Kysow
c72cd95202 Print commands to run in comments. 2018-08-10 09:26:53 -10:00
Luke Kysow
5ee990cec1 Don't default dir and workspace.
Lay groundwork for atlantis plan/apply to work on everything.
2018-08-08 17:08:08 -10:00
Luke Kysow
a201c8a1bb Ignore extra newlines in comments.
Accept comments like
```
atlantis plan

```
So that when a comment is copy-pasted in GitHub and GitHub adds two
newlines, Atlantis still parses that comment.
2018-08-02 20:43:09 -07:00
Luke Kysow
6940bfa57e Rename enum 2018-08-02 20:26:05 -07:00
Luke Kysow
3339dcd92b Dir/Path -> RepoRelDir, path (in templates) -> dir 2018-06-29 18:05:47 +02:00
Luke Kysow
6b507eb721 Add -p flag. 2018-06-19 20:51:59 +01:00
Luke Kysow
8ee16a0281 By default atlantis plan will run in root dir.
This change makes things cleaner because there will only ever be one
plan generated in the comment flow. It's okay to make this change
because typing the plan command a couple times isn't too bad AND we're
going to be implementing autoplanning which should handle most of the
times you needed to type plan from before.
2018-06-05 17:06:57 +01:00
Luke Kysow
f21cf09417 Refactor to use VCS Host in Repo model. 2018-03-27 12:43:20 -07:00
Luke Kysow
85ab7475f8 Validate workspace the same way as Terraform.
Saw in the TF code how they were validating workspace names
and decided to do the same. '..' is actually a valid TF workspace but we
don't support that.
2018-03-19 20:27:02 -07:00
Luke Kysow
8aca81966f Add Apache 2 license and copyright.
Add Apache 2 license and Hootsuite copyright to all golang
files. Add a disclaimer that the files have been modified
hereafter by contributors to this repo in order to abide
by the Apache 2 license requirements.
2018-03-15 17:25:02 -07:00
Luke Kysow
0e6bae7226 Output usage on error. 2018-03-11 12:51:11 -07:00
Luke Kysow
f91947a397 Comment with error when unused arguments. 2018-03-08 23:10:02 -08:00
Luke Kysow
a24d940f5d Rename DetermineCommand to Parse 2018-02-28 11:04:28 -08:00
Luke Kysow
2af2f10cbc Ensure quotes are escaped for extra args. 2018-02-28 10:52:53 -08:00
Luke Kysow
a09ad79405 Refactor comment parsing into own class. 2018-02-28 10:42:21 -08:00