Commit Graph

758 Commits

Author SHA1 Message Date
Justin Roberson
6dda3dfde1 fix: fallback to default TF version in apply step (#1931)
The plan step has a mechanism to use the default tf version from the Terraform
client if the context does not define one, however the apply step does not have
this. This results in remote executions of apply failing with a nil pointer
dereference when it checks tfVersion in StripRefreshingFromPlanOutput. This fix
involves copying what the PlanStepRunner does and falls back to the default
version if the context's version is nil.
2021-12-22 14:54:14 -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
Nish Krishnan
33b4d6325a refactor: Add PullStatusFetcher interface (#1904) 2021-11-18 11:42:36 -08:00
Bruno Ferreira
79af92458a feat: adds allowed_regexp_prefixes parameter to use with the --enable-regexp-cmd flag (#1884)
* adds AllowedRegexpPrefixes config and use it on the FindProjectsByName method

* adds tests for the new AllowedRegexpPrefixes config

* update documentation with the new AllowedRegexpPrefixes config
2021-11-17 17:25:48 -05:00
Alexander Dupuy
dc4cc2f614 docs: document approve_policies command in comment_parser (#1886)
* docs: document approve_policies command in help

The `approve_policies` command was added with policy checking but was
never included in the command parser help.

Also update the comments in the file to reflect all of the commands.

* feat: Better message on policy failure

Include the specific command `approve_policies` in the message.
2021-11-17 17:25:29 -05:00
Kevin Wendt
f5b6ab09ec fix: allow requests to /healthz without authentication (#1896)
* fix: allow requests to /healthz without authentication

* allow unauthed requests to /status
2021-11-14 20:02:44 -05:00
Nish Krishnan
a8bfd77452 Move runtime common under existing runtime package. (#1875) 2021-11-01 11:32:52 -07:00
Mihail Kuzmich
8c9184b80a feat: add new bitbucket server webhook event type pr:from_ref_updated (#1866) 2021-10-28 11:50:05 -07:00
Daniel Grimes
4248e2ebf4 fix(azure): allow correct path to be derived for on premise installation (#1863)
* add .devcontainer to .gitignore

* allow AzureDevOps host to be specified in the user_config

* fix spacing issues

* gofmt

* fixes to cmd and update to approach

* add specific self host fixtures

* add specific self host parser tests

* update code to azure self hosted devops

* go fmt

Co-authored-by: atlantisbot <lkysow+atlantis@gmail.com>
2021-10-26 10:34:47 -07:00
FBLGit
cbf35ca0ed feat: add BasicAuth Support to Atlantis ServeHTTP (#1777)
* Add BasicAuth Support to Atlantis ServeHTTP

* Added Security notes

Co-authored-by: xmurias <xmurias@gmail.com>
2021-10-21 14:58:30 -07:00
Nish Krishnan
d01796b9d9 feat: filter out atlantis/apply from mergeability clause (#1856)
Filter out atlantis apply status during mergeability check.
2021-10-19 13:51:22 -07:00
Daniel Grimes
571f91fbda fix(azure): allow host to be specified in user_config for on premise installation (#1860)
* add .devcontainer to .gitignore

* allow AzureDevOps host to be specified in the user_config

* fix spacing issues

* gofmt

* fixes to cmd and update to approach

Co-authored-by: atlantisbot <lkysow+atlantis@gmail.com>
2021-10-17 14:07:14 -04:00
Bea Hughes
070f5174e7 chore: use golang-jwt/jwt to replace dgrijalva/jwt-go (#1845)
* Migrate dgrijalva/jwt-go to golang-jwt/jwt/v4

dgrijalva's jwt is no longer maintained. The golang-jwt says it is a
drop in replacement for v4. This also fixes CVE-2020-26160 which
possibly won't be fixed in dgrijalva's version.

* Update occurrences of bradleyfalzon/ghinstallation to v2

v2.0.3 pulls in golang-jwt/jwt over the now unmaintained
dgrijalva/jwt-go.
2021-10-07 00:41:37 -04: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
Nicholas (Nick) Meyer
875e2adc40 Improve github pull request call retries (#1810)
* Improve github pull request call retries

Retry with fixed 1 second backoff up to 3 retries was added by #1131 to
address #1019, but the issue continued to show up (#1453).

Increase max attempts to 5 and use exponential backoff for a maximum
total retry time of (2^n - n - 1) seconds, which is roughly 30 seconds
for current max attempts n = 5.

Also move the sleep to the top of the loop so that we never sleep
without sending the request again on the last iteration.

* Fix style with gofmt -s
2021-10-04 09:59:53 -07:00
wpbeckwith
da7e04290b Add support for deleting a branch on merge in BitBucket Server (#1792)
* Add support for deleting a branch on merge in BitBucket Server

* Add support for deleting a branch on merge in BitBucket Server

* Making linter happy although the code would fall through and return err anyway.

* Add client_test for deleting source branch

* Added err check

Co-authored-by: Wendell Beckwith <wendell.beckwith@redfin.com>
2021-09-27 09:26:37 -07:00
Aayush Gupta
bb2c239dd9 Updating client interface and adding ApprovalStatus model (#1827) 2021-09-22 12:41:05 -07:00
Masayuki Morita
4b6c2f65da build(lint): use revive instead of golint (#1801)
* Use revive instead of golint

The golint was officially deprecated.
https://github.com/golang/go/issues/38968

We have been using golint via golangci-lint and golangci-lint now
recommends using revive instead of golint.
https://golangci-lint.run/usage/linters/
> golint: The repository of the linter has been archived by the owner.
> Replaced by revive.

The revive is a drop-in replacement of golint. I think switching to
revive is a reasonable choice to check the same rules for free.
https://github.com/mgechev/revive

* Fix lint errors reported by revive

The revive is almost the same as golint, but there seems to be a bit
different results.

https://app.circleci.com/pipelines/github/runatlantis/atlantis/1519/workflows/75fd7da5-1532-4ed7-ac8a-4884902818a4/jobs/8314
https://github.com/runatlantis/atlantis/runs/3565887247?check_suite_focus=true
2021-09-10 09:14:56 -07:00
Sarvar Muminov
a2d82b9f45 Set ParallelPolicyCheckEnabled to the same value as ParallelPlanEnabled (#1802) 2021-09-09 09:21:26 -07:00
Dan
4aa49217b5 fix a typo (#1796) 2021-09-08 15:05:51 -04:00
Masayuki Morita
2600708fba Validate base branches in DefaultCommandRunner (#1768)
Fixes #1539

The branch matcher feature has been introduced in #1383, but the current
implementation was broken and doesn't work at all (#1539).

If my understanding is correct, there are two problems:

(1) The `GlobalCfg` has a default `Repo` instance which always matches
any repositries and branches. Therefore the branch matcher never be
functional.
(2) Validating base branches in
`DefaultPreWorkflowHooksCommandRunner.RunPreHooks()` implicitly assumed
that users customize `pre_workflow_hooks`, but the assumption isn't
always true because it defaults to empty.

For (1), I added a new method `MatchingRepo()` to `GlobalCfg` to check
`BranchMatches()` for a single `Repo` instance.

For (2), I moved validating branch to
`DefaultCommandRunner.validateCtxAndComment()`. Since the method has
already validated meta data of pull request, I think it's suitable place
to check base branches, but please let me know if there is anywhere more
suitable.
2021-08-30 15:13:59 -07:00
Gerald Barker
7ce8cef307 Fix regression - Delete .terraform.lock.hcl if it was created by terraform init (#1701)
* Delete .terraform.lock.hcl prior to terraform init if it is not staged

* Changes suggeted by reviewer
2021-08-30 14:53:49 -07:00
Ken Kaizu
42940421a2 Split Gitlab Server comments if over max length (#1755) 2021-08-30 14:39:04 -07:00
Enoch Lo
89236d8e54 Add flag to enable markdown diff formatting (#1751) 2021-08-30 14:01:52 -07:00
David Haven
01b8718509 allow user to pass gh-app-key directly instead of filename (#1706)
* allow user to pass gh-app-key directly instead of filename

* start fixing tests

* fix make test

* update website with info about new flag

* Apply suggestions from code review

Co-authored-by: Roberto Hidalgo <un@rob.mx>

Co-authored-by: Roberto Hidalgo <un@rob.mx>
2021-08-17 22:02:01 -07:00
Masayuki Morita
fe31bc6243 Fix typo (#1754) 2021-08-17 10:23:48 -07:00
Aayush Gupta
44e898c33a Refactor Apply Requirements into a Handler. (#1729) 2021-08-06 14:03:12 -07:00
Lucas C
552e4a29e7 Fixing apply permission when MR status is draft (#1736) 2021-08-04 12:34:44 -07:00
Pavel Golubev
ebf3db4051 fix ignore of --parallel-pool-size flag (#1705) 2021-08-03 11:03:23 -07:00
Lucas C
cbef84fe09 feat: improving apply requirements for mergeable on Gitlab (#1675)
* Improving apply requirements for mergeable on Gitlab

* Fixing end of line

* Renaming variables

* Renaming variables

* Fixing variable assignment

* Fixing variable assignment
2021-08-02 13:34:11 -07:00
Pat Sier
d358857e80 feat: add version command (#1691) 2021-07-12 11:10:15 -04:00
Taavi Tani
d451167175 fix: TFE remote ops detection for >= tf 1.0.0 (#1687) 2021-07-07 16:48:49 -04:00
Nish Krishnan
d914eafd2a Move core workflow packages under core. (#1684)
* Move core workflow packages under core.

* lint.
2021-07-01 12:54:44 -07:00
Nish Krishnan
4b2e5745df Fix regression introduced in approve policy command workflow. (#82) (#1672) 2021-06-29 08:48:12 -07:00
giuli007
528ee85ea8 Always use the default workspace directory when building commands context (#1620)
When pre_workflow_hooks is being used to generate atlantis.yaml
and projects are set with specific workspaces different than "default",
a different directory is created for each project-workspace pair,
but all those that are not on the "default" workspace will
not have an atlantis.yaml file at their root.

This change ensures that when atlantis is building the projects commands
for either:
- a project-specific plan, triggered via (atlantis plan -d foo -w bar)
- a project-specific apply, triggered vi (atlantis apply -d foo -w bar)
- or applies for all the plans it can find (atlantis apply)
it uses the default workspace to find the atlantis.yaml config.

Co-authored-by: giuli007 <giuglioz@gmail.com>
2021-06-24 10:16:47 -07:00
Gerald Barker
0927464b7e Move argument deduplication logic to a utility package (#1660) 2021-06-24 08:33:38 -07:00
chroju
e0f5b83aa7 Fix plan summary when changes outside of terraform is detected (#1593) (#1594)
Co-authored-by: chroju <chroju@users.noreply.github.com>
2021-06-24 08:30:31 -07:00
Gerald Barker
cd9d5b2fce Dont add -upgrade of the lock file exists & dedupe extra args (#1651) 2021-06-23 11:51:10 -07:00
Sarvar Muminov
0ed7a43e59 Fix policy check loading the tf version (#1658) 2021-06-23 11:48:55 -07:00
Sarvar Muminov
7607c154cb revert previous commit 2021-06-23 11:30:07 -07:00
Sarvar Muminov
3b08952168 Load terraform version from the required_version block 2021-06-23 11:24:55 -07:00
Marius Hennecke
b9802f71a4 set azure devops max comment characters to api limit (#1585) 2021-06-22 19:31:01 -04:00
Rui Chen
b6b60aab2c fix the build
Signed-off-by: Rui Chen <rui@chenrui.dev>
2021-06-22 19:19:54 -04:00
Spiros Economakis
e48f80359b Add an extra flag to disable automerge with comment apply (#1533)
```
atlantis apply --auto-merge-disabled
```

Issue: #1245
2021-06-22 09:33:07 -07:00
Marius Hennecke
aef146fba0 add run step environment variable SHOWFILE (#1611) 2021-06-22 09:32:21 -07:00
tkishore1192
1f0cb3f6f0 standardised logging timestamp to ISO8601 (#1625)
Co-authored-by: T <kishore.t@lowes.com>
2021-06-18 15:52:25 -04:00
Paul Calley
6b50e84ab9 Add undiverged apply requirement (#1587)
* ORCA-731 Force PR authors to rebase if master has diverged (#70)

* initial commit for undiverge apply req

* Update documentation

* Fix existing unit tests

* HasDiverged unit test

* project command runner unit test

* Global config tests cases

* update parser unit tests

* Update project_test unit tests

* Fix linting

* fix test case with logging output

* add space on readme markdown

* Remove unused variable

* remove deprecated flag option

* Use global args struct instead of passing in args

* Fix merge issue
2021-06-03 14:35:30 -07:00
Nish Krishnan
712498da58 Refactor controllers into package. (#1597) 2021-06-01 11:58:01 -07:00
Gábor Lipták
a4f0e3a467 Bump golangci to 1.39.0 (#1541)
Signed-off-by: Gábor Lipták <gliptak@gmail.com>
2021-05-26 21:00:20 -04:00
Sarvar Muminov
2a6f21e85d Attempting to fix e2e test (#1595)
* Attemting to fix e2e test

* remove comma

* no-op change

* scope down the fixtures

* remove unnecessary comment
2021-05-21 21:39:36 -07:00