-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
- 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.
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
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.
- 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.
Introduce new `mergeable` requirement, in similar vein to the `approved`
requirement. Ran `make go-generate` to update mocks accordingly.
This addresses issue #43.
If projects are configured using an atlantis.yaml with a specific
project name, include that in the output for comments. This is useful
because often the project names are better identifiers than the
directory and workspace names and also because some projects use the
same dir and workspace so the only way to differentiate them is via
their names.
Fixes#353
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.
On startup, make a call to the /version endpoint of Gitlab to get which
version we're running. Then use that version to determine whether we
should use the markdown folding syntax where the code is expandable.
Versions of Gitlab < 11.1 don't support the "Common Mark" markdown
format.
Fixes https://github.com/runatlantis/atlantis/issues/315
Adds close and (re)open <details> tag in between the split portions to
ensure the markup is correct across multiple comments. This isn't the prettiest, but a close result, under the assumption continued-comments are in 99% within a terraform output anyway...
When running terraform plan, Terraform writes a line for each resource
it updates. For example:
null_resource.b: Refreshing state... (ID: 700288721293508840)
null_resource.a: Refreshing state... (ID: 2853194762920164292)
null_resource.f: Refreshing state... (ID: 6634469389761751950)
This change removes those lines by splitting the output string after a
separator.
This change is being made because the Refreshing output isn't important
and it will make the comments shorter.
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.
- some of the tests run git so if you're using gpg signing you need
to disable that.
- refactor test helpers to use tb.Helper() and make the error output red.
This is useful because if another helper uses one of these helpers,
when it calls .Helper() its output will also be up the stack.
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 ).
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".
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.
* If output is longer than 12 lines, wrap it in markdown folding for
GitLab and GitHub.
* Reformat the Terraform plan output so that the + and - lines show up
highlighted properly when using the diff syntax highlighting
GitLab allows repos to be nested under multiple subgroups,
for example owner/group/subgroup/subsubgroup/repo vs. owner/repo. This
change enables that functionality.