-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
220 changed files
with
85,736 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
language: go | ||
|
||
sudo: false | ||
|
||
go: | ||
- 1.8 | ||
- tip | ||
|
||
script: | ||
- 'make build' |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2017 Turnbull Press & James Turnbull [email protected] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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 @@ | ||
default: build | ||
|
||
prepare: | ||
go get github.com/tools/godep | ||
godep restore | ||
go get ./... | ||
|
||
test: prepare | ||
go test ./... | ||
|
||
build: test | ||
go build -v | ||
|
||
install: build | ||
mkdir -p ~/.packer.d/plugins | ||
install ./packer-post-processor-slack-notifications ~/.packer.d/plugins/ | ||
|
||
release: test | ||
go get github.com/mitchellh/gox | ||
gox --output 'dist/{{.OS}}_{{.Arch}}/{{.Dir}}' | ||
zip -j releases/packer-post-processor-slack-notifications_darwin_386.zip dist/darwin_386/packer-post-processor-slack-notifications | ||
zip -j releases/packer-post-processor-slack-notifications_darwin_amd64.zip dist/darwin_amd64/packer-post-processor-slack-notifications | ||
zip -j releases/packer-post-processor-slack-notifications_freebsd_386.zip dist/freebsd_386/packer-post-processor-slack-notifications | ||
zip -j releases/packer-post-processor-slack-notifications_freebsd_amd64.zip dist/freebsd_amd64/packer-post-processor-slack-notifications | ||
zip -j releases/packer-post-processor-slack-notifications_freebsd_arm.zip dist/freebsd_arm/packer-post-processor-slack-notifications | ||
zip -j releases/packer-post-processor-slack-notifications_linux_386.zip dist/linux_386/packer-post-processor-slack-notifications | ||
zip -j releases/packer-post-processor-slack-notifications_linux_amd64.zip dist/linux_amd64/packer-post-processor-slack-notifications | ||
zip -j releases/packer-post-processor-slack-notifications_linux_arm.zip dist/linux_arm/packer-post-processor-slack-notifications | ||
zip -j releases/packer-post-processor-slack-notifications_netbsd_386.zip dist/netbsd_386/packer-post-processor-slack-notifications | ||
zip -j releases/packer-post-processor-slack-notifications_netbsd_amd64.zip dist/netbsd_amd64/packer-post-processor-slack-notifications | ||
zip -j releases/packer-post-processor-slack-notifications_netbsd_arm.zip dist/netbsd_arm/packer-post-processor-slack-notifications | ||
zip -j releases/packer-post-processor-slack-notifications_openbsd_386.zip dist/openbsd_386/packer-post-processor-slack-notifications | ||
zip -j releases/packer-post-processor-slack-notifications_openbsd_amd64.zip dist/openbsd_amd64/packer-post-processor-slack-notifications | ||
zip -j releases/packer-post-processor-slack-notifications_windows_386.zip dist/windows_386/packer-post-processor-slack-notifications.exe | ||
zip -j releases/packer-post-processor-slack-notifications_windows_amd64.zip dist/windows_amd64/packer-post-processor-slack-notifications.exe | ||
|
||
clean: | ||
rm -rf dist/ | ||
rm -f releases/*.zip | ||
|
||
.PHONY: default prepare test build install release clean |
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,103 @@ | ||
# packer-post-processor-slack-notifications | ||
|
||
[![Build Status](https://travis-ci.org/turnbullpress/packer-post-processor-slack-notifications.svg?branch=master)](https://travis-ci.org/turnbullpress/packer-post-processor-slack-notifications) | ||
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE) | ||
|
||
Packer post-processor plugin for Slack notifications | ||
|
||
## Description | ||
The Packer Slack Notification post-processor assists you in sending Slack notifications when a build is complete. | ||
|
||
## Installation | ||
Packer supports plugins. Please read document the following: | ||
https://www.packer.io/docs/extend/plugins.html | ||
|
||
You can download binaries built for your architecture from [latest releases](https://github.com/turnbullpress/packer-post-processor-slack-notifications/releases/latest). | ||
|
||
## Usage | ||
The following example `template.json`: | ||
|
||
``` | ||
{ | ||
"builders": [{ | ||
"type": "amazon-ebs", | ||
"region": "us-east-1", | ||
"source_ami": "ami-6869aa05", | ||
"instance_type": "t2.micro", | ||
"ssh_username": "ec2-user", | ||
"ssh_pty": "true", | ||
"ami_name": "packer-example {{timestamp}}" | ||
}], | ||
"provisioners":[{ | ||
"type": "shell", | ||
"inline": [ | ||
"echo 'running...'" | ||
] | ||
}], | ||
"post-processors":[{ | ||
"type": "slack-notifications", | ||
"channel": "general", | ||
"url": "https://slackwebhook.url/slackwebhookid" | ||
}] | ||
} | ||
``` | ||
|
||
### Configuration | ||
|
||
Type: `slack-notifications` | ||
|
||
Required: | ||
- `channel` (string) | ||
- The channel to which to send the notification. | ||
- `url` (string) | ||
- The Slack Webhook URL | ||
|
||
## Developing Plugin | ||
|
||
If you wish to build this plugin on your environment, you can use GNU Make build system. | ||
But this Makefile depends on [Go](https://golang.org/). At First, you should install Go. | ||
And we use [godep](https://github.com/tools/godep) for dependency management. Please looks the [reference](https://godoc.org/github.com/tools/godep) | ||
|
||
### Run Test | ||
``` | ||
make test | ||
go get github.com/tools/godep | ||
godep restore | ||
go get ./... | ||
go test ./... | ||
? github.com/turnbullpress/packer-post-processor-slack-notifications [no test files] | ||
? github.com/turnbullpress/packer-post-processor-slack-notifications/plugin 0.029s | ||
``` | ||
Run the unit tests when developing changes to the plugin. | ||
|
||
### Installation | ||
``` | ||
make install | ||
go get github.com/tools/godep | ||
godep restore | ||
go get ./... | ||
go test ./... | ||
? github.com/turnbullpress/packer-post-processor-slack-notifications [no test files] | ||
? github.com/turnbullpress/packer-post-processor-slack-notifications/plugin 0.023s | ||
go build ./ | ||
mkdir -p ~/.packer.d/plugins | ||
install ./packer-post-processor-slack-notifications ~/.packer.d/plugins/ | ||
``` | ||
Run tests, build and move the compiled plugin to the plugin directory. | ||
|
||
### Release | ||
``` | ||
make release | ||
go get github.com/tools/godep | ||
godep restore | ||
go get ./... | ||
go test ./... | ||
? github.com/turnbullpress/packer-post-processor-slack-notifications [no test files] | ||
github.com/turnbullpress/packer-post-processor-slack-notifications/plugin 0.020s | ||
... | ||
go get github.com/mitchellh/gox | ||
gox --output 'dist/{{.OS}}_{{.Arch}}/{{.Dir}}' | ||
... | ||
``` | ||
|
||
Run tests, build for each architecture and archive binaries. |
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
Oops, something went wrong.