Skip to content
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ conform.
[metadata](http://concourse.ci/implementing-resources.html#resource-metadata)
in the status will be evaluated prior to sending the tweet. Use `media` to
include references to photos or video
* or `statusFile`: A file (generated by your task) that contains the text to tweet.

##### Optional:
* `media`: An array of paths to images or video to upload. Any media referenced
Expand Down
6 changes: 5 additions & 1 deletion ci/tasks/build-resource.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
---
platform: linux

image: docker:///golang#1.6-alpine
image_resource:
type: docker-image
source:
repository: golang
tag: 1.6-alpine

inputs:
- name: source-code
Expand Down
13 changes: 12 additions & 1 deletion cmd/out/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,19 @@ func main() {
concourse.Sayf("Upload of %v complete\n", imageFile)
}

statusText := request.Params.Status
if request.Params.StatusFile != "" {
statusFileContent, fileErr := ioutil.ReadFile(path.Join(workingDir, request.Params.StatusFile))
if fileErr != nil {
concourse.Fatal("Error reading file: %v\n", fileErr)
} else {
statusText = string(statusFileContent)
}

}

// expand any variables
statusText := os.ExpandEnv(request.Params.Status)
statusText = os.ExpandEnv(statusText)
concourse.Sayf("Posting tweet '%s'\n", statusText)

output := concourse.OutResponse{}
Expand Down
1 change: 1 addition & 0 deletions concourse/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type MetadataPair struct {

type OutParams struct {
Status string `json:"status"`
StatusFile string `json:"statusFile"`
Media []string `json:"media,omitempty"`
}

Expand Down