Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P1832
circle-phab-glue.js
Active
Public
Actions
Authored by
nornagon
on Jul 24 2015, 6:19 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F657660: circle-phab-glue.js
Jul 24 2015, 6:19 AM
2015-07-24 06:19:37 (UTC+0)
Subscribers
None
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'
));
});
Event Timeline
nornagon
edited the content of this paste.
(Show Details)
Jul 24 2015, 6:19 AM
2015-07-24 06:19:37 (UTC+0)
nornagon
changed the title of this paste from untitled to
circle-phab-glue.js
.
nornagon
updated the paste's language from
autodetect
to
autodetect
.
nornagon
mentioned this in
T8659: Allow linking to an external build system from Harbormaster
.
Log In to Comment