Skip to content

Commit

Permalink
Use node-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
Tejas Kumar committed Dec 7, 2018
1 parent 0c7fd22 commit deee6f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def buildWebsite(dir,command){
}

podTemplate(cloud: "${env.K8sCloud}", label: label, containers: [
containerTemplate(name: 'node', image: "node:lts", ttyEnabled: true, resourceRequestMemory: '10Gi', resourceRequestCpu: '3', privileged: true),
containerTemplate(name: 'node', image: "${env.GcrPrefix}/node:10.0.0-v0.5", ttyEnabled: true, resourceRequestMemory: '10Gi', resourceRequestCpu: '3', privileged: true),
],
volumes: [
hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock'),
Expand Down
27 changes: 8 additions & 19 deletions lambdas/notify-slack-on-publish-next.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const https = require("https")
const { default: fetch } = require("node-fetch")

const body = {
username: "Operational UI",
icon_url: "https://emoji.slack-edge.com/T0G7GJQ9Z/operational/d2230b6586af99f0.png",
text: "🚀 *Just deployed!*",
channel: "@tejas",
attachments: [
{
fallback: "🚀 Just deployed `@operational/components@next`!",
color: "good",
channel: "@tejas",
title_link: "https://www.npmjs.com/package/@operational/components/v/next",
text: `A new version (\`${
process.argv[2]
Expand All @@ -20,21 +20,10 @@ const body = {
],
}

const req = https.request(
"https://hooks.slack.com/services/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",
{
method: "POST",
headers: {
"content-type": "application/json",
},
},
res => {
console.log(res.statusCode, res.headers)
res.setEncoding("utf8")
res.on("data", console.log)
res.on("end", () => console.log("Response done."))
fetch("https://hooks.slack.com/services/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", {
method: "POST",
headers: {
"content-type": "application/json",
},
)

req.write(JSON.stringify(body))
req.end()
body: JSON.stringify(body),
})

0 comments on commit deee6f0

Please sign in to comment.