feat(ci): add triggers@@ -13,7 +13,14 @@ const postPipelineTriggerAction: ReqHandler<
> = async (request, reply) => {
const { orgSlug, repoSlug, pipelineId } = request.params;
- const pipelineService = makePipelineService({ request, runner: {} });
+ const pipelineService = makePipelineService({
+ request,
+ runner: {
+ triggerRun(orgSlug, repoSlug, pipelineId) {
+ console.log(`trigger the ci for ${orgSlug}/${repoSlug}`);
+ }
+ }
+ });
const updatedPipeline = await pipelineService.triggerRunner(
orgSlug,
repoSlug,
@@ -26,6 +26,9 @@ const makeOnPushEvent: ServiceMethodFactory<
> = ({ request, repoService }) => {
const env = getEnv();
return ({ data, message }) => {
+ // process message from the push event 0
+ message.accept();
+
if (data.packType === GitServer.PackType.RECEIVE) {
// client has done something like "git push" it is uploading
// server is receiving
@@ -170,6 +173,16 @@ const makeOnPushEvent: ServiceMethodFactory<
}
message.write("\n");
+
+ // trigger the continuous integration pipeline
+ fetch(`${repoUrlBase}/pipelines/trigger`, {
+ method: 'POST',
+ body: {},
+ // web: {}
+ })
+ .catch((err) => {
+ console.log(`Can not trigger the pipeline: ${err.message}`);
+ });
} else if (data.packType === GitServer.PackType.UPLOAD) {
// client has done something like "git clone" or "git fetch" or "git pull",
// it is receiving, server is uploading
@@ -181,7 +194,7 @@ const makeOnPushEvent: ServiceMethodFactory<
}
// Finally, accept the payload from client
- message.accept();
+ // message.accept();
};
};