Skip to content

Commit

Permalink
upday copyright year, change emails to fake ones, update debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
kaymckay committed Jan 19, 2022
1 parent dffe96d commit ffc5cbc
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ further defined and clarified by project maintainers.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at
[TTS-OpenSource-Office@target.com](mailto:TTS-OpenSource-Office@target.com). All
[opensource@target.com](mailto:opensource@target.com). All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand Down
2 changes: 1 addition & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Please see our [support](SUPPORT.md) documentation for further instructions.
## Copyright and License

```
Copyright (c) 2021 Target Brands, Inc.
Copyright (c) 2022 Target Brands, Inc.
```

[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (c) 2021 Target Brands, Inc. All rights reserved.
# Copyright (c) 2022 Target Brands, Inc. All rights reserved.
#
# Use of this source code is governed by the LICENSE file in this repository.

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work.
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright (c) 2021 Target Brands, Inc.
Copyright (c) 2022 Target Brands, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (c) 2021 Target Brands, Inc. All rights reserved.
# Copyright (c) 2022 Target Brands, Inc. All rights reserved.
#
# Use of this source code is governed by the LICENSE file in this repository.

Expand Down
2 changes: 1 addition & 1 deletion cmd/vela-email/defaults.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Target Brands, Inc. All rights reserved.
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.

Expand Down
2 changes: 1 addition & 1 deletion cmd/vela-email/loginauth.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Target Brands, Inc. All rights reserved.
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.

Expand Down
4 changes: 2 additions & 2 deletions cmd/vela-email/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Target Brands, Inc. All rights reserved.
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.

Expand Down Expand Up @@ -36,7 +36,7 @@ func main() {
Name: "vela-email",
HelpName: "vela-email",
Usage: "Vela Email plugin for sending Vela build information to a user's email.",
Copyright: "Copyright (c) 2021 Target Brands, Inc. All rights reserved.",
Copyright: "Copyright (c) 2022 Target Brands, Inc. All rights reserved.",
Authors: []*cli.Author{
{
Name: "Vela Admins",
Expand Down
16 changes: 8 additions & 8 deletions cmd/vela-email/plugin.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Target Brands, Inc. All rights reserved.
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.

Expand Down Expand Up @@ -169,27 +169,27 @@ func (p *Plugin) Exec() error {
logrus.Trace("entered plugin.Execute")
defer logrus.Trace("exited plugin.Execute")

logrus.Info("Parsing Subject...")
logrus.Debug("Parsing Subject...")
subject, err := p.injectEnv(p.Email.Subject)
if err != nil {
return err
}
p.Email.Subject = subject

if len(p.Email.HTML) > 0 {
logrus.Info("Parsing HTML...")
logrus.Debug("Parsing HTML...")
body, err := p.injectEnv(string(p.Email.HTML))
if err != nil {
return err
}
logrus.Info("Parsing CSS...")
logrus.Debug("Parsing CSS...")
body, err = inliner.Inline(body)
if err != nil {
return err
}
p.Email.HTML = []byte(body)
} else {
logrus.Info("Parsing Text...")
logrus.Debug("Parsing Text...")
body, err := p.injectEnv(string(p.Email.Text))
if err != nil {
return err
Expand All @@ -215,19 +215,19 @@ func (p *Plugin) Exec() error {
case "starttls":
logrus.Info("Sending email with StartTLS...")
if err := p.Email.SendWithStartTLS(host, auth, p.TLSConfig); err != nil {
return fmt.Errorf("error sending with StartTLS: %v", err)
return fmt.Errorf("error sending with StartTLS: %w", err)
}
case "tls":
logrus.Info("Sending email with TLS...")
if err := p.Email.SendWithTLS(host, auth, p.TLSConfig); err != nil {
return fmt.Errorf("error sending with TLS: %v", err)
return fmt.Errorf("error sending with TLS: %w", err)
}
case "plain":
fallthrough
default:
logrus.Info("Sending email with Plain...")
if err := p.Email.Send(host, auth); err != nil {
return fmt.Errorf("error sending with Plain: %v", err)
return fmt.Errorf("error sending with Plain: %w", err)
}
}

Expand Down
40 changes: 20 additions & 20 deletions cmd/vela-email/plugin_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Target Brands, Inc. All rights reserved.
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
package main
Expand All @@ -15,8 +15,8 @@ import (

var (
mockEmail = &email.Email{
To: []string{"one@mail.com"},
From: "two@mail.com",
To: []string{"fakemail1@example.com"},
From: "fakemail2@example.com",
}

mockSMTPHost = &SMTPHost{
Expand Down Expand Up @@ -76,8 +76,8 @@ func TestValidateSuccess(t *testing.T) {
name: "return no errors: multiple To emails",
parameters: Plugin{
Email: &email.Email{
To: []string{"one@gmail.com", "[email protected]"},
From: "three@email.com",
To: []string{"fakemail1@example.com", "[email protected]"},
From: "fakemail3@example.com",
},
SMTPHost: mockSMTPHost,
Attachment: noAttachment,
Expand All @@ -87,8 +87,8 @@ func TestValidateSuccess(t *testing.T) {
name: "return no errors: no username or password",
parameters: Plugin{
Email: &email.Email{
To: []string{"one@gmail.com", "[email protected]"},
From: "three@email.com",
To: []string{"fakemail1@example.com", "[email protected]"},
From: "fakemail3@example.com",
},
SMTPHost: &SMTPHost{
Host: "smtphost.com",
Expand All @@ -101,11 +101,11 @@ func TestValidateSuccess(t *testing.T) {
name: "return no errors: extra email parameters",
parameters: Plugin{
Email: &email.Email{
To: []string{"one@gmail.com", "[email protected]"},
From: "three@email.com",
ReplyTo: []string{"first.last@email.com"},
Bcc: []string{"first.last@email.com"},
Cc: []string{"first.last@email.com"},
To: []string{"fakemail1@example.com", "[email protected]"},
From: "fakemail3@example.com",
ReplyTo: []string{"fakemail@example.com"},
Bcc: []string{"fakemail@example.com"},
Cc: []string{"fakemail@example.com"},
Subject: "subject",
Text: []byte(""),
HTML: []byte(""),
Expand Down Expand Up @@ -150,7 +150,7 @@ func TestValidateErrors(t *testing.T) {
name: "To missing",
parameters: Plugin{
Email: &email.Email{
From: "two@email.com",
From: "fakemail@example.com",
},
Attachment: noAttachment,
},
Expand All @@ -160,7 +160,7 @@ func TestValidateErrors(t *testing.T) {
name: "From missing",
parameters: Plugin{
Email: &email.Email{
To: []string{"one@email.com"},
To: []string{"fakemail@example.com"},
},
Attachment: noAttachment,
},
Expand Down Expand Up @@ -246,8 +246,8 @@ func TestInjectEnvSuccess(t *testing.T) {
name: "email using default subject and user text",
parameters: Plugin{
Email: &email.Email{
To: []string{"one@gmail.com", "[email protected]"},
From: "three@email.com",
To: []string{"fakemail1@example.com", "[email protected]"},
From: "fakemail3@example.com",
Subject: DefaultSubject,
Text: []byte("This is some text for repo: {{ .VELA_REPO_FULL_NAME }}"),
},
Expand All @@ -260,8 +260,8 @@ func TestInjectEnvSuccess(t *testing.T) {
name: "email using user subject and html",
parameters: Plugin{
Email: &email.Email{
To: []string{"one@gmail.com", "[email protected]"},
From: "three@email.com",
To: []string{"fakemail1@example.com", "[email protected]"},
From: "fakemail3@example.com",
Subject: "Commit failure on vela build: {{ .VELA_BUILD_NUMBER }}",
Text: []byte("This is some text for repo: {{ .VELA_REPO_FULL_NAME }}"),
},
Expand Down Expand Up @@ -315,8 +315,8 @@ func TestInjectEnvBadVar(t *testing.T) {
name: "error: using environment variable that doesnt exist",
parameters: Plugin{
Email: &email.Email{
To: []string{"one@gmail.com", "[email protected]"},
From: "three@email.com",
To: []string{"fakemail1@example.com", "[email protected]"},
From: "fakemail3@example.com",
Subject: "This is a bad subject {{ .SOME_OTHER_VARIABLE }}",
},
SMTPHost: mockSMTPHost,
Expand Down
2 changes: 1 addition & 1 deletion cmd/vela-email/testdata/example1.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
From: [email protected]
To: emailone@email.com, emailtwo@email.com
To: fakemail1@example.com, fakemail2@example.com
Subject: Vela Pipeline for {{ .VELA_REPO_FULL_NAME }} {{ .VELA_BUILD_BRANCH }}
Content-Type: text/plain

Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Target Brands, Inc. All rights reserved.
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.

Expand Down

0 comments on commit ffc5cbc

Please sign in to comment.