-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from tphoney/DRON-166
(DRON-166) adding adaptive card. minor fixes
- Loading branch information
Showing
13 changed files
with
307 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
release/ | ||
drone-jira | ||
NOTES* | ||
output.json | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"pipeline": "drone", | ||
"instance": "droneio", | ||
"project": "TT", | ||
"state": "unknown", | ||
"version": "8f51ad7884c5eb69c11d260a31da7a745e6b78e2", | ||
"environment": "production", | ||
"url": "https://droneio.atlassian.net/browse/TT-1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
{ | ||
"type": "AdaptiveCard", | ||
"body": [ | ||
{ | ||
"type": "ColumnSet", | ||
"columns": [ | ||
{ | ||
"type": "Column", | ||
"items": [ | ||
{ | ||
"type": "Image", | ||
"url": "https://drone.github.io/drone-jira/jira.png", | ||
"size": "small" | ||
} | ||
], | ||
"width": "auto" | ||
}, | ||
{ | ||
"type": "Column", | ||
"items": [ | ||
{ | ||
"type": "TextBlock", | ||
"text": "Plugin: Jira", | ||
"wrap": true, | ||
"size": "small", | ||
"weight": "bolder", | ||
"isSubtle": false, | ||
"spacing": "small" | ||
}, | ||
{ | ||
"type": "TextBlock", | ||
"text": "Project: ${project}", | ||
"wrap": true, | ||
"size": "Small", | ||
"weight": "Lighter", | ||
"isSubtle": true, | ||
"spacing": "Small" | ||
} | ||
], | ||
"width": "stretch" | ||
} | ||
], | ||
"style": "default" | ||
}, | ||
{ | ||
"type": "ColumnSet", | ||
"style": "default", | ||
"separator": true, | ||
"columns": [ | ||
{ | ||
"type": "Column", | ||
"items": [ | ||
{ | ||
"type": "TextBlock", | ||
"text": "Pipeline:", | ||
"wrap": true, | ||
"size": "small", | ||
"weight": "bolder", | ||
"isSubtle": false, | ||
"spacing": "small" | ||
}, | ||
{ | ||
"type": "TextBlock", | ||
"text": "Environment:", | ||
"wrap": true, | ||
"size": "small", | ||
"weight": "bolder", | ||
"isSubtle": false, | ||
"spacing": "small" | ||
}, | ||
{ | ||
"type": "TextBlock", | ||
"text": "Instance:", | ||
"wrap": true, | ||
"size": "small", | ||
"weight": "bolder", | ||
"isSubtle": false, | ||
"spacing": "small" | ||
}, | ||
{ | ||
"type": "TextBlock", | ||
"text": "State:", | ||
"wrap": true, | ||
"size": "small", | ||
"weight": "bolder", | ||
"isSubtle": false, | ||
"spacing": "small" | ||
}, | ||
{ | ||
"type": "TextBlock", | ||
"text": "Version:", | ||
"wrap": true, | ||
"size": "small", | ||
"weight": "bolder", | ||
"isSubtle": false, | ||
"spacing": "small" | ||
} | ||
], | ||
"width": "auto" | ||
}, | ||
{ | ||
"type": "Column", | ||
"items": [ | ||
{ | ||
"type": "TextBlock", | ||
"text": "${pipeline}", | ||
"wrap": true, | ||
"size": "small", | ||
"weight": "default", | ||
"isSubtle": false, | ||
"spacing": "small" | ||
}, | ||
{ | ||
"type": "TextBlock", | ||
"text": "${environment}", | ||
"wrap": true, | ||
"size": "small", | ||
"weight": "default", | ||
"isSubtle": false, | ||
"spacing": "small" | ||
}, | ||
{ | ||
"type": "TextBlock", | ||
"text": "${instance}", | ||
"wrap": true, | ||
"size": "small", | ||
"weight": "default", | ||
"isSubtle": false, | ||
"spacing": "small" | ||
}, | ||
{ | ||
"type": "TextBlock", | ||
"text": "${state}", | ||
"wrap": true, | ||
"size": "small", | ||
"weight": "default", | ||
"isSubtle": false, | ||
"spacing": "small" | ||
}, | ||
{ | ||
"type": "TextBlock", | ||
"text": "${version}", | ||
"wrap": true, | ||
"size": "small", | ||
"weight": "default", | ||
"isSubtle": false, | ||
"spacing": "small" | ||
} | ||
], | ||
"width": "auto" | ||
} | ||
] | ||
} | ||
], | ||
"actions": [ | ||
{ | ||
"type": "Action.OpenUrl", | ||
"title": "Open in Jira", | ||
"url": "${url}" | ||
} | ||
], | ||
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json", | ||
"version": "1.4" | ||
} |
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
module github.com/drone/drone-jira | ||
|
||
go 1.12 | ||
go 1.17 | ||
|
||
require ( | ||
github.com/joho/godotenv v1.3.0 | ||
github.com/drone/drone-go v1.7.1 | ||
github.com/kelseyhightower/envconfig v1.4.0 | ||
github.com/sirupsen/logrus v1.4.2 | ||
) | ||
|
||
require ( | ||
github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect | ||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
github.com/99designs/httpsignatures-go v0.0.0-20170731043157-88528bf4ca7e/go.mod h1:Xa6lInWHNQnuWoF0YPSsx+INFA9qk7/7pTjwb3PInkY= | ||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= | ||
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= | ||
github.com/drone/drone-go v1.7.1 h1:ZX+3Rs8YHUSUQ5mkuMLmm1zr1ttiiE2YGNxF3AnyDKw= | ||
github.com/drone/drone-go v1.7.1/go.mod h1:fxCf9jAnXDZV1yDr0ckTuWd1intvcQwfJmTRpTZ1mXg= | ||
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= | ||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= | ||
github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= | ||
github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= | ||
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= | ||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= | ||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= | ||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= | ||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= | ||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc= | ||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package plugin | ||
|
||
import ( | ||
"encoding/base64" | ||
"encoding/json" | ||
"io" | ||
"io/ioutil" | ||
"os" | ||
|
||
"github.com/drone/drone-go/drone" | ||
) | ||
|
||
func (args Args) writeCard(data Card) error { | ||
result, _ := json.Marshal(data) | ||
card := drone.CardInput{ | ||
Schema: "https://drone.github.io/drone-jira/card.json", | ||
Data: result, | ||
} | ||
writeCard(args.CardFilePath, &card) | ||
return nil | ||
} | ||
|
||
func writeCard(path string, card interface{}) { | ||
data, _ := json.Marshal(card) | ||
switch { | ||
case path == "/dev/stdout": | ||
writeCardTo(os.Stdout, data) | ||
case path == "/dev/stderr": | ||
writeCardTo(os.Stderr, data) | ||
case path != "": | ||
ioutil.WriteFile(path, data, 0644) | ||
} | ||
} | ||
|
||
func writeCardTo(out io.Writer, data []byte) { | ||
encoded := base64.StdEncoding.EncodeToString(data) | ||
io.WriteString(out, "\u001B]1338;") | ||
io.WriteString(out, encoded) | ||
io.WriteString(out, "\u001B]0m") | ||
io.WriteString(out, "\n") | ||
} |
Oops, something went wrong.