Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(1415): Add logic to handle webhook events from external repos #2187

Merged
merged 20 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ce5c603
feat(1415): Add logic to handle webhook events from external repos
supra08 Aug 21, 2020
e37d7c7
feat(1415): Change addWebhook method to addMultipleWebhooks and few f…
supra08 Aug 21, 2020
5653f84
feat(1415): Add tests for other events and fix queries
supra08 Aug 27, 2020
dad09bd
feat(1415): Configure subscribed jobs to be triggered wrt to startFrom
supra08 Aug 28, 2020
648763f
fix(1415): Fix update-sync sequence in update pipeline
supra08 Aug 29, 2020
5ebd3d1
fix(1415): fix tests for the pipeline plugin
supra08 Aug 29, 2020
5b8f9c8
feat(1415): Add improved subscribed pr handling
supra08 Sep 2, 2020
7b86e0d
fix(1415): Fix subscribed PR webhook events and tests
supra08 Sep 2, 2020
9d107ca
cleanup(1415): remove leftout commit texts
supra08 Sep 2, 2020
253027b
fix(1415): bump back faulty package.json
supra08 Sep 2, 2020
e635c8d
fix(1415): fix return object in create pipeline
supra08 Sep 2, 2020
a6bf0f6
fix(1415): Remove stray eslint comments and add docstrings
supra08 Sep 4, 2020
7e36fc0
fix(1415): Add method name to docstring comment
supra08 Sep 4, 2020
6ac1ab4
fix(1415): Refactor subscribed search query with subscribedScmUrlsWit…
supra08 Sep 6, 2020
3d784f8
fix(1415): Fix tests for webhooks
supra08 Sep 23, 2020
5e6d334
fix(1415): Minor code formatting
supra08 Oct 1, 2020
b68ace6
cleanup(1415): Minor code cleanup
supra08 Oct 7, 2020
7c10b6e
Merge branch 'master' into external-scms
jithine Oct 8, 2020
f91b6a1
Merge branch 'master' into external-scms
jithine Oct 13, 2020
f43ff92
Merge branch 'master' into external-scms
tkyi Oct 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions plugins/pipelines/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,17 @@ module.exports = () => ({
});
}

const results = await Promise.all([
pipeline.sync(),
pipeline.addWebhook(`${request.server.info.uri}/v4/webhooks`)
]);
const results = await pipeline.sync();

await pipeline.addWebhooks(`${request.server.info.uri}/v4/webhooks`);

const location = urlLib.format({
host: request.headers.host,
port: request.headers.port,
protocol: request.server.info.protocol,
pathname: `${request.path}/${pipeline.id}`
});
const data = await results[0].toJson();
const data = await results.toJson();

return h
.response(data)
Expand Down
2 changes: 1 addition & 1 deletion plugins/pipelines/syncWebhooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module.exports = () => ({
}
})
// user has good permissions, add or update webhooks
.then(() => pipeline.addWebhook(`${request.server.info.uri}/v4/webhooks`))
.then(() => pipeline.addWebhooks(`${request.server.info.uri}/v4/webhooks`))
.then(() => h.response().code(204))
);
})
Expand Down
20 changes: 9 additions & 11 deletions plugins/pipelines/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,15 @@ module.exports = () => ({
oldPipeline.name = scmRepo.name;

// update pipeline with new scmRepo and branch
return oldPipeline
.update()
.then(updatedPipeline =>
Promise.all([
updatedPipeline.sync(),
updatedPipeline.addWebhook(
`${request.server.info.uri}/v4/webhooks`
)
])
)
.then(results => h.response(results[0].toJson()).code(200));
return oldPipeline.update().then(async updatedPipeline => {
await updatedPipeline.addWebhooks(
`${request.server.info.uri}/v4/webhooks`
);

const result = await updatedPipeline.sync();

return h.response(result.toJson()).code(200);
});
})
)
);
Expand Down
Loading