Commit Graph

382 Commits

Author SHA1 Message Date
Luke Kysow
d0e0b0dfca Log rev-parse error at warn level.
We recover gracefully from this so it's not an error.
2019-03-07 09:57:29 -05:00
Luke Kysow
36925b4dc8 Ignore .terragrunt-cache dirs.
Fixes #487
2019-03-06 11:20:44 -05:00
Luke Kysow
4c887f18cf Merge pull request #514 from runatlantis/split-status-checks
Split status checks
2019-03-06 10:15:56 -05:00
Luke Kysow
30577a4c4d Support dirs with spaces.
Allow running atlantis plan -d "dir with spaces" to target a directory
that contains spaces.

Fixes #423
2019-03-05 16:16:16 -05:00
Luke Kysow
936a5f4a16 Remove mention of TERRAFORM_WORKSPACE env var 2019-03-05 15:57:43 -05:00
Luke Kysow
4fc22aedeb Split status checks into plan and apply.
Split single top-level status check into one plan and one apply check.
These checks will also now track the whole pull request status rather
than just the last action.
2019-03-05 14:29:43 -05:00
Luke Kysow
65c8f1317a Give warning for common error missing 'run' key 2019-03-05 13:32:08 -05:00
Luke Kysow
f98fe8ef80 Add new status to ProjectPlanStatus 2019-03-05 12:08:11 -05:00
Luke Kysow
393af51e4f Add Command field to ProjectResult 2019-03-05 12:01:06 -05:00
Luke Kysow
a13bce59ad updateDB should not return a pointer 2019-03-05 11:54:04 -05:00
Luke Kysow
c97c922f91 Merge pull request #510 from runatlantis/bb-server-delete-event
Support bitbucket server pr:deleted event
2019-03-01 11:49:13 -05:00
Luke Kysow
2fb8f4d4ff Support bitbucket server pr:deleted event
If a pull request is deleted, Atlantis should delete the locks.
Fixes #498
2019-03-01 11:36:22 -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
e9bee6e95b Merge pull request #509 from runatlantis/bb-server-basepath
Support basepath for bitbucket server
2019-03-01 09:17:13 -05:00
Luke Kysow
0a8e3e86c9 Support basepath for bitbucket server
Previously we were stripping the basepath from the passed in URL. i.e.
if I passed in --bitbucket-base-url=https://me.com/basepath then we
would just strip off /basepath.

This change fixes that bug (#508).
2019-03-01 09:14:52 -05:00
Luke Kysow
899c77f19c Fix async tests. 2019-02-28 16:52:26 -05:00
Luke Kysow
ca5ca0b218 Skip all async tests (for now). 2019-02-28 15:32:31 -05:00
Luke Kysow
6721eea4f1 Skip broken tests for now. 2019-02-28 15:23:08 -05:00
Luke Kysow
9e497f495e Merge pull request #503 from runatlantis/tfe-apply-check
Add better support for remote plan/apply
2019-02-28 13:05:28 -05:00
Luke Kysow
8cef308709 Add test for large outputs. 2019-02-28 12:26:46 -05:00
Luke Kysow
7f5a0fcd10 Fix test race conditions. 2019-02-28 11:49:48 -05:00
Luke Kysow
b10cf1faa7 Test remote plan/apply. 2019-02-28 11:00:56 -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
5f4a94b0af Move CommandName to models package 2019-02-26 12:03:25 -05:00
Andrew Urwin
20060e1de1 update test to include -upgrade 2019-02-26 16:03:59 +00:00
Andrew Urwin
aec79b95e1 adding -upgrade to init cmd 2019-02-26 15:53:54 +00: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
1997e112d3 Remove duplicate vcs proxy interface
This is the same interface as vcs.Client so no need to have both.
2019-02-25 16:51:26 -05:00
Luke Kysow
5e9464b820 Merge pull request #488 from runatlantis/tfe-remote-ops
Detect if using TFE remote plan/apply backend
2019-02-25 11:12:58 -05:00
Kip McEntire
901a9f6a44 Add user_name environment variable
Add USER_NAME environment variable to the documenation
2019-02-22 16:50:36 +00:00
Luke Kysow
f030fdd609 Detect if using TFE remote plan/apply backend
If so, don't run plan with -out because this isn't currently supported.
Instead, write a planfile afterwards with the text contents of the plan.

During apply, detect that the planfile was generated using a remote plan
and run apply with -auto-approve and without the planfile arg which
isn't supported.
2019-02-21 12:10:46 -05:00
Luke Kysow
bebbcb8a4d Fix automerge bug in Bitbucket Server
BB Server requires we send a 'version' parameter along with our call to
/merge.
2019-02-19 17:30:28 -05:00
Pierre Hanselmann
dd6c3241b9 Set specific check on diagnostics:ping bitbucket event 2019-02-15 13:58:32 +01:00
Luke Kysow
f4e1472aef Merge pull request #469 from runatlantis/mergeability
Get mergeable status *before* changing build status
2019-02-11 14:49:40 -06:00
Luke Kysow
4e429581b0 Refactor changes to get mergeability early 2019-02-11 14:46:18 -06: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
45a6823eb2 Merge pull request #466 from runatlantis/gh-automerge
GitHub Automerge Types
2019-02-11 11:22:49 -06:00
Luke Kysow
def41f6cef Add tests for GH merge-type detection. 2019-02-11 11:12:15 -06:00
Luke Kysow
44f0094b75 Fix issues with terraform execution.
Previously I wrote a bunch of code to deal with terraform panicking.
This code used a pipe as the stdout/err buffer and there was a bug
because I wasn't reading off the pipe and it would get full.

While testing a fix, I realized when Terraform panics, the previous code
using CombinedOutput() just worked. As a result, I'm switching back to
that code.
2019-02-11 10:20:55 -06:00
Pratik Mallya
09782c4b6d Allow "Mergeable" apply requirement to work
Get the Mergeable status of the PR before updating the
Status. This allows for the Status to be a required
Status for merging the PR. This allows us to use the
atlantis status as a Required status, which is the
configuration often used, since most deployments
want to ensure tf plans have all been successfully
applied before merging

Issue: https://github.com/runatlantis/atlantis/issues/453
2019-02-09 03:26:26 -08: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
70235d8e8f Update to latest linters. Fix errors. 2019-01-22 13:29:42 -05:00
Luke Kysow
a9d5feac84 Merge pull request #427 from runatlantis/checkout-strategy
Add new --checkout-strategy flag
2019-01-17 10:09:51 -05:00
Luke Kysow
16a4946bea Test new checkout logic. 2019-01-16 18:32:02 -05:00
Luke Kysow
054d3bc5f6 Fix skipped test 2019-01-16 12:13:37 -05:00
Luke Kysow
501db6b66e Fix gometalinter errors
Also disable test linters since we already run tests.
2019-01-15 15:45:01 -05:00
Luke Kysow
8b77b95a16 Add checkout-strategy flag.
This flag can be set to either branch (default) or merge. If set to
branch, we will check out the head branch of the pull request (the
source). If set to merge, we will check out the base branch of the pull
request (the destination) and then attempt to perform a git merge of the
pull request branch. This simulates what will happen if the pull request
is merged.

This allows us to perform terraform commands on what the state of the
repo will be *after* the pull request is merged. This is useful if users
are often opening up pull requests from branches that aren't up to date
with master. With the branch strategy, the terraform plan might be
deleting resources that have been created in the master branch but with
the merge strategy, we merge the branch's changes into the master branch
and so don't have this problem.
2019-01-15 15:45:01 -05: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