Commit Graph

34 Commits

Author SHA1 Message Date
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
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
d211036137 Regen mocks and remove unused 2018-12-11 08:31:59 -06:00
Luke Kysow
5f89527049 Return plan output on error.
If terraform plan returns an error, we still want to print the output to
the pull request.
2018-12-07 10:15:42 -06:00
Luke Kysow
70d194830a Fix pre plan output being removed.
Prior to this change, we were formatting the output from terraform plan
inside the markdown_renderer. Part of this formatting is to remove all
output relating to refreshing state. The way we were doing this was to
simply delete all lines before the refreshing completes.

The problem with this approach was that any output from custom steps
that ran before plan would also be deleted. This change moves the
formatting of the plan output inside the plan step. Then the
markdown_renderer deals with the pre-formatted output and doesn't need
to delete anything before it combines all the step outputs into one.
2018-11-30 08:54:20 -06:00
Luke Kysow
2d214b2727 Restrict possible project names.
We should only allow project names (which are specified in an
atlantis.yaml file) that don't need to be url escaped. The one
exceptional character is '/' which we allow because users like to name
their projects to match the directory they're in. We use the same rule
that Terraform uses for workspace names.

I've also changed the characters that are replaced when writing out the
plan filename to only remove invalid filename characters instead of just
allowing alphanumeric. This is the smallest amount of change required to
ensure the filename is valid.
2018-10-30 13:01:48 -05:00
John Lin
b652568798 replace all invalid char in plan filename 2018-10-30 11:43:24 -05:00
Luke Kysow
e98caf3094 Quote args and plan path that may contain spaces.
Bitbucket repo owner names can contain spaces. Need to quote everywhere
these might be used because we're executing with sh -c.
2018-10-01 19:04:48 -05:00
Luke Kysow
e69c36ad55 Add new -var args for tf plan.
Previously we added -var atlantis_repo=runatlantis/atlantis but the '/'
character is not a valid character for the AWS assume role session name.
To fix this, this commit adds -var atlantis_repo_owner=runatlantis and
-var atlantis_repo_name=atlantis (where runatlantis and atlantis would
be the values for the repo the pull request is from ).
2018-10-01 11:35:45 -05:00
Luke Kysow
c56aa9e104 Quote the -out variable in terraform plan.
Fixes #290. In Bitbucket Server, the repo owner name can have spaces.
This causes errors when running terraform plan -out path with spaces so
we need to quote it: terraform plan -out "path with spaces".
2018-09-27 15:40:47 -05:00
Jeremy Olexa
c278bac6be Execute tf with vars that give source of run.
Add new variables to execute TF with:
  -var atlantis_repo=owner/repo
  -var atlantis_pull_num=10

These can be used within TF to set the session_name of the AWS session
that Terraform creates. This allows all API calls to be traced back to a
specific pull request and user.
2018-09-25 12:31:20 -05:00
Luke Kysow
e8c7d819b5 Inputfalse (#277)
Add input=false to init, plan, and apply step runners
2018-09-14 14:47:51 -07:00
Luke Kysow
af419ef3e1 Fix gometalint errors 2018-09-07 10:54:48 -07:00
Luke Kysow
756435e467 Expose repo name, owner, and branch to run step runner for custom steps (#232)
Commits by @mootpt (squashed)
2018-08-20 11:13:27 -10:00
Luke Kysow
13f79f3963 Split init step test into its own. 2018-08-17 13:52:43 -10:00
Jeff Knurek
62f7526db4 INIT: if the init cmd fails providing more info in the logs is helpful 2018-08-17 13:51:32 -10:00
Luke Kysow
3b02a1fc31 Test plan/apply all. 2018-08-09 14:23:44 -10:00
Luke Kysow
78a2bb519e Set PLANFILE environment variable in run step.
Env var is set to where Atlantis expects the planfile to be.
Fixes #168.
2018-07-07 10:04:49 +02:00
Luke Kysow
9b2d037373 Add .gometalint.json config
After update of errcheck, needed to explicitly disable checking fmt
functions.
2018-07-05 13:54:10 +02:00
Luke Kysow
85a775b94b Fix todos. Remove TF_WORKSPACE. 2018-07-02 14:39:39 +02:00
Luke Kysow
f067818aa5 Test project command runner. 2018-07-01 23:48:32 +02:00
Luke Kysow
f01915876d Add env vars to run step 2018-06-29 20:20:55 +02:00
Luke Kysow
3339dcd92b Dir/Path -> RepoRelDir, path (in templates) -> dir 2018-06-29 18:05:47 +02:00
Luke Kysow
6f8401d57b Test BuildAutoplanCommands 2018-06-29 17:21:53 +02:00
Luke Kysow
124a016f08 WIP 2018-06-21 18:27:03 +01:00
Luke Kysow
d3ec832eff WIP 2018-06-21 18:18:54 +01:00
Luke Kysow
45d80fc695 Fix gometalint errors. 2018-06-19 20:59:25 +01:00
Luke Kysow
6b507eb721 Add -p flag. 2018-06-19 20:51:59 +01:00
Luke Kysow
8ab4857f77 Fix all tests 2018-06-15 16:16:31 +01:00
Luke Kysow
b5e2a730de WIP Add operators and get compiled. 2018-06-15 14:03:27 +01:00
Luke Kysow
3525ab3bd9 WIP 2018-06-12 14:54:38 +01:00
Luke Kysow
9839e0dac1 Move execution planner. Don't plan in deleted dirs 2018-06-11 18:00:57 +01:00
Luke Kysow
437b62591a Test execution_planner 2018-06-08 20:58:29 +01:00
Luke Kysow
d6883e83e4 Move runtime elements to the runtime package 2018-06-08 16:36:04 +01:00