Commit Graph

70 Commits

Author SHA1 Message Date
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
Sebastian Poxhofer
01a9a5f5a7 feat: dismiss approvals when planning (#2696)
* feat: dismiss approvals when planning

* feat: add pagination and move query in separate method

* tests: add test for dismissing

* refactor: fix linting issue

* implement change requests

* Update cmd/server.go

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
2022-12-18 22:31:10 -06:00
nitrocode
629e688b0c Allow --gh-team-allowlist to work with team names and slugs (#2719)
* Add team slugs

* Expand test to include both names and slugs

* docs: add version document of flag before/after

* docs: this will be merged for next release
2022-11-25 12:47:49 -06:00
Stas Ostrovskyi
b8297bb1f8 fix: Set mergeable correctly when branch protection doesn't require reviewers (#2470)
* Allow no required reviewers

* Fix comment in tests

Co-authored-by: Stas Ostrovskyi <stasostrovskyi@users.noreply.github.com>
2022-09-08 13:54:50 -07:00
Yurii Soldak
9f31e49be8 Use single github v4 client (#2480) 2022-09-08 06:04:35 -07:00
Yurii Soldak
a4a49bf46f Use proper http client for github v4 api (#2479)
* Use proper http client for github v4 api

* Remove extra print lines

Co-authored-by: Ray Terrill <rayterrill@users.noreply.github.com>
2022-09-07 16:51:23 -07:00
Ray Terrill
89d33a0737 Make required atlantis/apply status check work with mergeable (#2436)
* Make required apply work with mergeable

* Fix lint hint

* Migrate mergeable approval check to graphql, update tests

* Adding support for check suites

* Adding feature flag protection for new functionality

* Fix linting falsepos

* Adjusted logic to handle required check runs, added doc
2022-08-18 09:46:50 -07:00
Rémi Lapeyre
b409cb8470 Add the /plan and /apply endpoints (#997)
* Add the /plan and /apply endpoints

* Resolve conflicts

* Fix wrong merge

* Add missing methods for mocks

* Fix linting error

* Fix linting error

* Move api plan/apply into APIController

* Extract commond code into helper functions

* Implement GetCloneURL for GitHub

Co-authored-by: Li Lin <li.lin@hashicorp.com>
2022-07-27 11:36:49 -07:00
Li Lin
e153cea2bf Revert "[fix] Ignore commit checks for atlantis apply on Github (#2311)" (#2388)
* Revert "[fix] Ignore commit checks for atlantis apply on Github (#2311)"

This reverts commit a3db712920.
2022-07-13 17:11:03 -07:00
Michel Z. Santello
df0d58d29b fix: vcs-status-name hardcoded in PullIsMergeable function (#2312)
* feat: add userConfig.VCSStatusName to applyCommandRunner context

* fix: use vcsstatusname from context

* chore: normalize tests

* chore: update interface mock
2022-06-16 09:26:20 -07:00
Chico Venancio
a3db712920 [fix] Ignore commit checks for atlantis apply on Github (#2311)
* [fix] Ignore commit checks for atlantis apply on Github

* Fix typo

* Fmt

* lint
2022-06-13 09:40:05 -07:00
PePe Amengual
7199ea4a7e fix: reverting change to command status logic (#2173) 2022-03-31 11:51:49 -04:00
Raymond Chen
4e4568501d fix: fix unmarshall error in graphql call (#2128)
* Fix unmarshall error in GraphQL call #2090

* Add unit tests for GetTeamNamesForUser

* Fix lint error
2022-03-09 14:37:58 -08:00
Andre Ziviani
1a7cc360a9 feat: add a pending status for apply when running plan command (#2053)
* add a pending status for apply when running plan command

* fix status updater logic, we should only update the status after we check if the PR is mergeable like the doc next to it says

* do not dismiss the PR if the only our "atlantis/apply" status is pending/failing

* fix logic and tests

* linting
2022-03-04 14:49:54 -05:00
Raymond Chen
136b23ac11 fix: get user teams with GitHub GraphQL API (#2045) 2022-02-04 19:47:30 -05:00
Sarvar Muminov
7a927c050b Moving config files to core/config (#2036)
* Moving config files to core/config

* fix package names

* fix package dependencies

* linting fixes

* more linting fixes

* ran golangci-lint run --fix
2022-02-03 11:06:04 -08:00
Iain Lane
e3f0dd5553 Retry /files/ requests to github (#2002)
Similar to #1131, we see this for /files/ too, resulting in a plan
error.

Closes #1905
2022-01-25 09:49:11 -05:00
Nish Krishnan
64612019f4 Revert "feat: filter out atlantis/apply from mergeability clause (#18… (#1968)
* Revert "feat: filter out atlantis/apply from mergeability clause (#1856)"

This reverts commit d01796b9d9.

* Add missing import.
2022-01-01 15:11:39 -05:00
Paul Erickson
bc368465a0 feat: add GitHub team allowlist configuration option (#1694)
* Add GitHub team allowlist configuration option

Co-authored-by: PePe (Jose) Amengual <jamengual@sonatype.com>
Co-authored-by: Troy Neeriemer <tneeriemer@sonatype.com>
Co-authored-by: Ted Roby <troby+github@sonatype.com>
Co-authored-by: Paul Erickson <perickson@sonatype.com>

* Check team allowlist in command runner, rather than event controller

* Remove unneeded trimming

* Test wildcard groups and commands

* Improve error logging

Co-authored-by: PePe (Jose) Amengual <jamengual@sonatype.com>
Co-authored-by: Troy Neeriemer <tneeriemer@sonatype.com>
Co-authored-by: Ted Roby <troby+github@sonatype.com>
2021-12-21 16:08:43 -08:00
Nish Krishnan
d01796b9d9 feat: filter out atlantis/apply from mergeability clause (#1856)
Filter out atlantis apply status during mergeability check.
2021-10-19 13:51:22 -07:00
Nicholas (Nick) Meyer
875e2adc40 Improve github pull request call retries (#1810)
* Improve github pull request call retries

Retry with fixed 1 second backoff up to 3 retries was added by #1131 to
address #1019, but the issue continued to show up (#1453).

Increase max attempts to 5 and use exponential backoff for a maximum
total retry time of (2^n - n - 1) seconds, which is roughly 30 seconds
for current max attempts n = 5.

Also move the sleep to the top of the loop so that we never sleep
without sending the request again on the last iteration.

* Fix style with gofmt -s
2021-10-04 09:59:53 -07:00
Aayush Gupta
bb2c239dd9 Updating client interface and adding ApprovalStatus model (#1827) 2021-09-22 12:41:05 -07:00
Gábor Lipták
a4f0e3a467 Bump golangci to 1.39.0 (#1541)
Signed-off-by: Gábor Lipták <gliptak@gmail.com>
2021-05-26 21:00:20 -04:00
Nish Krishnan
79309ed39c [ORCA-559] Fix hide previous command logic (#37) (#1549) 2021-05-03 12:47:23 -07:00
Istvan Tapaszto
632460b20b Delete source branch on merge (#1357)
Co-authored-by: Tapaszto, Istvan <istvan.tapaszto@msciintegration.onmicrosoft.com>
2021-04-22 09:54:18 -07:00
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
Gábor Lipták
832afeaec1 Correct typo (#1424) 2021-02-23 17:04:35 -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
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
67b2217245 Retry get pull request calls to github
These calls have been 404'ing lately, likely due to eventual consistency
issues on GitHub's side where they send the PR created webhook but it's
not yet available on their API.

To work around this, we will retry up to 3 times with a 1s delay.
2020-07-25 23:46:41 -07:00
Chris Alexander
4568213356 Reversed if statement for comment splitting 2020-07-10 18:13:05 -05:00
Mark Keisler
caf3319b7d Bring back the change from
2f074727e2 (diff-e348084f0b7562996b0bd5d429158e53)
that was clobbered.
2020-07-09 11:21:00 -05:00
Chris Alexander
aa1bfc0a27 Add "plan" to continued statement 2020-07-01 10:11:33 -05:00
Luke Kysow
875abf1362 Refactoring to github app code
- rename gh-app-key to gh-app-key-file for clarity
- change git credentials writer to append a line if there is an existing
.git-credentials file and in the case of the github app to replace the
old github app line
- removed automatically setting --write-git-creds to true when using a
github app and instead requiring this is set specifically
2020-06-19 11:41:44 -07:00
rob
011d3f8229 Test against a live repo, fix accordingly
more docs, add installation step
2020-06-03 20:25:11 -04:00
rob
227ce9cbf4 Upgrade to github/v31 for CompleteAppManifest
split fixtures out elsewhere, add working dir test
2020-06-03 20:18:13 -04:00
Roberto Hidalgo
199cdfe192 Play around with github app credentials 2020-06-03 20:16:24 -04:00
Sam Park
2f074727e2 Fix GraphQL URL for Github Enterprise
Partially addresses #1009, but doesn't fix it entirely. The 406 response
is still a puzzler.
2020-06-03 11:34:44 -07:00
Christopher Ketchum
88e397ed6d vcs/github_client: add logging around github API calls (#1042) 2020-06-01 16:42:03 -07:00
Luke Kysow
3eaa67e1ef Update go-github, empty automerge commit
Using an empty auto-merge commit will cause GitHub to autogenerate its
own commit message like would happen when using the UI.
2020-05-25 12:07:52 -07:00
David McPike
bc069d4b0c Add MarkdownPullLink function to VCS clients 2020-04-21 09:19:55 -05:00
Luke Kysow
6e8b4eed16 Small refactor 2020-04-15 21:44:34 -07:00
Sam Park
dcd43bead1 Add pagination 2020-01-24 21:51:01 -08:00
Sam Park
fd93af8a55 Fix body string check 2020-01-24 21:51:01 -08:00
Sam Park
610c9b2c37 Add hide old comments VCS interface function
And implement the Github version.

The Golang Github client recommends using shurcooL/githubv4.
2020-01-24 21:51:01 -08:00
Luke Kysow
4e8d19be0a Convert AZDO paths to relative
Previously the AZDO paths returned by GetModifiedFiles were absolute.
Now they're relative to the repo root to match the rest of the VCS's.
2020-01-02 09:45:38 -06:00
Dave D'Amico
b025a9037a Fix for Issue 727 (#762)
* initial commit for testing

* testing update

* go fmt
2019-09-03 13:00:17 -04:00
Luke Kysow
b81fe9a5e5 Switch to gomod 2019-08-26 18:38:22 +02:00
Luke Kysow
db1203bf0f Add better support for remote plan/apply.
Features:
- remote plans and applies will set a commit status with a link to the
Terraform Enterpise UI where the streaming output can be viewed.
- because remote plans don't support the -out flag, we diff the plan
output between plan and apply phases to ensure users are applying the
plan they expected

How:
We add a new capability to execute a terraform command while
concurrently reading its real-time output and performing actions
accordingly.
2019-02-27 17:26:00 -05:00