Commit Graph

50 Commits

Author SHA1 Message Date
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
nitrocode
d85662cdf1 Rename default branch to main (#2662)
* Rename default branch to main

* Bump git, curl, and openssl packages
2022-11-14 11:28:29 -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
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
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
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
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
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
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
Eng Zer Jun
38cf7b0141 refactor: move from io/ioutil to io and os package (#1843)
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-10-07 00:37:42 -04:00
Aayush Gupta
bb2c239dd9 Updating client interface and adding ApprovalStatus model (#1827) 2021-09-22 12:41:05 -07: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
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
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
80347f4c1d Merge remote-tracking branch 'origin/master' into hide-comments 2020-04-15 21:47:58 -07:00
Luke Kysow
6e8b4eed16 Small refactor 2020-04-15 21:44:34 -07:00
Luke Kysow
82afe0b061 Fix lint issues 2020-04-13 10:04:37 -07:00
Sam Park
6a4236b24d Fix lints 2020-01-24 22:59:39 -08: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
815e91be36 Add tests 2020-01-24 21:51:01 -08: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
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
Luke Kysow
b749a32c5f Allow setting 'source' for commit statuses
This is needed so we can set different commit statuses for plan and
apply phases.

Also, append os env variables to git commands during cloning. This fixed
a bug when running tests where I got an error because git couldn't expand
'~' from its git config to my home directory because the HOME env var
wasn't set.
2019-02-25 17:10:20 -05:00
Luke Kysow
def41f6cef Add tests for GH merge-type detection. 2019-02-11 11:12:15 -06:00
Brenden Matthews
862b5228d0 [automerge] Use available merge methods.
For repos with certain merge methods disabled (such as 'merge'), simply
hitting the GitHub `/merge` endpoint is not sufficient. Instead, we need
to check which methods are actually available, then use the appropriate
method.

With this change it will:

 1. Default to 'merge' if enabled
 2. Use 'rebase' if 'merge' is disabled and rebase is enabled
 3. Use 'squash' if 'merge' is disabled
2019-02-07 16:18:28 -05:00
Luke Kysow
74e9bbb82b Add automerge feature.
Automerging merges pull requests automatically if all plans have been
successfully applied.

* Save status of PR's to BoltDB so after each apply, we can check if
there are pending plans.
* Add new feature where we delete successful plans *unless* all plans
have succeeded *if* automerge is enabled. This was requested by users
because when automerge is enabled, they want to enforce that a pull
request's changes have been fully applied. They asked that plans not be
allowed to be applied "piecemeal" and instead, all plans must be
generated successfully prior to allowing any plans to be applied.
2019-02-06 16:27:43 -06:00
Luke Kysow
3d8138d3fa Include moved files in GetModifiedFiles
Implement the change from the previous commit for GitLab and Bitbucket
Server/Cloud. Test the change for GitHub.

If a file is moved, we want to run plan in the directory it is moved to
*and* the directory it was moved from.
2019-01-07 16:36:09 -05:00
Luke Kysow
e93384fdb0 Use mergeable_state to determine if mergeable
- Need to use the mergeable_state field in GitHub to know if a pull
request is mergeable.
- Add tests.
- Since we updated our vendored go-github library, fix how we were
creating webhooks in testdrive.
2018-12-12 11:17:09 -06:00
Luke Kysow
bd8335f82f Rename CommitStatus enums 2018-07-20 12:43:48 +02:00
Luke Kysow
1fc4667c63 WIP bitbucket 2018-07-19 21:52:33 +02:00
Luke Kysow
6d8766403b Test GitHub client. 2018-07-01 22:12:50 +02:00