hootsuite / atlantis Goto Github PK
View Code? Open in Web Editor NEWAtlantis is now being maintained at https://github.com/runatlantis/atlantis
License: Other
Atlantis is now being maintained at https://github.com/runatlantis/atlantis
License: Other
When receiving a SIGTERM Atlantis server should shutdown cleanly.
Logging guielines
getting modified files
found 10 modified files
# or
getting modified files
error getting modified files
Do
found 10 modified files
#or
error getting modified files
Guidelines
Examples below.
Would be awesome to have this support GitLab
Installation Options
Can also choose between listening for comments mentioning an @atlantis user or just the string "atlantis"
Webhooks require a two step installation: create a user and then add the webhook to the repo
OAuth could be a one-step solution but we'd need to support oauth flow
I don't think Github Apps will work for Github Enterprise. CircleCI's instructions ask people to add it as an OAuth App. I haven't done a ton of research into this. Apps are nice because they automatically get a bot user associated with them, but I think it's probably over complicated for what we need.
So I think we should recommend adding as a git hook on the organization and also setting up an Atlantis user.
We could use the mentions API but I think we should still use webhooks so we can do things like auto-planning in the future (before atlantis is mentioned). We can also support both @atlantis and atlantis.
GitHub's api has it like this.
"repo": {
"id": 35129377,
"name": "public-repo",
"full_name": "baxterthehacker/public-repo",
The only place we need it separately is when we pass it into github client. At those locations we can just split on /
but everywhere else is simpler
atlantis apply
to e2e testsInvestigate calls to start session and assume role throughout the codebase
and ensure they will work past any timeouts and that we're also not spamming
aws sessions
hootsuite/atlantis-example
from private to publichootsuite/atlantis-example
project instead of airauth/example
After Release:
This issue can be reproduced by commenting plan staging
and plan production
in quick succession.
Will error out with something like
error running plan: 2 error(s) occurred:
* file: open /private/tmp/atlantis/lkysow/atlantis-terraform-test/10/.terraform/modules/717f47b625fc0873bb7bd027de734d00/templates/userdata.tpl: no such file or directory in:
${coalesce(var.user_data_template, file("${path.module}/templates/userdata.tpl"))}
* file: open /private/tmp/atlantis/lkysow/atlantis-terraform-test/10/.terraform/modules/717f47b625fc0873bb7bd027de734d00/templates/userdata.tpl: no such file or directory in:
${coalesce(var.user_data_template, file("${path.module}/templates/userdata.tpl"))}
because we clean the workspace when we get a new event
Right now we're sending the Accept: application/vnd.github.black-cat-preview+json
header because our version of github enterprise hasn't been updated to the latest. This will cause approval checking to fail on github.com.
We should try without the header and if it fails, send it with the header. Or look into if there's a way to know which version of GitHub is being run.
Would be awesome to have this support BitBucket
type Project struct {
Repo Repo
// Path to project root in the repo.
// If "/" then project is at root
// All paths must end with "/"
Path string
}
A project is where you'd run terraform plan/apply
from. We have a Path
because some repos may have multiple terraform projects. A project may have multiple environments or just the default
environment. I don't think we need to have that data in the struct though.
type ProjectLock struct {
Project Project
Pull Pull
Environment string
Timestamp time.Time
}
I also think we should call this a ProjectLock
because we're not locking a Run
, the ProjectLock
is created as a result of a Run
.
func (p Project) Key() string {
return fmt.Sprintf("%s%s", p.Repo.FullName, p.Path)
}
The Key()
is used for looking up a ProjectLock
in the database. When a plan
command is run, we look up existing locks for that Project
with the key.
Should be able to click in to list of locks and see more detail.
Should also have a DELETE button that makes a DELETE
request to
the backend and deletes the lock
Currently, atlantis ignores certain folders such as _modules/
and modules/
but we want to extend this to ignore any folder that has .atlantisignore
file or something along those lines. https://github.com/hootsuite/atlantis/blob/master/server/plan_executor.go#L196
I saw Mishra's ConfigMgmtCamp talk in Portland today, and this project is exactly what we'd been looking for.
A few questions as to running this in production:
Can then use github.ValidatePayload
method.
Will be optional.
How we'll support multiple terraform versions
terraform version
#todoterraform init
terraform env select {env}
, may also need to create it with new
-var-file=env/{env}.tfvars
automaticallyChanges:
-no-color
. allow arguments to: plan
, apply
, init
The object is the planfile itself and the key is determined as follows where prefix
is set to /plans
{prefix}/{owner}/{repo}/{owner}_{repo}_{pullNum}.tfplan
env
{prefix}/{owner}/{repo}/{owner}_{repo}_{pullNum}.tfplan.{env}
parent/child
, env: none
{prefix}/{owner}/{repo}/{owner}_{repo}_{pullNum}_parent_child.tfplan
parent/child
, env: env
{prefix}/{owner}/{repo}/{owner}_{repo}_{pullNum}_parent_child.tfplan.{env}
The key is used as follows
apply {env}
command comes in{prefix}/{owner}/{repo}/{owner}_{repo}_{pullNum}
env
. Since no env is ""
this will also return true for case 1 and 3.{scratchDir}/{owner}_{repo}_{pullNum}{_any sub dirs}.tfplan{.optional env}
{scratchDir}/{owner}/{repo}/{pullNum}/{subdirs}
cd
into each sub dir and run apply
with the -tfvars=env/{env}.tfvars
if neededapply
and apply {env}
terraform env {env}
or -tfvars env/{env}.tfvars
repo
, pull
, env
and subDirs
. Then our key structure can be changed separately to the file metadata.{prefix}/{owner}/{repo}/{pullNum}/{parent}/{child}/{env}.tfplan
?Failed to render template, this is a bug: template: :3:2: executing "" at <.Error>: can't evaluate field Error in type struct { Command string; Output string }
This more closely matches what the name for what is happening.
Can add a hidden cli option to support the old /hooks endpoint
Add post_apply
command. This functionality would be super helpful in terms of performing tests after deploying infrastructure.
See https://github.com/rauchg/slackin
Also add a badge to our readme
Right now we're writing code like
func (r *RequestParser) extractPullData(pull *github.PullRequest, params *CommandContext) error {
commit := pull.Head.SHA
if commit == nil {
return errors.New("key 'pull.head.sha' is null")
}
but if pull
or Head
was nil this would panic. We just need to check these better.
Proposal
package {package under test}_test
to enforce testing the external interfaces{file under test}_internal_test.go
import . "github.com/hootsuite/atlantis/testing_util"
t.Log
statements:// don't do this
func TestLockingWhenThereIsAnExistingLockForNewEnv(t *testing.T) {
...
// do this
func TestLockingExisting(t *testing.T) {
t.Log("if there is an existing lock, lock should...")
...
t.Log("...succeed if the new project has a different path") {
// optionally wrap in a block so it's easier to read
}
Probably using govendor
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.