Commit Graph

33 Commits

Author SHA1 Message Date
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
Maxime Brunet
24e8cf7a79 fix(bitbucketcloud)!: Use AccountID as username instead of Nickname (#2034)
* fix(bitbucketcloud)!: Use AccountID as username instead of Nickname

* Update PullRequest.Author as well

* Remove unused Nickname field
2022-03-07 11:57:10 -05:00
Maxime Brunet
f9a41c9bc6 fix(bitbucketcloud): Ensure status key has at most 40 characters (#2037)
* fix(bitbucketcloud): Ensure status key has at most 40 characters

* Use fmt.Sprintf()
2022-03-07 11:19:55 -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
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
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
Chris Alexander
aa1bfc0a27 Add "plan" to continued statement 2020-07-01 10:11:33 -05: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
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
Luke Kysow
91eecbcb68 Add comment for bitbucket merge conflict detection 2019-06-12 12:28:52 +01:00
Luke Kysow
8bcb3726d4 Switch to Bitbucket 2.0 API for mergeable check 2019-06-12 12:21:47 +01:00
Luke Kysow
8f81568e24 Fix require-approval for Bitbucket Cloud.
Bitbucket Cloud changed their APIs to deprecate the username fields.
This broke how we were checking for approvals. Rather than propagate the
UUID field through the PullRequest model, I use the pull request API
response directly while checking approvers.
2019-06-03 14:57:52 +01:00
Luke Kysow
8982a67b78 Run latest goimports 2019-03-30 20:22:49 -05:00
Luke Kysow
308a87316e Merge pull request #502 from runatlantis/bb-cloud-api-deprecation
Use new 'nickname' field for bitbucket cloud
2019-03-01 10:21:02 -05:00
Luke Kysow
09b92cd207 Use new 'nickname' field for bitbucket cloud
Bitbucket is deprecating the username field.
See: https://developer.atlassian.com/cloud/bitbucket/bitbucket-api-changes-gdpr
2019-02-28 10:06:31 -05: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
81693d79b3 Add header to disable bitbucket xsrf
Fixes #465 which is caused by XSRF detection on Bitbucket server and
cloud.
2019-02-11 11:38:44 -06: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
d2abdb569a Provide base branch name in pull request model
This is needed in order to support the ability to check out the repo as
it would appear after the pull request is merged into the base branch.
2019-01-15 13:45:35 -05:00
Brenden Matthews
e001353ae9 Add mergeable requirement.
Introduce new `mergeable` requirement, in similar vein to the `approved`
requirement. Ran `make go-generate` to update mocks accordingly.

This addresses issue #43.
2018-12-11 16:00:04 -05:00
Luke Kysow
b13a85b4f1 Use Bitbucket 2.0 API for comments.
Bitbucket released the 2.0 version for the commenting on pull requests
API:
https://community.atlassian.com/t5/Bitbucket-questions/Re-Bitbucket-Cloud-REST-API-v2-0-Commenting-on-Pull-Re/qaq-p/849427/comment-id/30070#M30070.
Previously, this was only available in version 1.0. Since 1.0 will be
deprecated, it's best to move to the latest version.
2018-12-04 09:58:52 -06:00
Luke Kysow
ff85cbef70 Require approval from someone other than PR author
In Bitbucket cloud, the pull request author can approve their own pull
request. Ignore this approval.

Fixes #201
2018-07-28 06:57:49 -07:00
Luke Kysow
da236e953b Test Bitbucket Server 2018-07-24 20:34:01 +02:00
Luke Kysow
e8c0f7c5bb Add webhook secret checking. 2018-07-24 20:25:20 +02:00
Luke Kysow
a4c48f5d47 Add provisional Bitbucket Server support 2018-07-24 20:23:51 +02:00
Luke Kysow
718619c045 Rename Bitbucket to BitbucketCloud 2018-07-24 20:23:51 +02:00