Commit Graph

964 Commits

Author SHA1 Message Date
Alberto Rojas
4a7fc33857 fixbug: Update commandName in RunAndEmitStats (#3437) 2023-05-23 20:04:30 -05:00
Simon Heather
4915d8db5e fix(workflow-hook): log output with or without errors (#3422)
* fix: Errors in Pre or Post Workflow Hook Scripts do not Produce any Output

* Fix post workflow

* Update unit tests
2023-05-23 17:12:28 -05:00
Alberto Rojas
96cf38835e metrics: Fix Add missing project and command scopes to ProjectCommandRunner (#3416)
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2023-05-22 07:48:31 -05:00
oysteingraendsen
4e867fc36e feat: when using order group, abort plan/apply if any fail (#3323)
* feat: when using order group, abort plan/apply if any fail

* feat: add 'abort_on_execution_order_fail' flag on repo level

* feat: use runProjectCmdsParallelGroups in version_command_runner

* chore: add plan tests

---------

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2023-05-12 13:24:33 -04:00
Marcus Ramberg
4ed44d906c feat(reaction): disable reactions by setting an empty string (#3360)
* fix: Previous implementation tried to do comment parsing inside github, and only worked for 'atlantis' command.

This commit improves on that to make it possible to implement reactions in other VCS providers and also reuse the existing comment parsing.

* test: Add negative test to confirm reactions are not added for invalid comments

* test: Add a negative test to confirm invalid commands do not get a reaction
2023-05-05 23:00:25 -05:00
renovate[bot]
19010fd4ee fix(deps): update module github.com/golang-jwt/jwt/v4 to v5 in go.mod (#3366)
* fix(deps): update module github.com/golang-jwt/jwt/v4 to v5 in go.mod

* Bump jwt

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2023-05-05 16:53:23 +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
renovate[bot]
cc2d0c16e3 fix(deps): update module github.com/google/go-github/v51 to v52 in go.mod (#3346)
* fix(deps): update module github.com/google/go-github/v51 to v52 in go.mod

* Update fixtures.go

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2023-04-30 03:07:33 +00:00
Marcus Ramberg
f8b293ada0 feat: Github reaction emojis on PR comments (#2706)
* feat: Basic implementation of github reactions on PRs

Adds eyes whenever it detects an `atlantis` command.

* feat: Make the emoji reaction configurable

* tests: Add a mocked test for EmojiReaction being called in github

* ci: Disable revive linter for stubs
2023-04-25 17:22:51 -04:00
Shouichi Kamiya
f4fa3138d7 feat: add PULL_URL to environment variables (#3302)
Background:

It is convenient to have the PR URL available so that we can link the PR
that triggers the infrastructure changes from the audit logging system.
For example, the google cloud provider adds user-supplied justification
into google cloud audit logging via `CLOUDSDK_CORE_REQUEST_REASON`
environment variable.

https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#request_reason
2023-04-21 02:21:27 +00: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
Dylan Page
34ad9e901d fix: revert branch protection feature causing breaking change
Reverts "fix(github): branch protection not supported (#3276)"
Reverts "fix: allow Require Linear History when selecting merge method (#3211)"
Closes #3320
2023-04-11 16:48:39 -04:00
renovate[bot]
763f017169 fix(deps): update module github.com/google/go-github/v50 to v51 in go.mod (#3316)
* fix(deps): update module github.com/google/go-github/v50 to v51 in go.mod

* Update fixtures.go

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2023-04-11 00:36:40 -05:00
Isaac Wilson
089dc1aac8 fix(autoplan): modules for per-repo configs (#3272)
* Fix autoplan modules for per-repo configs

* Use utils package for slices.Contains
2023-04-03 06:25:01 -07:00
Isaac Wilson
8adb001aa6 fix(gitlab): Add backwards compatible mergability check (#3277)
* Add backwards compatibility for merability check in Gitlab client

* Cleanup
2023-03-30 19:31:56 -05:00
Tymofii Polekhin
ebc06c19c6 fix(github): branch protection not supported (#3276)
* fix: github branch protection not supported

* fix: typo protectionAvailable
2023-03-30 11:32:59 -05:00
Oliver
f35f4d6775 feat: Flag to disable custom [Atlantis] commit messages on PR merge (#3120)
* Modify the automere commit message to include the PR number [DEVOPS-674]

* Update server/events/vcs/common/common.go

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

* added test for PR message func [DEVOPS-674]

---------

Co-authored-by: Ken Kaizu <k.kaizu38@gmail.com>
2023-03-25 02:07:19 +00:00
Finn Arne Gangstad
1e00e2fa1c fix(checkout-strategy): On merge strategy, reclone when necessary on base update (#3187)
* merge again if base branch has been updated

The current "merge" checkout strategy is unsafe. It merges the PR and the base
branch without holding the directory lock(s), so there is a potentially
very long window where another PR can be applied and be unexpectedly reverted
later.

This happens occasionally if a PR causes plans in multiple directories, but
is almost _guaranteed_ to happen if the initial plan has to wait until a
lock is freed up and a manual "atlantis plan" command is given.

Instead of printing a warning when this happens, we now merge again
if necessary while holding the lock. Plans are then guaranteed to only
be made when merged with the base branch for each directory being planned,
and applying later should be safe even if the base branch sees further
updates.

This fixes/affects #804, #867, #979

* Remove diverged test that no longer applies

* Reinstate TestClone_MasterHasDiverged test and make it pass

* Extend TestClone_MasterHasDiverged to test new merging functionality

We now verify that the first Clone with CheckoutMerge=true with
a diverged base branch atually clones and merges again.

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-03-24 20:57:59 -05:00
Finn Arne Gangstad
ff5894c697 Tests should update test-local git configuration files (#3262)
The tests would mutate $HOME/.gitconfig and $HOME/.git-credentials.
Set the HOME environment variable to a suitable temporary
directory before running git commands that mutate the global config.

Fixes #2604
2023-03-24 15:08:55 -07:00
Jonathan Wiemers
8b90c8b0da feat: Rotate Github App Token outside of Atlantis commands (#3208)
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-03-23 00:49:23 +00:00
Joel Sleppy
3214b8c058 Poll Gitlab until changes are available (#3246)
Co-authored-by: Joel Sleppy <joel@sphinxdefense.com>
2023-03-20 20:46:35 +00:00
Tymofii Polekhin
7a33828227 fix: allow Require Linear History when selecting merge method (#3211)
* fix: account for Require Linear History when selecting merge method

* fix logic and add tests

* add nolint hints for w.Write

---------

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2023-03-18 17:43:11 -05:00
nitrocode
330ee04e66 fix(test): fix terraform ~> 1.3 resolution (#3233)
* fix(test): fix terraform ~> 1.3 resolution

* Update terraform_client_test.go
2023-03-15 16:06:37 -04:00
nitrocode
8374e570b6 fix(website): rm redundant v prefix (#3229)
* fix(website): rm redundant v prefix

* fix(footer): scroll should maintain version position

* fix(test): Use ~> 1.3 for 1.3.9 match
2023-03-15 14:31:34 -05:00
Finn Arne Gangstad
739d6e435b test(command-output): stabilize server jobs test (#3194)
* Bugfix: TestProjectCommandOutputHandler is unstable

Use buffered channels in TestProjectCommandOutputHandler

The output handler registered with
ProjectCommandOutputHandler.Register() needs the channel that
is given to not block writes.  If the channel
blocks writes, the channel is removed from the list
of active receivers on that JobID.

The tests are set up with unbuffered channels, and there
is a race condition where the channel reader does
not hit `for msg := range ch` before the message that
is sent is handled by AsyncProjectCommandOutputHandler.writeLogLine

By making the channel buffered it does not matter
that the reader isn't reading yet.

* Add missing wg.Wait() in TestProjectCommandOutputHandler

There is a rare race condition where messages come in
while the asserts run in the
"clean up all jobs when PR is closed" test.

Added  wg.Wait() to make sure all messages are processed
before running the final asserts.

---------

Co-authored-by: Finn Arne Gangstad <finnag@gmail.com>
2023-03-07 09:24:37 -06:00
nitrocode
57744538f1 fix(clone): omit checkout depth if it is zero (#3188) 2023-03-03 11:14:11 -08:00
nitrocode
47cb6bd2e3 fix(clone): omit checkout depth if it is zero (#3185) 2023-03-02 19:54:26 -08:00
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
zhuoyang
629d87f999 fix: Use hashicorp/go-version to resolve ~> 1.0 to 1.x instead of 1.0.x (#3153)
* Use go-version from hashicorp instead of semver

* refactor version test

* restructure test cases
2023-02-23 23:11:26 -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
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
SSKLCP
50de813677 fix(azure-devops): add check for test webhook URL (#2809)
* Adding check for Azure DevOps Test Webhook URL so they aren't processed like real events

* feat: customize vcs comment command executable name

* Altering case on isAzureDevOpsTestRepoURL function

* Altering case on URL parameter

* Altering checks to ensure all Azure DevOps Ignore tests pass

* Extending setup method to support Azure DevOps

* Fixing issue from merge conflict error

* gofmt

* Adding null checks to Test URL checks

* moving azuredevopsTestUrl to const

* Changing azuredevopsTestUrl to azuredevopsTestURL

* Cleaning up return statement

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

---------

Co-authored-by: Ken Kaizu <k.kaizu38@gmail.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2023-02-21 18:44:32 -06:00
Fabiano Soares Honorato
40f4e8ca6b fix: workflow output not sending output (#3091) 2023-02-18 08:26:33 -06:00
nitrocode
42ee3950c4 Swap moby with patternmatcher (#3106) 2023-02-06 21:14:42 -08:00
nitrocode
9ee8514889 bugfix(gitlab): correct detailed merge status check (#3067) 2023-02-06 21:12:02 -08:00
Ken Kaizu
48b18f9908 fix import/state rm success wrapped template (#3084) 2023-01-31 08:31:44 -06:00
Ken Kaizu
930daef300 chore: remove x package (#3085) 2023-01-31 08:28:28 -06: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
Ken Kaizu
75c4c1fdcf fix(deps): update module github.com/go-redis/redis/v9 to v9.0.1 (#3075) 2023-01-30 23:36:30 -06:00
Ken Kaizu
acc8ef6abc fix(deps): update module github.com/google/go-github/v49 to v50 (#3074) 2023-01-30 22:25:56 -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
9e3d8879ec fix: PR status summary should remove Note: Objects have changed outside of Terraform (#3010)
* extract PlanSuccess.DiffSummary

* commit status updater use DiffSummary instead Summary to show only diff result
2023-01-18 20:14:58 -06:00
Ken Kaizu
da48fb515d chore(test): add no test dir tests, rename testdata dir (#2986)
* add web_templates render tests

* add ansic strip tests

* move fixtures into testdata dir which is golang specific test dir name

* add server/metrics tests

* add recovery test

* add runtime stats test
2023-01-15 23:14:23 -06:00
renovate[bot]
71738f15b6 fix(deps): update module github.com/xanzy/go-gitlab to v0.78.0 in go.mod (#2960)
* fix(deps): update module github.com/xanzy/go-gitlab to v0.78.0

* Deprecate MergeStatus for DetailedMergeStatus

* Update gitlab_client_test.go

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
2023-01-15 20:47:28 -06:00
Ken Kaizu
ee7a5cadfb feat: PR check status to show summary e.g. Plan: 1 to add, 0 to change, 1 to destroy (#2983)
* feat: Update plan GitHub Status summary

* feat: revert result changes for Plan and Apply functions

* docs: Add CommandResult description

* feat: change plan status without ctx.CommandResult

* ensure DefaultCommitStatusUpdater implements runtime.statusUpdater

Co-authored-by: Alberto Rojas <alberto.rojas@n26.com>
2023-01-14 15:08:56 -06:00
Fabiano Soares Honorato
33bc28fa85 Fix instrumented approve policies calling apply (#2977) 2023-01-12 14:06:35 -08:00