-
Notifications
You must be signed in to change notification settings - Fork 6
/
api.js
54 lines (45 loc) · 1.4 KB
/
api.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env node
var request = require('request');
// const params = {
// // body: {
// // name: 'daodaotest',
// // tag: 'stable',
// // version: '1.0.0'
// // },
// json: true,
// // auth: {
// // bearer: process.env.SD_TOKEN
// // },
// method: 'GET',
// url: `https://api-next.screwdriver.corp.yahoo.com/v4/builds/${process.env.SD_BUILD_ID}`
// };
const params = {
// {"id":"sd10283-build-14","charge":32,"service":"sdv4","chargeto":"sd10283","timestamp":"2017-09-07T04:00:00.000Z"}
body: {
id: `sd${process.env.SD_PIPELINE_ID}-build-${process.env.SD_BUILD_ID}`,
charge: process.env.DIFF,
service: 'sdv4',
chargeto: `sd${process.env.SD_PIPELINE_ID}`,
timestamp: new Date().toISOString()
},
json: true,
// auth: {
// bearer: process.env.SD_TOKEN
// },
method: 'PUT',
url: 'http://approveremove.corp.ne1.yahoo.com:8080/store-receipt'
};
console.log(params);
return new Promise((resolve, reject) => {
request(params, (err, response, body) => {
console.log('hi');
if (err) {
console.log('err', err);
return reject(err);
}
console.log(response.statusCode);
console.log('****')
console.log(response.body);
return resolve(body);
})
});