Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump github.com/nlopes/slack from 0.4.0 to 0.6.0 #11

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 28 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,59 +1,69 @@
module github.com/runatlantis/atlantis

go 1.14
go 1.16

replace google.golang.org/grpc => google.golang.org/grpc v1.29.1

require (
github.com/Laisky/graphql v1.0.5
github.com/Masterminds/sprig/v3 v3.2.0
github.com/Masterminds/sprig/v3 v3.2.2
github.com/agext/levenshtein v1.2.3 // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/aws/aws-sdk-go v1.17.14 // indirect
github.com/aws/aws-sdk-go v1.31.15 // indirect
github.com/bradleyfalzon/ghinstallation v1.1.1
github.com/briandowns/spinner v0.0.0-20170614154858-48dbb65d7bd5
github.com/davecgh/go-spew v1.1.1
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/docker/docker v0.0.0-20180620051407-e2593239d949
github.com/elazarl/go-bindata-assetfs v1.0.0
github.com/elazarl/go-bindata-assetfs v1.0.1
github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568
github.com/fsnotify/fsnotify v1.4.10-0.20200417215612-7f4cf4dd2b52 // indirect
github.com/go-ozzo/ozzo-validation v0.0.0-20170913164239-85dcd8368eba
github.com/go-playground/locales v0.12.1 // indirect
github.com/go-playground/universal-translator v0.16.0 // indirect
github.com/go-test/deep v1.0.3
github.com/go-test/deep v1.0.7
github.com/google/go-cmp v0.5.2 // indirect
github.com/google/go-github/v31 v31.0.0
github.com/google/uuid v1.1.2-0.20200519141726-cb32006e483f // indirect
github.com/gorilla/mux v1.8.0
github.com/hashicorp/go-getter v1.5.2
github.com/hashicorp/go-version v1.2.1
github.com/hashicorp/go-getter v1.5.3
github.com/hashicorp/go-version v1.3.0
github.com/hashicorp/hcl/v2 v2.6.0 // indirect
github.com/hashicorp/terraform-config-inspect v0.0.0-20200806211835-c481b8bfa41e
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.3.1-0.20200310193758-2437e8417af5 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/mcdafydd/go-azuredevops v0.12.0
github.com/microcosm-cc/bluemonday v1.0.1
github.com/microcosm-cc/bluemonday v1.0.9
github.com/mitchellh/colorstring v0.0.0-20150917214807-8631ce90f286
github.com/mitchellh/go-homedir v1.0.0
github.com/mitchellh/go-homedir v1.1.0
github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb
github.com/nlopes/slack v0.4.0
github.com/onsi/ginkgo v1.9.0 // indirect
github.com/onsi/gomega v1.4.3 // indirect
github.com/nlopes/slack v0.6.0
github.com/onsi/ginkgo v1.14.0 // indirect
github.com/petergtz/pegomock v2.9.0+incompatible
github.com/pkg/errors v0.9.1
github.com/remeh/sizedwaitgroup v1.0.0
github.com/shurcooL/githubv4 v0.0.0-20191127044304-8f68eb5628d0
github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f // indirect
github.com/sirupsen/logrus v1.6.1-0.20200528085638-6699a89a232f // indirect
github.com/spf13/cobra v0.0.0-20170905172051-b78744579491
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.7.1
github.com/urfave/cli v1.20.0
github.com/stretchr/testify v1.7.0
github.com/urfave/cli v1.22.5
github.com/urfave/negroni v0.3.0
github.com/xanzy/go-gitlab v0.34.1
github.com/xanzy/go-gitlab v0.50.0
github.com/zclconf/go-cty v1.5.1 // indirect
go.etcd.io/bbolt v1.3.5
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904
golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933 // indirect
go.opencensus.io v0.22.3 // indirect
go.uber.org/zap v1.17.0
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
golang.org/x/oauth2 v0.0.0-20191122200657-5d9234df094c // indirect
golang.org/x/text v0.3.3 // indirect
golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6 // indirect
google.golang.org/appengine v1.6.5 // indirect
google.golang.org/genproto v0.0.0-20200701001935-0939c5918c31 // indirect
google.golang.org/grpc v1.30.0 // indirect
google.golang.org/protobuf v1.25.1-0.20200622203222-a9513ebdb860 // indirect
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/go-playground/validator.v9 v9.31.0
gopkg.in/yaml.v2 v2.4.0
Expand Down
208 changes: 139 additions & 69 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion server/events/markdown_renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ var planSuccessUnwrappedTmpl = template.Must(template.New("").Parse(
"{{ if .HasDiverged }}\n\n:warning: The branch we're merging into is ahead, it is recommended to pull new commits first.{{end}}"))

var planSuccessWrappedTmpl = template.Must(template.New("").Parse(
"<details><summary>Show Output</summary>\n\n" +
"{{ if .ChangeSummary }}Change Summary: `{{.ChangeSummary}}`\n{{end}}<details><summary>Show Output</summary>\n\n" +
"```diff\n" +
"{{.TerraformOutput}}\n" +
"```\n\n" +
Expand Down
17 changes: 17 additions & 0 deletions server/events/markdown_renderer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func TestRenderProjectResults(t *testing.T) {
{
PlanSuccess: &models.PlanSuccess{
TerraformOutput: "terraform-output",
ChangeSummary: "Plan: 1 to add, 2 to change, 3 to destroy.",
LockURL: "lock-url",
RePlanCmd: "atlantis plan -d path -w workspace",
ApplyCmd: "atlantis apply -d path -w workspace",
Expand Down Expand Up @@ -170,6 +171,7 @@ $$$
{
PlanSuccess: &models.PlanSuccess{
TerraformOutput: "terraform-output",
ChangeSummary: "Plan: 1 to add, 2 to change, 3 to destroy.",
LockURL: "lock-url",
RePlanCmd: "atlantis plan -d path -w workspace",
ApplyCmd: "atlantis apply -d path -w workspace",
Expand Down Expand Up @@ -208,6 +210,7 @@ $$$
{
PlanSuccess: &models.PlanSuccess{
TerraformOutput: "terraform-output",
ChangeSummary: "Plan: 1 to add, 2 to change, 3 to destroy.",
LockURL: "lock-url",
RePlanCmd: "atlantis plan -d path -w workspace",
ApplyCmd: "atlantis apply -d path -w workspace",
Expand Down Expand Up @@ -285,6 +288,7 @@ $$$
RepoRelDir: "path",
PlanSuccess: &models.PlanSuccess{
TerraformOutput: "terraform-output",
ChangeSummary: "Plan: 1 to add, 2 to change, 3 to destroy.",
LockURL: "lock-url",
ApplyCmd: "atlantis apply -d path -w workspace",
RePlanCmd: "atlantis plan -d path -w workspace",
Expand All @@ -295,6 +299,7 @@ $$$
RepoRelDir: "path2",
ProjectName: "projectname",
PlanSuccess: &models.PlanSuccess{
ChangeSummary: "Plan: 1 to add, 2 to change, 3 to destroy.",
TerraformOutput: "terraform-output2",
LockURL: "lock-url2",
ApplyCmd: "atlantis apply -d path2 -w workspace",
Expand Down Expand Up @@ -421,6 +426,7 @@ $$$
RepoRelDir: "path",
PlanSuccess: &models.PlanSuccess{
TerraformOutput: "terraform-output",
ChangeSummary: "Plan: 1 to add, 2 to change, 3 to destroy.",
LockURL: "lock-url",
ApplyCmd: "atlantis apply -d path -w workspace",
RePlanCmd: "atlantis plan -d path -w workspace",
Expand Down Expand Up @@ -607,6 +613,7 @@ func TestRenderProjectResultsDisableApplyAll(t *testing.T) {
{
PlanSuccess: &models.PlanSuccess{
TerraformOutput: "terraform-output",
ChangeSummary: "Plan: 1 to add, 2 to change, 3 to destroy.",
LockURL: "lock-url",
RePlanCmd: "atlantis plan -d path -w workspace",
ApplyCmd: "atlantis apply -d path -w workspace",
Expand Down Expand Up @@ -638,6 +645,7 @@ $$$
{
PlanSuccess: &models.PlanSuccess{
TerraformOutput: "terraform-output",
ChangeSummary: "Plan: 1 to add, 2 to change, 3 to destroy.",
LockURL: "lock-url",
RePlanCmd: "atlantis plan -d path -w workspace",
ApplyCmd: "atlantis apply -d path -w workspace",
Expand Down Expand Up @@ -672,6 +680,7 @@ $$$
RepoRelDir: "path",
PlanSuccess: &models.PlanSuccess{
TerraformOutput: "terraform-output",
ChangeSummary: "Plan: 1 to add, 2 to change, 3 to destroy.",
LockURL: "lock-url",
ApplyCmd: "atlantis apply -d path -w workspace",
RePlanCmd: "atlantis plan -d path -w workspace",
Expand All @@ -683,6 +692,7 @@ $$$
ProjectName: "projectname",
PlanSuccess: &models.PlanSuccess{
TerraformOutput: "terraform-output2",
ChangeSummary: "Plan: 1 to add, 2 to change, 3 to destroy.",
LockURL: "lock-url2",
ApplyCmd: "atlantis apply -d path2 -w workspace",
RePlanCmd: "atlantis plan -d path2 -w workspace",
Expand Down Expand Up @@ -1099,6 +1109,7 @@ func TestRenderProjectResults_WrapSingleProject(t *testing.T) {
Workspace: "default",
PlanSuccess: &models.PlanSuccess{
TerraformOutput: c.Output,
ChangeSummary: "Plan: 1 to add, 2 to change, 3 to destroy.",
LockURL: "lock-url",
RePlanCmd: "replancmd",
ApplyCmd: "applycmd",
Expand All @@ -1122,6 +1133,7 @@ func TestRenderProjectResults_WrapSingleProject(t *testing.T) {
if c.ShouldWrap {
exp = `Ran Plan for dir: $.$ workspace: $default$

` + "Change Summary: `Plan: 1 to add, 2 to change, 3 to destroy.`" + `
<details><summary>Show Output</summary>

$$$diff
Expand Down Expand Up @@ -1247,6 +1259,7 @@ func TestRenderProjectResults_MultiProjectPlanWrapped(t *testing.T) {
Workspace: "staging",
PlanSuccess: &models.PlanSuccess{
TerraformOutput: tfOut,
ChangeSummary: "Plan: 1 to add, 2 to change, 3 to destroy.",
LockURL: "staging-lock-url",
ApplyCmd: "staging-apply-cmd",
RePlanCmd: "staging-replan-cmd",
Expand All @@ -1257,6 +1270,7 @@ func TestRenderProjectResults_MultiProjectPlanWrapped(t *testing.T) {
Workspace: "production",
PlanSuccess: &models.PlanSuccess{
TerraformOutput: tfOut,
ChangeSummary: "Plan: 1 to add, 2 to change, 3 to destroy.",
LockURL: "production-lock-url",
ApplyCmd: "production-apply-cmd",
RePlanCmd: "production-replan-cmd",
Expand All @@ -1270,6 +1284,7 @@ func TestRenderProjectResults_MultiProjectPlanWrapped(t *testing.T) {
1. dir: $.$ workspace: $production$

### 1. dir: $.$ workspace: $staging$
` + "Change Summary: `Plan: 1 to add, 2 to change, 3 to destroy.`" + `
<details><summary>Show Output</summary>

$$$diff
Expand All @@ -1285,6 +1300,7 @@ $$$

---
### 2. dir: $.$ workspace: $production$
` + "Change Summary: `Plan: 1 to add, 2 to change, 3 to destroy.`" + `
<details><summary>Show Output</summary>

$$$diff
Expand Down Expand Up @@ -1377,6 +1393,7 @@ func TestRenderProjectResults_PlansDeleted(t *testing.T) {
Workspace: "production",
PlanSuccess: &models.PlanSuccess{
TerraformOutput: "tf out",
ChangeSummary: "Plan: 1 to add, 2 to change, 3 to destroy.",
LockURL: "lock-url",
RePlanCmd: "re-plan cmd",
ApplyCmd: "apply cmd",
Expand Down
3 changes: 3 additions & 0 deletions server/events/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,9 @@ func (p ProjectResult) IsSuccessful() bool {
type PlanSuccess struct {
// TerraformOutput is the output from Terraform of running plan.
TerraformOutput string
// The last line of a successful terraform plan output that summarizes the changes
// e.g. Plan: 0 to add, 1 to change, 0 to destroy.
ChangeSummary string
// LockURL is the full URL to the lock held by this plan.
LockURL string
// RePlanCmd is the command that users should run to re-plan this project.
Expand Down
13 changes: 13 additions & 0 deletions server/events/project_command_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"fmt"
"os"
"path/filepath"
"regexp"
"strings"

"github.com/pkg/errors"
Expand Down Expand Up @@ -171,9 +172,21 @@ func (p *DefaultProjectCommandRunner) doPlan(ctx models.ProjectCommandContext) (
return nil, "", fmt.Errorf("%s\n%s", err, strings.Join(outputs, "\n"))
}

var summary string
for _, output := range outputs {
for _, line := range strings.Split(strings.TrimSuffix(output, "\n"), "\n") {
matched, _ := regexp.MatchString("(^Plan:|^No changes\\.).*", line)
if matched {
summary = line
break
}
}
}

return &models.PlanSuccess{
LockURL: p.LockURLGenerator.GenerateLockURL(lockAttempt.LockKey),
TerraformOutput: strings.Join(outputs, "\n"),
ChangeSummary: summary,
RePlanCmd: ctx.RePlanCmd,
ApplyCmd: ctx.ApplyCmd,
HasDiverged: hasDiverged,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Ran Plan for 2 projects:
1. dir: `dir2` workspace: `default`

### 1. dir: `dir1` workspace: `default`
Change Summary: `Plan: 1 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down Expand Up @@ -32,6 +33,7 @@ Plan: 1 to add, 0 to change, 0 to destroy.

---
### 2. dir: `dir2` workspace: `default`
Change Summary: `Plan: 1 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Ran Plan for 2 projects:
1. dir: `production` workspace: `default`

### 1. dir: `staging` workspace: `default`
Change Summary: `Plan: 1 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down Expand Up @@ -32,6 +33,7 @@ Plan: 1 to add, 0 to change, 0 to destroy.

---
### 2. dir: `production` workspace: `default`
Change Summary: `Plan: 1 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Ran Plan for dir: `staging` workspace: `default`

Change Summary: `Plan: 1 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Ran Plan for dir: `production` workspace: `default`

Change Summary: `Plan: 1 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Ran Plan for dir: `staging` workspace: `default`

Change Summary: `Plan: 1 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Ran Plan for 2 projects:
1. dir: `.` workspace: `staging`

### 1. dir: `.` workspace: `default`
Change Summary: `Plan: 1 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down Expand Up @@ -36,6 +37,7 @@ postplan custom

---
### 2. dir: `.` workspace: `staging`
Change Summary: `Plan: 1 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Ran Plan for 2 projects:
1. dir: `.` workspace: `staging`

### 1. dir: `.` workspace: `default`
Change Summary: `Plan: 1 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down Expand Up @@ -36,6 +37,7 @@ postplan

---
### 2. dir: `.` workspace: `staging`
Change Summary: `Plan: 1 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Ran Plan for dir: `.` workspace: `new_workspace`

Change Summary: `Plan: 3 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Ran Plan for dir: `.` workspace: `default`

Change Summary: `Plan: 3 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Ran Plan for dir: `.` workspace: `default`

Change Summary: `Plan: 3 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Ran Plan for dir: `.` workspace: `default`

Change Summary: `Plan: 3 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Ran Plan for project: `default` dir: `.` workspace: `default`

Change Summary: `Plan: 1 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Ran Plan for project: `staging` dir: `.` workspace: `default`

Change Summary: `Plan: 1 to add, 0 to change, 0 to destroy.`
<details><summary>Show Output</summary>

```diff
Expand Down
Loading