initial support for webhooks
This commit is contained in:
commit
3a40fd8642
|
@ -0,0 +1 @@
|
|||
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.RYjWhWGAPaYxs3_3gTWujJs4vSnEhLUYPwAkquFYeX0K7f-roO_LgxjDMTcNDW-_a8znx2Qhao-vuyJzeuLPP7gzukSJlWLXFSxv3lzSAvqYCZmE1LGZdlTtJzZ1jpVj8M6hA4CjU4ucyb0Qu9lG1NI47sCKWJXo7X7H8jPGyeOB1M7mMglHQwR5vfXdX5Pqa08BbXuFmOVMu-nk8H2-Kebiwgzff7zZDyDrXDCWl3ftq5k6inz732tyJJeD7PXIw-P1VWxbR1RQLtavw_czZLQbTp0RgN8EAIFkKMzujFxXFvB73616Wm0xm0b8Wq18NtbShy85rLeN7uJ44Q4xng.kMyqEzdrmjkumKZz.U5gVeL_FaounM0UI9syGkE9MUr8qjwSihR9Oijm9H2vq8WIo8pMBxjraXn3LsXQOp4ZescDZJ88EukUXtC0eGfkOoIDI0oK9VZdmTeDMcqLNMHYtYVABdCpb_pv-_njepaTowBY0f--WtGsynv8OfAOYqPZLsbHXBocu0BkjSzvhMbNwVS10ZV4NMoXGGVsnY2QGr4AcZDz6zFnMa-L5PAlbHdCwalhYuXSEb5pW0OL3L6weErMeTwwgLVhy5jRRbtWqk8PKd2qITWsLYcM1uOwOr9kuUs-0Nchzp94kOyxyQ2gMLo6kEJf3tOJAWJ7_ku0F8wfDneOSjLezDWyx55F-KthfYiAlJiY3p5zkZL3TxnLhCmhOPDrri6sRMFqqznFTxQ.qkFXBxmHY0Ny_cbn-26pgA
|
|
@ -0,0 +1,30 @@
|
|||
build:
|
||||
image: golang:1.5
|
||||
environment:
|
||||
- GO15VENDOREXPERIMENT=1
|
||||
- GOOS=linux
|
||||
- GOARCH=amd64
|
||||
- CGO_ENABLED=0
|
||||
commands:
|
||||
- go get
|
||||
- go build
|
||||
- go test
|
||||
|
||||
publish:
|
||||
docker:
|
||||
username: drone
|
||||
password: $$DOCKER_PASS
|
||||
email: $$DOCKER_EMAIL
|
||||
repo: plugins/drone-webhook
|
||||
when:
|
||||
branch: master
|
||||
|
||||
plugin:
|
||||
name: Webhook
|
||||
desc: Send webhook notifications when your build completes.
|
||||
type: notify
|
||||
image: plugins/drone-webhook
|
||||
labels:
|
||||
- rest
|
||||
- json
|
||||
- hook
|
|
@ -0,0 +1 @@
|
|||
drone-webhook
|
|
@ -0,0 +1,60 @@
|
|||
Use the Webhook plugin to notify services via Webhook when a build completes.
|
||||
You will need to supply Drone with outgoing Webhook URLs.
|
||||
|
||||
The following parameters are used to configure outgoing Webhooks:
|
||||
|
||||
* `urls` - JSON payloads are sent to each URL listed here
|
||||
|
||||
The following is a sample Webhook configuration in your .drone.yml file:
|
||||
|
||||
```yaml
|
||||
notify:
|
||||
webhook:
|
||||
urls:
|
||||
- https://your.webhook/...
|
||||
- https://your.other.webhook/...
|
||||
```
|
||||
|
||||
The following is an example Webhook payload (whitespace added):
|
||||
|
||||
```json
|
||||
{
|
||||
"build": {
|
||||
"author": "johnsmith",
|
||||
"author_avatar": "",
|
||||
"author_email": "john.smith@gmail.com",
|
||||
"branch": "master",
|
||||
"commit": "9f2849d5",
|
||||
"created_at": 0,
|
||||
"enqueued_at": 0,
|
||||
"event": "",
|
||||
"finished_at": 1421029813,
|
||||
"link_url": "",
|
||||
"message": "Update the Readme",
|
||||
"number": 22,
|
||||
"ref": "",
|
||||
"refspec": "",
|
||||
"remote": "",
|
||||
"started_at": 1421029603,
|
||||
"status": "success",
|
||||
"timestamp": 0,
|
||||
"title": ""
|
||||
},
|
||||
"repo": {
|
||||
"allow_deploys": false,
|
||||
"allow_pr": false,
|
||||
"allow_push": false,
|
||||
"allow_tags": false,
|
||||
"avatar_url": "",
|
||||
"clone_url": "",
|
||||
"default_branch": "",
|
||||
"full_name": "foo/bar",
|
||||
"link_url": "",
|
||||
"name": "bar",
|
||||
"owner": "foo",
|
||||
"private": false,
|
||||
"timeout": 0,
|
||||
"trusted": false
|
||||
}
|
||||
}
|
||||
```
|
|
@ -0,0 +1,9 @@
|
|||
# Docker image for Drone's webhook notification plugin
|
||||
#
|
||||
# CGO_ENABLED=0 go build -a -tags netgo
|
||||
# docker build --rm=true -t plugins/drone-webhook .
|
||||
|
||||
FROM gliderlabs/alpine:3.1
|
||||
RUN apk-install ca-certificates
|
||||
ADD drone-webhook /bin/
|
||||
ENTRYPOINT ["/bin/drone-webhook"]
|
|
@ -0,0 +1,202 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
# drone-webhook
|
||||
Drone plugin for sending Webhook notifications by [@chromakode](https://github.com/chromakode).
|
||||
|
||||
## Overview
|
||||
|
||||
This plugin is responsible for sending build notifications via Webhooks:
|
||||
|
||||
```sh
|
||||
./drone-webhooks <<EOF
|
||||
{
|
||||
"repo" : {
|
||||
"owner": "foo",
|
||||
"name": "bar",
|
||||
"full_name": "foo/bar"
|
||||
},
|
||||
"build" : {
|
||||
"number": 22,
|
||||
"status": "success",
|
||||
"started_at": 1421029603,
|
||||
"finished_at": 1421029813,
|
||||
"commit": "9f2849d5",
|
||||
"branch": "master",
|
||||
"message": "Update the Readme",
|
||||
"author": "johnsmith",
|
||||
"author_email": "john.smith@gmail.com"
|
||||
},
|
||||
"vargs": {
|
||||
"urls": [ "https://your.webhook/..." ]
|
||||
}
|
||||
}
|
||||
EOF
|
||||
```
|
||||
|
||||
## Docker
|
||||
|
||||
Build the Docker container. Note that we need to use the `-netgo` tag so that
|
||||
the binary is built without a CGO dependency:
|
||||
|
||||
```sh
|
||||
CGO_ENABLED=0 go build -a -tags netgo
|
||||
docker build --rm=true -t plugins/drone-webhook .
|
||||
```
|
||||
|
||||
Send a Webhook notification:
|
||||
|
||||
```sh
|
||||
docker run -i plugins/drone-webhook <<EOF
|
||||
{
|
||||
"repo" : {
|
||||
"owner": "foo",
|
||||
"name": "bar",
|
||||
"full_name": "foo/bar"
|
||||
},
|
||||
"build" : {
|
||||
"number": 22,
|
||||
"status": "success",
|
||||
"started_at": 1421029603,
|
||||
"finished_at": 1421029813,
|
||||
"commit": "9f2849d5",
|
||||
"branch": "master",
|
||||
"message": "Update the Readme",
|
||||
"author": "johnsmith",
|
||||
"author_email": "john.smith@gmail.com"
|
||||
},
|
||||
"vargs": {
|
||||
"urls": [ "https://your.webhook/..." ]
|
||||
}
|
||||
}
|
||||
EOF
|
||||
```
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xml:space="preserve"
|
||||
enable-background="new 0 0 431.45 120.114"
|
||||
viewBox="0 0 255.99999 256"
|
||||
height="256"
|
||||
width="256"
|
||||
y="0px"
|
||||
x="0px"
|
||||
id="Layer_1"
|
||||
version="1.1"><metadata
|
||||
id="metadata4260"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs4258" /><path
|
||||
d="m 119.97568,108.73039 c -10.64899,17.9011 -20.85155,35.23671 -31.26641,52.44137 -2.674649,4.41674 -3.998084,8.01402 -1.861143,13.6292 5.89891,15.51018 -2.422659,30.60369 -18.063798,34.70099 -14.750251,3.86514 -29.121527,-5.82947 -32.048164,-21.6214 -2.593298,-13.97842 8.254108,-27.68103 23.665085,-29.86559 1.291688,-0.18453 2.609171,-0.20635 4.779842,-0.36905 7.551716,-12.66292 15.287959,-25.63338 23.442859,-39.31019 C 73.879653,103.67475 65.10371,86.535567 67.046204,65.299095 68.419243,50.286936 74.322121,37.314493 85.111987,26.681376 105.77702,6.3199193 137.30335,3.0222443 161.63512,18.651478 c 23.36943,15.012159 34.072,44.254719 24.94882,69.282922 -6.87908,-1.865111 -13.80578,-3.746095 -21.42099,-5.811606 2.86513,-13.914919 0.74605,-26.411164 -8.63904,-37.115711 -6.2005,-7.067579 -14.15698,-10.772007 -23.20475,-12.13711 -18.13722,-2.740126 -35.94506,8.91285 -41.22888,26.714739 -5.998118,20.204709 3.079417,36.708954 27.8854,49.145678 z"
|
||||
id="path4232"
|
||||
style="clip-rule:evenodd;fill:#c73a63;fill-rule:evenodd" /><path
|
||||
d="m 150.3869,87.561378 c 7.50212,13.234362 15.11931,26.669112 22.66904,39.980842 38.15938,-11.80575 66.92971,9.31762 77.25131,31.93309 12.46649,27.31791 3.94451,59.67362 -20.54003,76.52708 -25.13138,17.30189 -56.91367,14.34548 -79.17991,-7.8791 5.67469,-4.75008 11.37718,-9.52198 17.47053,-14.61929 21.99243,14.24429 41.22689,13.57364 55.50689,-3.29371 12.1768,-14.38914 11.91291,-35.84386 -0.61707,-49.93141 -14.46056,-16.25622 -33.82994,-16.75226 -57.24303,-1.14684 -9.71248,-17.23045 -19.59359,-34.32399 -28.99851,-51.67944 -3.17069,-5.84931 -6.67274,-9.242224 -13.81968,-10.480354 -11.93671,-2.06947 -19.64319,-12.319647 -20.1055,-23.80397 -0.45438,-11.357336 6.23622,-21.623383 16.69473,-25.623451 10.3593,-3.962369 22.51625,-0.763901 29.48462,8.043787 5.69454,7.196551 7.5041,15.295896 4.50801,24.171047 -0.83334,2.474248 -1.91272,4.869129 -3.0814,7.801719 z"
|
||||
id="path4234"
|
||||
style="clip-rule:evenodd;fill:#4b4b4b;fill-rule:evenodd" /><path
|
||||
d="m 168.31777,195.7537 c -15.08955,0 -30.23465,0 -45.93729,0 -4.40286,18.10943 -13.91294,32.73071 -30.300121,42.02849 -12.738312,7.22631 -26.468703,9.67674 -41.082047,7.31758 C 24.093094,240.76041 2.0927197,216.53976 0.15617882,189.26549 -2.0363187,158.37012 19.200153,130.90736 47.506189,124.7386 c 1.954398,7.09734 3.928639,14.26215 5.883037,21.34163 -25.970679,13.25023 -34.958928,29.94495 -27.690947,50.82031 6.398919,18.37135 24.573831,28.44096 44.308292,24.54605 20.153121,-3.97625 30.314009,-20.72456 29.073907,-47.60398 19.105482,0 38.226842,-0.19841 57.334302,0.0972 7.46045,0.11707 13.22047,-0.65675 18.84159,-7.23425 9.25413,-10.82359 26.28616,-9.84738 36.25261,0.37501 10.18469,10.4466 9.69659,27.25641 -1.08137,37.26254 -10.39899,9.65492 -26.82784,9.13904 -36.55618,-1.26392 -2.00004,-2.14487 -3.57546,-4.69055 -5.55366,-7.32551 z"
|
||||
id="path4236"
|
||||
style="clip-rule:evenodd;fill:#4a4a4a;fill-rule:evenodd" /></svg>
|
After Width: | Height: | Size: 3.6 KiB |
|
@ -0,0 +1,45 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/drone/drone-go/plugin"
|
||||
"github.com/drone/drone-go/drone"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var repo = drone.Repo{}
|
||||
var build = drone.Build{}
|
||||
var vargs = struct {
|
||||
Urls []string `json:"urls"`
|
||||
}{}
|
||||
|
||||
plugin.Param("repo", &repo)
|
||||
plugin.Param("build", &build)
|
||||
plugin.Param("vargs", &vargs)
|
||||
plugin.Parse()
|
||||
|
||||
// data structure
|
||||
data := struct {
|
||||
Repo drone.Repo `json:"repo"`
|
||||
Build drone.Build `json:"build"`
|
||||
}{repo, build}
|
||||
|
||||
// json payload that will be posted
|
||||
payload, err := json.Marshal(&data)
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// post payload to each url
|
||||
for _, url := range vargs.Urls {
|
||||
resp, err := http.Post(url, "application/json", bytes.NewBuffer(payload))
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
resp.Body.Close()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue