Skip to content

Commit

Permalink
Merge pull request #152 from runatlantis/atlantis-yaml-june
Browse files Browse the repository at this point in the history
[WIP] Atlantis 0.4
  • Loading branch information
lkysow authored Jul 3, 2018
2 parents 5fafcec + 573491f commit a4b18f9
Show file tree
Hide file tree
Showing 2,508 changed files with 349,722 additions and 11,446 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jobs:
test:
working_directory: /go/src/github.com/runatlantis/atlantis
docker:
- image: circleci/golang:1.10
- image: runatlantis/testing-env
steps:
- checkout
- run: make test-coverage
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ website/src/public
.DS_Store
.cover
.terraform/
node_modules/
**/.vuepress/dist
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# v0.4.0-alpha

## Features
* Autoplanning - Atlantis will automatically run `plan` on new pull requests and
when new commits are pushed to the pull request.
* New repository `atlantis.yaml` format that supports:
* Arbitrary step ordering
* Single config file for whole repository
* Controlling autoplanning
* Moved docs to standalone website from the README.

## Bugfixes

## Backwards Incompatibilities / Notes:

## Downloads

## Docker


# v0.3.10

## Features
Expand Down
80 changes: 78 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,15 @@
[[constraint]]
branch = "master"
name = "github.com/lkysow/go-gitlab"

[[constraint]]
name = "github.com/go-test/deep"
version = "1.0.1"

[[constraint]]
branch = "master"
name = "github.com/flynn-archive/go-shlex"

[[constraint]]
branch = "master"
name = "github.com/docker/docker"
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ build-service: ## Build the main Go service
go-generate: ## Run go generate in all packages
go generate $(PKG)

regen-mocks: ## Delete all mocks and then run go generate to regen them
find . -type f | grep mocks/mock | grep -v vendor | xargs rm
@# not using $(PKG) here because that it includes directories that have now
@# been deleted, causing go generate to fail.
go generate $$(go list ./... | grep -v e2e | grep -v vendor | grep -v static)
#regen-mocks: ## Delete all mocks and matchers and then run go generate to regen them. This doesn't work anymore.
#find . -type f | grep mocks/mock_ | grep -v vendor | xargs rm
#find . -type f | grep mocks/matchers | grep -v vendor | xargs rm
#@# not using $(PKG) here because that it includes directories that have now
#@# been deleted, causing go generate to fail.
#echo "this doesn't work anymore: go generate \$\$(go list ./... | grep -v e2e | grep -v vendor | grep -v static)"

test: ## Run tests
@go test -short $(PKG)

test-all: ## Run tests including integration
@go test $(PKG)

test-coverage:
Expand Down Expand Up @@ -78,9 +82,9 @@ end-to-end-tests: ## Run e2e tests
./scripts/e2e.sh

generate-website-html: ## Generate HTML for website
cd website/src && hugo -d ../html
yarn website:build

upload-website-html: ## Upload generated website to s3
aws s3 rm s3://www.runatlantis.io/ --recursive
aws s3 sync website/html/ s3://www.runatlantis.io/
rm -rf website/html/
aws s3 sync runatlantis.io/.vuepress/dist/ s3://www.runatlantis.io/
rm -rf runatlantis.io/.vuepress/dist
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,42 +124,42 @@ Atlantis supports several Terraform project structures:
```
.
├── project1
   ├── main.tf
├── main.tf
| └── ...
└── project2
   ├── main.tf
├── main.tf
└── ...
```
- one folder per set of configuration
```
.
├── staging
   ├── main.tf
├── main.tf
| └── ...
└── production
   ├── main.tf
├── main.tf
└── ...
```
- using `env/{env}.tfvars` to define workspace specific variables. This works in both multi-project repos and single-project repos.
```
.
├── env
   ├── production.tfvars
   └── staging.tfvars
├── production.tfvars
└── staging.tfvars
└── main.tf
```
or
```
.
├── project1
   ├── env
   │   ├── production.tfvars
   │   └── staging.tfvars
   └── main.tf
├── env
├── production.tfvars
└── staging.tfvars
└── main.tf
└── project2
├── env
   ├── production.tfvars
   └── staging.tfvars
├── production.tfvars
└── staging.tfvars
└── main.tf
```
With the above project structure you can de-duplicate your Terraform code between workspaces/environments without requiring extensive use of modules. At Hootsuite we found this project format to be very successful and use it in all of our 100+ Terraform repositories.
Expand Down
15 changes: 12 additions & 3 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ import (
// 3. Add your flag's description etc. to the stringFlags, intFlags, or boolFlags slices.
const (
// Flag names.
AtlantisURLFlag = "atlantis-url"
AllowForkPRsFlag = "allow-fork-prs"
AllowRepoConfigFlag = "allow-repo-config"
AtlantisURLFlag = "atlantis-url"
ConfigFlag = "config"
DataDirFlag = "data-dir"
GHHostnameFlag = "gh-hostname"
Expand Down Expand Up @@ -142,6 +143,13 @@ var boolFlags = []boolFlag{
description: "Allow Atlantis to run on pull requests from forks. A security issue for public repos.",
defaultValue: false,
},
{
name: AllowRepoConfigFlag,
description: "Allow repositories to use atlantis.yaml files to customize the commands Atlantis runs." +
" Should only be enabled in a trusted environment since it enables a pull request to run arbitrary commands" +
" on the Atlantis server.",
defaultValue: false,
},
{
name: RequireApprovalFlag,
description: "Require pull requests to be \"Approved\" before allowing the apply command to be run.",
Expand Down Expand Up @@ -298,8 +306,9 @@ func (s *ServerCmd) run() error {

// Config looks good. Start the server.
server, err := s.ServerCreator.NewServer(userConfig, server.Config{
AllowForkPRsFlag: AllowForkPRsFlag,
AtlantisVersion: s.AtlantisVersion,
AllowForkPRsFlag: AllowForkPRsFlag,
AllowRepoConfigFlag: AllowRepoConfigFlag,
AtlantisVersion: s.AtlantisVersion,
})
if err != nil {
return errors.Wrap(err, "initializing server")
Expand Down
Loading

0 comments on commit a4b18f9

Please sign in to comment.