Commit Graph

779 Commits

Author SHA1 Message Date
Javier Palomo
7c89523319 fix(web-templates): use CleanedBasePath for titles (#2091)
A follow-up to https://github.com/runatlantis/atlantis/pull/2079

After upgrading to https://github.com/runatlantis/atlantis/releases/tag/v0.18.3 in our own
infra, I noticed a minor issue with the links in the titles, they are still pointing to /
even when '--atlantis-url' is provided.
2022-03-01 14:18:03 -05:00
Javier Palomo
51d434d46b fix(web-templates): use CleanedBasePath for static content (#2079)
* fix(web-templates): use CleanedBasePath for static content

When setting '--atlantis-url' this static content 404s.

For example, we can see this when comparig:
- /lock --> works seamless with a custom `--atlantis-url`
- /jobs --> doesn't work when using a custom `--atlantis-url`

* fix(web-templates): regenerate bindata_assetfs
2022-02-28 10:43:39 -05:00
Pantelis Karamolegkos
6248472237 Removing web credentials from debug log (#2072)
* Hashing web credentials

* Fix syntactic error

* Using strong cryptogrpahic primitive

* Entirely removing credentials

* Removing unused constant

* Removing redundant formatting parameters
2022-02-17 15:38:09 -08:00
Aayush Gupta
58e9b42bbc feat: Use UUIDs to identify log streaming jobs (#2051)
* Add UUID for Log Streaming Job ID (#167)

* Update log handler to close buffered  channels when an operation is complete (#170)

* Add preliminary check before registering new receivers in the log handler (#173)

* Using projectOutputBuffers to check for jobID instead of receiverBuffers (#181)

* Refactor log handler  (#175)

* Reverting go.mod and go.sum

* Fix lint errors

* Fix linting
2022-02-09 13:15:49 -08:00
Raymond Chen
136b23ac11 fix: get user teams with GitHub GraphQL API (#2045) 2022-02-04 19:47:30 -05:00
Sarvar Muminov
7a927c050b Moving config files to core/config (#2036)
* Moving config files to core/config

* fix package names

* fix package dependencies

* linting fixes

* more linting fixes

* ran golangci-lint run --fix
2022-02-03 11:06:04 -08:00
Roman Pertsev
576f8fbf4b Fix URL generation (#2021)
* fix org generation

* fix key generation

* fix variable name

* add normalization vars

* encapsulate vars

Co-authored-by: Roman Pertsev <roman.pertsev@nordigy.ru>
2022-01-31 12:15:16 -07:00
Iain Lane
e3f0dd5553 Retry /files/ requests to github (#2002)
Similar to #1131, we see this for /files/ too, resulting in a plan
error.

Closes #1905
2022-01-25 09:49:11 -05:00
Aayush Gupta
7d3f3fb490 fix: broken Log Streaming URL when working directory is set to "./" (#2015)
* Replacing . with _ when generating project identifier if project name is not set

* Adding test for GenerateProjectJobURL when working dir set to .

* Replacing . with _ when generating project identifier if project name is not set

* Fixing merge conflicts
2022-01-24 12:18:50 -08:00
Aayush Gupta
e20e1328f2 Update GenerateProjectJobURL to account for nested repo names (#2012) 2022-01-24 10:30:18 -08:00
Leandro López
ca28b577a4 chore: improve /healthz endpoint performance (#2014)
* Add benchmark for /healthz endpoint

This benchmark will measure not only speed but also how much memory
each request to /healthz allocate. I'm adding the benchmark to have a
baseline to compare.

Signed-off-by: Leandro López (inkel) <inkel.ar@gmail.com>

* Hardcode /healthz body into a variable

We know it will always be this value, there's no need to import and
call json.MarshalIndent.

Signed-off-by: Leandro López (inkel) <inkel.ar@gmail.com>

* Initialize /healthz body only once

Signed-off-by: Leandro López (inkel) <inkel.ar@gmail.com>
2022-01-22 23:08:12 -05:00
Aayush Gupta
e06d181272 fix: add back basic auth support (#2008)
* Fix issue 1980

* Adding comment
2022-01-20 00:32:14 -05:00
Braden Schaeffer
1811514ecf Fix support for terraform workspaces (#2006)
Fixes #1517 and basically is a rebased version of #1578.
2022-01-18 11:56:20 -08:00
Ed Laur
1b30fe0456 Make IsOwner policy check case-insensitive (#1989) 2022-01-14 12:56:58 -08:00
Tim McFadden
b859f72561 feat: post workflow hooks (#1990)
* Add post-workflow hooks

* docs: Add cost estimation as post workflow use case

Co-authored-by: Gerald Barker <geraldbarker@gmail.com>
2022-01-12 19:57:45 -05:00
Jordy Ruiter
0092cfbd56 Add XTerm JS to the server static files (#1985) 2022-01-12 14:52:43 -08:00
Gerald Barker
8f98558f54 Fix autoplan when .terraform.lock.hcl is modifed (#1991) 2022-01-12 11:17:43 -08:00
Bruno Ferreira
cc513d4ef1 fix: allowed regexp prefixes for exact matches (#1962)
* test: adds failing test case

* fix: return project if there's an exact match, even if the prefix is not on the allowed list
2022-01-05 11:16:28 -05:00
Nish Krishnan
b7b28b807a fix: default permissions for gh-team-allowlist. (#1974)
* Fix default permissions for gh-team-allowlist.

* Fix broken links.
2022-01-04 11:20:29 -08:00
Nish Krishnan
64612019f4 Revert "feat: filter out atlantis/apply from mergeability clause (#18… (#1968)
* Revert "feat: filter out atlantis/apply from mergeability clause (#1856)"

This reverts commit d01796b9d9.

* Add missing import.
2022-01-01 15:11:39 -05:00
Aayush Gupta
004074a29f feat: streaming terraform logs in real-time (#1937) 2021-12-30 09:52:52 -05:00
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