Commit Graph

1084 Commits

Author SHA1 Message Date
Luke Massa
e846d90d1a fix: Sort results in command builder before comparing (#4385) 2024-03-26 12:09:29 -07:00
Simon Heather
566b15f356 feat: Refine the Atlantis VCS Pull Request Comments (#4254) 2024-03-23 11:58:30 -04: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
Marco Ceppi
f214105f48 fix: detect workspaces when in subdirectories (#4363) 2024-03-16 16:32:23 -04:00
mmokijewski
d5b63d2ee7 improve error log and add unit test (needed to force push to change committing user) (#4177) 2024-03-05 10:33:31 -05:00
Hans Arnholm
d40b762ac0 revert: regression: remote ops detection TF v1.1 (#4169)
Reverts linter change from #3690 which breaks TF v1.1 detection
2024-03-05 10:31:40 -05:00
renovate[bot]
6884238cd1 fix(deps): update module github.com/google/go-github/v58 to v59 in go.mod (main) (#4241)
* fix(deps): update module github.com/google/go-github/v58 to v59 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>
2024-02-27 23:47:57 -06:00
Simon Heather
67b5740053 feat: Refine The Atlantis VCS Logging Configuration (#4285)
* Refine VCS Logging

* Remove github/gitlab client logger

* Remove fmtLogSrc from instrumented_client and format

* Add staticcheck lint exception for NewGitHubClient

* Fix tests
2024-02-26 13:07:41 -05:00
Simon Heather
d432b0b4c8 chore(deps): Update xterm.js to v5.3.0 and enable Smooth Scrolling (#4257) 2024-02-25 15:24:04 +00:00
Luke Massa
783c011d02 feat: Add logic for project name into lock (#4192)
* feat: Add logic for project name into lock

* More logic

* Fix tests

* Add tests
2024-02-12 14:02:04 -05:00
Thomas Lorreyte
9fa4cd3c34 fix: unnamed jobs in ui (#4137) 2024-02-02 05:21:17 -08:00
Luke Massa
fad38c5ee7 feat: Prevent unused flags (#4182)
* Prevent unused flags

* Better verbiage

* Implementation for preventing unused flags

* Change comments and verbiage
2024-01-29 18:24:55 -05:00
Luke Massa
34ef59d132 chore: Upgrade yaml v3 (#4172)
* fix(deps): update module gopkg.in/yaml.v2 to v3 in go.mod

* chore: Upgrade to go-yaml v3

* Fix comment

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2024-01-25 13:09:34 -05:00
Isaac Gaskin
fe32f8645c feat(4157): adding option to hide UI button to disable apply commands (#4158) 2024-01-24 00:10:44 -05:00
renovate[bot]
ef766d2ec1 fix(deps): update module github.com/google/go-github/v57 to v58 in go.mod (main) (#4138)
* fix(deps): update module github.com/google/go-github/v57 to v58 in go.mod

* Update remaining go-github to v58

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Luke Massa <lmassa@tripadvisor.com>
2024-01-19 10:30:38 -05:00
Luke Massa
0b51afc4ab chore: fix linting issues (#4110) 2024-01-02 10:54:27 -05:00
Simon Heather
310fc8a44c feat: Add Summaries to Plan And Apply PR Comments (#3889) 2024-01-02 09:07:07 +00:00
Simon Heather
31802675da fix: Atlantis Does Not Consider the Plan Directory When Hiding Previous Plan Comments (#4012)
* Fix Hide Previous Plan Comments

* Update GitLab client tests

* Update GitLab client test

* Update github client test

* Add nolint: errcheck to test

* format github_client.go
2023-12-29 13:15:17 -05:00
Luke Massa
6cad7e6482 chore: Remove settings for require approval, mergeable, undiverged (#4047)
* Remove settings for require approval, mergeable, undiverged

* Fix
2023-12-27 16:11:45 +00:00
Prajith
b7a06faee1 fix: download conftest binary for correct arch (#4089)
* download conftest binary for correct arch

Signed-off-by: Prajith P <prajithpalakkuda@gmail.com>

* remove default constant

Signed-off-by: Prajith P <prajithpalakkuda@gmail.com>

---------

Signed-off-by: Prajith P <prajithpalakkuda@gmail.com>
2023-12-27 15:49:27 +00:00
Luke Massa
7faa03fd18 chore: fix label type in gitlab testdata (#4091) 2023-12-23 11:34:22 -05:00
Adam Kafka
f5d92c60b5 fix: Prevent panics when logging HTTP response status in github and gitlab client (#4082)
Fix potential nil pointers. See https://github.com/runatlantis/atlantis/issues/4081 for context.
2023-12-22 11:36:04 -05:00
Luke Massa
1035d9263a chore: Move gitlab client test data into testdata/ files (#4086)
* feat: Move gitlab client test data into testdata/ files

* Cleanup
2023-12-21 19:20:40 -05:00
jandersen-plaid
63f9a519b7 fix: ensure the MR log line prints an integer and not a rune (#4078)
Signed-off-by: Jack Andersen <jandersen@plaid.com>
2023-12-19 17:12:39 -05:00
Luke Massa
1e45e2f1f6 fx: CI for markdown renderer (#4066) 2023-12-17 09:09:34 -08:00
Alan Bover
da72b8366f Update working_dir.go (#4048)
fix mergeAgain function for when the PR is created from a fork
2023-12-13 15:06:04 +00:00
David Glasser
bcd91960db Fix rendering of 🚮 in default templates (#4044)
It seems that GitHub has changed its Markdown renderer such that an
emoji followed by a string of plain text (with no other formatting)
followed by a colon at the end of the line renders as plain text instead
of as the emoji. Compare the following two lines:

* 🚮 To delete all plans and locks for the PR, comment:

* 🚮 To **delete** all plans and locks for the PR, comment:

While this seems like it is probably a GitHub bug, we can work around it
by adding some formatting between the emoji and the end of the line,
which matches the bullet point above it anyway.
2023-12-13 09:55:52 -05:00
Luke Massa
d643c521ab feat: Remove flag for allow repo config (#3911)
* Remove option to allow repo

* Fix internal test

* Fix fmt

* Fmt

* Fix rebase

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: Dylan Page <dylan.page@autodesk.com>
2023-12-12 03:24:38 +00:00
Daniel Martins
95c5fe0fb3 fix: Enforce policy checks for overridden apply reqs (#3960)
* Enforce policy checks for overriden apply reqs

* Another take on the fix

This new version only includes the 'policies_passed' req back if
policy checks are enabled for the project.

* Fix test

* Fix comment

* Fix spelling

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-12-11 21:48:23 -05:00
Simon Heather
d1661dac4d fix: In Gitlab, if an Atlantis 'Apply' Pipeline Job fails, it cannot be Re-Applied on the Same Commit (#4007)
* Fix GitLab CI Must Pass

* Fix projectID

* nolint:staticcheck

* nolint:gosec

* Fix formatting

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: Dylan Page <dylan.page@autodesk.com>
2023-12-12 02:45:58 +00:00
Finn Arne Gangstad
4d278ca6b4 refactor: regen mocks, use existing VerifyWasCalled(Never()) (#3863) 2023-12-11 21:35:13 -05:00
Marcos Diez
ce95f8ee05 feat: Jobs now shown in a table in the main page (#3784)
* feat: better logging for UpdateStatus

* feat: jobs now shown in a table in the main page

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-12-11 21:34:33 -05:00
Luke Massa
fb484ad8eb feat: Remove flag for disable apply (#3912)
* Add code for disabling apply flag

* Better comment
2023-12-11 20:29:21 -05:00
Luke Massa
242640bbe9 fix: fetch before checking status (#3832)
* fix: fetch before checking status

* Switch to fetch
2023-12-12 00:45:05 +00:00
Ghais Zaher
379efd2d08 fix: clone repository before getting working dir (#3867)
* fix: clone repository before getting working dir

* unrelated change

* move TryLock up

* fix workspace and add e2e tests

* fix description

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-12-11 19:29:21 -05:00
renovate[bot]
d93f85a0c3 fix(deps): update module github.com/google/go-github/v54 to v57 in go.mod (main) (#4032)
* fix(deps): update module github.com/google/go-github/v54 to v57 in go.mod

* fix(deps): go-github v57 in server/events/vcs/testdata/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-12-12 00:21:42 +00:00
Luay-Sol
f79ece8243 feat: Add project depends on functionality (#3292)
* feat: implemented the code for the depends on functionality

Co-authored-by: Vincent <106497818+vincentgna@users.noreply.github.com>
2023-12-11 12:43:34 -08:00
Finn Arne Gangstad
562a15172a set policy_check status to success when no changes (#3780)
Autoplan would set the "policy_check" status to successful if
there were no modified projects in a PR, but "atlantis plan"
would not. Changed "atlantis plan" to behave like autoplan
in this regard.
2023-12-11 19:08:38 +00:00
Gabriel Martinez
56e38b4151 chore(atlantis): fix linter errors (#3690)
* chore(atlantis): fix linter errors

* fix superfluous-else

* revert gitlab check

* ignore stub funcs on azuredevops_client

* remove fetch-depth

* remove fail_on_error

* fix plan_step_runner_test.go

* more lint fixes

---------

Co-authored-by: Dylan Page <dylan.page@autodesk.com>
2023-12-11 19:02:16 +00:00
Andrew Fitzpatrick
0f8db49d2e fix: removing mr.Headpipeline.Source log when mr.HeadPipeline is missing (#3996)
* fix: removing mr.Headpipeline.Source log when mr.HeadPipeline is missing

* fix: remove  mr.HeadPipeline.Source from other log
2023-12-06 20:53:27 -08:00
jskrill
00aae565b2 feat: add autodiscover enabled feature (#3895)
* add flag to allow the user disable the autodiscover

* add global config and doc

* feat: Implement autodiscover.mode

* fix: Minor doc fixes

* fix: Small fixes to docs/indent/tests

* fix: Line length, quoting, function comments

* fix: Add a few more tests and remove newlines

* fix: Always camel case never snake

---------

Co-authored-by: Marcelo Medeiros <m.medeiros@carepay.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-11-29 15:43:53 -08:00
Eng Zer Jun
fd600d3bb1 perf: avoid allocations with (*regexp.Regexp).MatchString (#3881)
We should use `(*regexp.Regexp).MatchString` instead of
`(*regexp.Regexp).Match([]byte(...))` when matching string to avoid
unnecessary `[]byte` conversions and reduce allocations.

Example benchmark:

func BenchmarkMatch(b *testing.B) {
	for i := 0; i < b.N; i++ {
		if match := branchRegex.Match([]byte("main")); !match {
			b.Fail()
		}
	}
}

func BenchmarkMatchString(b *testing.B) {
	for i := 0; i < b.N; i++ {
		if match := branchRegex.MatchString("main"); !match {
			b.Fail()
		}
	}
}

goos: linux
goarch: amd64
pkg: github.com/runatlantis/atlantis/server/core/config
cpu: AMD Ryzen 7 PRO 4750U with Radeon Graphics
BenchmarkMatch-16          	 8269699	       141.4 ns/op	       4 B/op	       1 allocs/op
BenchmarkMatchString-16    	14298446	        95.81 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	github.com/runatlantis/atlantis/server/core/config	2.784s

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-11-15 09:00:00 -08:00
Marcos Diez
57fdc5a641 feat: full window sized terminal (#3781)
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-11-14 23:03:23 -08:00
Henry Muru Paenga
ce2b99223a fix: Check user permissions on autoplan (#3742)
* Check user permissions on autoplan

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-11-14 22:21:11 -08:00
Luke Massa
99035ce7ac Remove deprecated repo whitelist flag (#3922) 2023-11-14 15:41:49 -08:00
Luke Massa
9bc94dee14 feat: remove silence whitelist errors flag (#3923)
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-11-09 14:36:35 -08:00
Simon Heather
1b45fb1ae1 fix: When GitHub/GitLab Auto-Merge Is Used with Atlantis Pre Workflow Hooks, the PR will be Merged Prematurely (#3880)
* Fix Premature Auto-Merge

* Add CommitStatusUpdater to commandRunner
2023-11-03 22:41:16 -04:00
Simon Heather
3056701c6b fix: Update GitLab Pipeline Type Detection to use Head Pipeline Property (#3887)
* Fix GitLab Mulitple Pipelines

* Add logger to tests and fix test ref

* Add retry to GetMergeRequest

* Update retries

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-11-03 22:22:12 -04:00
Luke Massa
8a87d2ef09 fix: Better determine number of expected comments and webhooks in e2e test (#3907)
* fix: Better determine number of expected comments and webhooks in e2e test

* Cleanup
2023-10-31 23:16:34 -07:00
Simon Heather
edc9bd9262 feat: Improve GitHub and GitLab Debug Logging (#3876)
* Improve GitHub and GitLab Debug Logging

* Fix formatting

* Fix g.client.Repositories.Get debug message

* Update gitlab_client_test with logger

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2023-10-20 08:49:57 -07:00