mirror of
https://github.com/harness-community/drone-email.git
synced 2026-06-16 14:50:28 +08:00
Compare commits
8 Commits
v3.0.3-debug
...
v4.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 40a9df7a10 | |||
| 5b0a93b192 | |||
| b4bc696ee8 | |||
| 62bbef39fa | |||
| 75db7ad3f8 | |||
| f5c31387a1 | |||
| 99df93e082 | |||
| 77bf8220a3 |
@@ -73,6 +73,55 @@ drone secret add \
|
|||||||
|
|
||||||
See [Secret Guide](https://docs.drone.io/secret/) for additional information on secrets.
|
See [Secret Guide](https://docs.drone.io/secret/) for additional information on secrets.
|
||||||
|
|
||||||
|
### Harness CI Plugin Step
|
||||||
|
|
||||||
|
When using this plugin in Harness CI pipelines, you can configure it as a Plugin step. The plugin automatically uses DRONE_* environment variables provided by the Harness CI environment for build context (repository, commit, build status, etc.).
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
pipeline:
|
||||||
|
orgIdentifier: default
|
||||||
|
tags: {}
|
||||||
|
stages:
|
||||||
|
- stage:
|
||||||
|
name: Run Plugin
|
||||||
|
identifier: Email_Notification
|
||||||
|
description: ""
|
||||||
|
type: CI
|
||||||
|
spec:
|
||||||
|
cloneCodebase: false
|
||||||
|
platform:
|
||||||
|
os: Windows
|
||||||
|
arch: Amd64
|
||||||
|
runtime:
|
||||||
|
type: Cloud
|
||||||
|
spec: {}
|
||||||
|
execution:
|
||||||
|
steps:
|
||||||
|
- step:
|
||||||
|
type: Plugin
|
||||||
|
name: Email Plugin
|
||||||
|
identifier: Email_Plugin
|
||||||
|
spec:
|
||||||
|
connectorRef: emailtestdocker
|
||||||
|
image: plugins/email:3.1.0-debug
|
||||||
|
settings:
|
||||||
|
from.address: from@example.com
|
||||||
|
from.name: Magic Elves
|
||||||
|
host: sandbox.smtp.mailtrap.io
|
||||||
|
username: <+secrets.getValue("smtp_username")>
|
||||||
|
password: <+secrets.getValue("smtp_password")>
|
||||||
|
recipients: user@example.com
|
||||||
|
port: "2525"
|
||||||
|
caching:
|
||||||
|
enabled: false
|
||||||
|
paths: []
|
||||||
|
buildIntelligence:
|
||||||
|
enabled: false
|
||||||
|
projectIdentifier: example_project
|
||||||
|
identifier: email_notification_pipeline
|
||||||
|
name: Email Notification Pipeline
|
||||||
|
```
|
||||||
|
|
||||||
### Custom Templates
|
### Custom Templates
|
||||||
|
|
||||||
In some cases you may want to customize the look and feel of the email message
|
In some cases you may want to customize the look and feel of the email message
|
||||||
|
|||||||
+2
-2
@@ -191,7 +191,7 @@ const DefaultTemplate = `
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<table class="main" width="100%" cellpadding="0" cellspacing="0">
|
<table class="main" width="100%" cellpadding="0" cellspacing="0">
|
||||||
<tr>
|
<tr>
|
||||||
{{#success build.status}}
|
{{#equal build.status "success"}}
|
||||||
<td class="alert alert-good">
|
<td class="alert alert-good">
|
||||||
<a href="{{ build.link }}">
|
<a href="{{ build.link }}">
|
||||||
Successful build #{{ build.number }}
|
Successful build #{{ build.number }}
|
||||||
@@ -203,7 +203,7 @@ const DefaultTemplate = `
|
|||||||
Failed build #{{ build.number }}
|
Failed build #{{ build.number }}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
{{/success}}
|
{{/equal}}
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="content-wrap">
|
<td class="content-wrap">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ FROM golang:1.24-alpine as builder
|
|||||||
WORKDIR /go/src/drone-email
|
WORKDIR /go/src/drone-email
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=0 go build
|
RUN GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build
|
||||||
|
|
||||||
FROM alpine:3.20
|
FROM alpine:3.20
|
||||||
|
|
||||||
|
|||||||
@@ -394,8 +394,8 @@ func run(c *cli.Context) error {
|
|||||||
Job: Job{
|
Job: Job{
|
||||||
Status: c.String("job.status"),
|
Status: c.String("job.status"),
|
||||||
ExitCode: c.Int("job.exitCode"),
|
ExitCode: c.Int("job.exitCode"),
|
||||||
Started: c.Int64("job.started"),
|
Started: float64(c.Int64("job.started")),
|
||||||
Finished: c.Int64("job.finished"),
|
Finished: float64(c.Int64("job.finished")),
|
||||||
},
|
},
|
||||||
Yaml: Yaml{
|
Yaml: Yaml{
|
||||||
Signed: c.Bool("yaml.signed"),
|
Signed: c.Bool("yaml.signed"),
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ type (
|
|||||||
Job struct {
|
Job struct {
|
||||||
Status string
|
Status string
|
||||||
ExitCode int
|
ExitCode int
|
||||||
Started int64
|
Started float64
|
||||||
Finished int64
|
Finished float64
|
||||||
}
|
}
|
||||||
|
|
||||||
Yaml struct {
|
Yaml struct {
|
||||||
@@ -185,10 +185,13 @@ func (p Plugin) Exec() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle STARTTLS policy
|
// Handle STARTTLS policy
|
||||||
|
// Note: Use WithTLSPolicy (not WithTLSPortPolicy) to avoid overriding
|
||||||
|
// the user-configured port. WithTLSPortPolicy treats port 25 as "default/unset"
|
||||||
|
// and silently changes it to 587 for TLSOpportunistic/TLSMandatory.
|
||||||
if p.Config.NoStartTLS {
|
if p.Config.NoStartTLS {
|
||||||
options = append(options, mail.WithTLSPortPolicy(mail.NoTLS))
|
options = append(options, mail.WithTLSPolicy(mail.NoTLS))
|
||||||
} else {
|
} else {
|
||||||
options = append(options, mail.WithTLSPortPolicy(mail.TLSOpportunistic))
|
options = append(options, mail.WithTLSPolicy(mail.TLSOpportunistic))
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := mail.NewClient(p.Config.Host, options...)
|
client, err := mail.NewClient(p.Config.Host, options...)
|
||||||
|
|||||||
Reference in New Issue
Block a user