Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F657660
circle-phab-glue.js
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
nornagon
Jul 24 2015, 6:19 AM
2015-07-24 06:19:37 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
circle-phab-glue.js
View Options
var
request
=
require
(
'request'
);
var
express
=
require
(
'express'
);
var
bodyParser
=
require
(
'body-parser'
);
var
app
=
express
();
var
createCanduit
=
require
(
'canduit'
);
app
.
set
(
'port'
,
(
process
.
env
.
PORT
||
5000
));
app
.
use
(
bodyParser
.
json
())
app
.
post
(
'/build'
,
function
(
req
,
res
)
{
var
target_phid
=
req
.
query
.
target
;
var
diff_id
=
req
.
query
.
diff
;
request
.
post
({
url
:
'https://circleci.com/api/v1/project/transcriptic/www/tree/circle'
,
qs
:
{
"circle-token"
:
process
.
env
[
'CIRCLE_TOKEN'
]
},
json
:
true
,
body
:
{
"build_parameters"
:
{
"PHAB_DIFF_ID"
:
diff_id
,
"PHAB_TARGET_PHID"
:
target_phid
}
}
},
function
(
err
,
res
,
body
)
{
console
.
log
(
err
,
body
)
})
res
.
end
();
});
app
.
post
(
'/build-complete'
,
function
(
req
,
res
)
{
var
target_phid
=
req
.
body
.
payload
.
build_parameters
[
'PHAB_TARGET_PHID'
];
var
outcome
=
req
.
body
.
payload
.
outcome
createCanduit
({
api
:
"https://work.r23s.net/api/"
,
user
:
process
.
env
[
'CONDUIT_USER'
],
cert
:
process
.
env
[
'CONDUIT_CERT'
],
},
function
(
err
,
canduit
)
{
if
(
err
)
{
res
.
end
();
return
console
.
error
(
"Error authenticating with conduit: %j"
,
err
);
}
canduit
.
exec
(
'harbormaster.sendmessage'
,
{
buildTargetPHID
:
target_phid
,
type
:
(
outcome
==
"success"
?
"pass"
:
"fail"
),
},
function
(
err
,
data
)
{
console
.
log
(
"Called conduit"
,
err
,
data
)
res
.
end
();
})
})
})
app
.
listen
(
app
.
get
(
'port'
),
function
()
{
console
.
log
(
'Node app is running on port'
,
app
.
get
(
'port'
));
});
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/im/ed/ozatf65tzifysyyo
Default Alt Text
circle-phab-glue.js (1 KB)
Attached To
Mode
P1832 circle-phab-glue.js
Attached
Detach File
Event Timeline
Log In to Comment