Commit Graph

2135 Commits

Author SHA1 Message Date
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
Luke Kysow
164c6c222d Merge pull request #422 from runatlantis/plan-step-document
Document need to manually select workspace
2019-01-11 13:18:43 -05:00
Luke Kysow
3c975f37f1 Document need to manually select workspace
If users are overriding the default plan command then they need to
select the workspace themselves.

Fixes #405
2019-01-11 13:09:06 -05:00
Luke Kysow
173fdde739 Merge pull request #421 from runatlantis/handle-panics
Fix bug where Atlantis hangs on terraform crash.
2019-01-10 19:52:29 -05:00
Luke Kysow
1d7bb42955 Fix tests 2019-01-10 19:46:29 -05:00
Luke Kysow
3f1a5596c1 Vendor go-linereader 2019-01-10 17:42:30 -05:00
Luke Kysow
b1e32643f5 Fix bug where Atlantis hangs on terraform crash.
Because of some weirdness with how terraform executes (it forks itself
and assigns the parent's stderr and stdout file descriptors to the
child) when terraform panics, Go's exec.CombinedOutput() blocks
indefinitely even though the terraform process has exited.

To handle this, we switch to using os.Pipe for the cmd's stderr/out
which for some reason allows Go to know when the process has exited.
Unfortunately, this brings up a new problem when reading the output from
that pipe. For some reason, after a terraform crash, we never get an EOF
on the pipe and so as we again get in a situation where we're blocking
indefinitely. To handle this, I've added an edge case where we look at
the log lines and if its the end of a terraform panic, we break out of
the loop.

Thanks Terraform 0.12-alpha for discovering this bug!
2019-01-10 17:42:30 -05:00
Luke Kysow
acf46ba89d Merge pull request #419 from runatlantis/tfe-token
Add optional tfe-token flag. Get working with 0.12.
2019-01-10 17:26:20 -05:00
Luke Kysow
e0dcb5ab13 Don't add extra -var flags when using TF >= 0.12
In Terraform 0.12 and above, you aren't allowed to set -var foo=bar
flags unless the foo variable is actually defined in code. Previously,
we were setting the following variables:
- atlantis_user
- atlantis_repo
- atlantis_repo_owner
- atlantis_repo_name
- atlantis_pull_num

Users could then use these variables if they wanted to, in their code.
The main use case was to name the assume role session in AWS:

provider "aws" {
  assume_role {
    role_arn     = "arn:aws:iam::ACCOUNT_ID:role/ROLE_NAME"
    session_name = "${var.atlantis_user}-${var.atlantis_repo_owner}-${var.atlantis_repo_name}-${var.atlantis_pull_num}"
  }
}

This is longer possible in 0.12.
2019-01-10 15:16:21 -05:00
Luke Kysow
fb86e89df0 Add new --tfe-token flag for TFE backend.
The new flag takes in a Terraform Enterprise API token and attempts to
write a config file for that token to ~/.terraformrc on startup.
If the file already exists and its contents would change as a result of
us writing it, we error out.
This flag is useful if you're using the TFE backend for any of your
projects as that requires a .terraformrc file with a token for
authentication.
2019-01-09 15:11:01 -05:00
Luke Kysow
7caa043fe6 Organize fields alphabetically 2019-01-09 14:49:56 -05:00
Luke Kysow
6d2fd4314d Merge pull request #417 from runatlantis/tfe-state-docs
Add docs about using tfe remote state.
2019-01-09 09:51:01 -05:00
Luke Kysow
255a5b7fc1 Add docs about using tfe remote state. 2019-01-08 16:00:49 -05:00
Luke Kysow
89516f0378 Merge pull request #415 from runatlantis/moved-files
Include src of moved files in list of modified files
2019-01-07 16:49:54 -05:00
Luke Kysow
cc03368e60 Merge pull request #411 from runatlantis/docs-reorg
Reorganize docs.
2019-01-07 16:39:15 -05: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
37e2ab85a8 Reorganize docs.
Also add a build step that checks the Netlify deploy preview for broken
links.
2019-01-07 16:10:21 -05:00
Kent Bredeson
aaf075b281 Add old path of moved file to list of modified files 2019-01-07 14:12:28 -06:00
Luke Kysow
5d072683e5 Merge pull request #409 from runatlantis/version-parser
Fix version detection so it works with tf 0.12alpha
2019-01-04 09:29:43 -05:00
Luke Kysow
3bb7c8d52f Fix version detection so it works with tf 0.12alph 2019-01-04 09:26:06 -05:00
Luke Kysow
8b395df20c Merge pull request #408 from Phylu/patch-1
docs: Add information about background commands
2018-12-20 21:40:12 -06:00
Janosch Maier
49a1b638c6 docs: Add information about background commands 2018-12-21 01:13:48 +01:00
Luke Kysow
41059d71f1 Merge pull request #407 from runatlantis/bump-test-image-tf-version
Document how to update the testing image.
v0.4.13
2018-12-20 13:26:03 -06:00
Luke Kysow
1df4be945c Document how to update the testing image. 2018-12-20 13:18:02 -06:00
Luke Kysow
f338209376 Merge pull request #406 from runatlantis/release-0.4.13
Release v0.4.13
2018-12-20 13:14:22 -06:00
Luke Kysow
9f3a7f2a08 Release v0.4.13 2018-12-20 13:11:37 -06:00
Luke Kysow
4c665b75c4 Merge pull request #403 from runatlantis/warn-target
Warn if using -target flag with apply.
2018-12-19 14:32:08 -06:00
Luke Kysow
a6ca764e87 Merge pull request #402 from runatlantis/logging-tweaks
Tweak logging. Add timezone, use everywhere.
2018-12-19 14:26:55 -06:00
Luke Kysow
d6917e49dc Merge pull request #396 from runatlantis/workspace-configured
If dir has workspaces configured only allow those
2018-12-19 14:26:35 -06:00
Luke Kysow
58493f3402 Warn if using -target flag with apply.
-target doesn't work with terraform apply when the apply is being run on
a planfile (which is how Atlantis runs plan). We should give the user an
error if they attempt this.

Fixes #399
2018-12-19 14:25:46 -06:00
Luke Kysow
0691f9f214 Merge pull request #400 from instacart/upgrade-tf-0-11-11
Bump Terraform version to 0.11.11
2018-12-19 13:44:34 -06:00
Luke Kysow
c4f89958d3 Tweak logging. Add timezone, use everywhere.
- Use logger for all warnings. Previously we were writing warnings from
cmd/server.go directly to stderr which bypassed our normal log format.
- Add the timezone to log output. This is just really nice to have if
you're looking at old logs.
- Change levels to all be 4 characters: DBUG, INFO, WARN, EROR. This
makes the logs easier to read because it lines up.
- Log when we first receive the request as well as when we send a
response. This makes it easier to see where the request starts and ends.
2018-12-19 13:40:13 -06:00
Luke Kysow
2b4f3f33bd Merge pull request #401 from runatlantis/comment-on-failure
Write error comment on early failures.
2018-12-19 13:30:11 -06:00
Luke Kysow
68ac049ad6 Write error comment on early failures.
Previously, we were just logging when an error happened early in our
comment processing code. However it's possible for us to write comments
on error even at this early stage which will make for a better user
experience.

Fixes #398
2018-12-19 13:26:27 -06:00
Ninir
1b1ae67bb4 Bump Terraform version to 0.11.11 2018-12-19 10:11:35 -08:00
Luke Kysow
84289ea004 Merge pull request #397 from jkodroff/remove-helm-chart
Remove helm chart.
2018-12-19 10:30:54 -06:00
Luke Kysow
a018bda4ab If dir has workspaces configured only allow those
If users have created an atlantis.yaml config for a specific directory,
only allow commands for workspaces that have been configured in that
directory. This will help prevent errors when users mis-type a workspace
name.
2018-12-18 07:25:33 -06:00
Josh Kodroff
546127a836 Remove helm chart.
There's now an official chart in the Helm repository: https://github.com/helm/charts/tree/master/stable/atlantis
2018-12-17 17:03:05 -05:00
Ivan
1d34ca8cde Added download link (#387)
There's no download link, added the one from getting-started.md
Authored-By: ivankisic <ivan.kisic@gmail.com>
2018-12-17 09:19:46 -06:00
Luke Kysow
0054198b1b Merge pull request #392 from runatlantis/better-gitlab-warnings
Don't parse gitlab comment events when on commit
2018-12-14 12:47:54 -06:00
Luke Kysow
52714485a9 Don't exit script before we can print test failure 2018-12-14 12:18:26 -06:00
Luke Kysow
985c30c097 Don't parse gitlab comment events when on commit
Detect if the GitLab event is a comment on a commit instead of a merge
request and log a debug message that we don't support this.

Previously, Atlantis would panic if it received this event.
2018-12-14 12:04:19 -06:00
Luke Kysow
858dbe4ed1 Merge pull request #388 from runatlantis/mergeable-pr
Introduce new `mergeable` requirement
2018-12-12 14:33:09 -06:00
Luke Kysow
b6d821326d Update docs about mergeability 2018-12-12 14:26:46 -06:00
Luke Kysow
40d427c898 Check GitLab required approvers for mergeability 2018-12-12 12:41:33 -06:00
Luke Kysow
3c1e1ab6e3 Update gitlab lib. Fix breakages. 2018-12-12 12:41:33 -06: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
139f05ab49 Update go-github library 2018-12-12 09:55:17 -06: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
27eb577215 Merge pull request #386 from runatlantis/mocks
Update pegomock, regen mocks.
2018-12-11 08:35:59 -06:00