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

Update GitHub webhook sample #111

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 7 additions & 8 deletions github-webhook/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
# Integrating IBM Cloud Code Engine with Github and Event Notifications
# Integrating IBM Cloud Code Engine with GitHub and Event Notifications

Automating software deployment upon changes in your Git repository isn't a novel idea. In IBM Cloud Code Engine, we provide samples like [Github](https://github.com/IBM/CodeEngine/tree/main/github) or [Github Action Workflows](https://github.com/IBM/CodeEngine/tree/main/github-action-workflows), enabling users to respond to changes in their repositories through Code Engine workloads.
Automating software deployment upon changes in your Git repository isn't a novel idea. In IBM Cloud Code Engine, we provide samples like [GitHub](https://github.com/IBM/CodeEngine/tree/main/github) or [GitHub Action Workflows](https://github.com/IBM/CodeEngine/tree/main/github-action-workflows), enabling users to respond to changes in their repositories through Code Engine workloads.

Given the importance of automated continuous deployments for cloud-native applications, this blog post delves deeper into the topic and proposes a new architecture for IBM Cloud users.

By integrating, Git, Code Engine and IBM Cloud [Event Notifications](https://cloud.ibm.com/docs/event-notifications?topic=event-notifications-getting-started), we can offer users an end-to-end workflow from changes in Git to notifications across multiple destinations, including a Code Engine Job.

## Architecture

Our starting point is Git. Cloud Native Applications code is commonly hosted in these version control systems. Through Github [webhooks](https://docs.github.com/en/webhooks), changes such as `push` events(e.g. committing to your main branch) can trigger integrations to take responsive actions.
Our starting point is Git. Cloud Native Applications code is commonly hosted in these version control systems. Through GitHub [webhooks](https://docs.github.com/en/webhooks), changes such as `push` events(e.g. committing to your main branch) can trigger integrations to take responsive actions.

Knowing when these events occur leads us to the questions; what actions can we take? and who can take an action?

In this architecture, IBM Cloud Event Notifications is our integration of choice, taking a responsive action upon Git Events.

![architecture_diagram](./images/architecture-en-git-ce.png)

![architecture_diagram](./images/architecture-en-git-ce.jpg)

In the image above, we use Event Notifications as an intermediary, leveraging their source and destination concepts to facilitate the transportation of our Github event payloads to multiple destinations.
In the image above, we use Event Notifications as an intermediary, leveraging their source and destination concepts to facilitate the transportation of our GitHub event payloads to multiple destinations.

Our final destination is a Code Engine Job, which, upon receiving the event, will trigger the creation of a Code Engine Build (rebuilds a container image from the Git code where the event originated) and will redeploy any Code Engine Application referencing that container image.

Expand All @@ -27,11 +26,11 @@ By leveraging Code Engine with Event Notifications, we can take continuous deplo

## A Clever Workaround

![application_adapter](./images/workaround.jpg)
![application_adapter](./images/workaround.png)

If you paid attention to the first diagram, you will have noticed the need for an Application Adapter.

This adapter is essential for translating the Github Webhook payload into a format that an Event Notification Source can understand, enabling the complete end-to-end flow.
This adapter is essential for translating the GitHub Webhook payload into a format that an Event Notification Source can understand, enabling the complete end-to-end flow.

However, there's no need to worry - this application adapter runs as a Code Engine application, scaling to zero when no events are occurring.

Expand Down
Binary file removed github-webhook/images/architecture-en-git-ce.jpg
Binary file not shown.
Binary file added github-webhook/images/architecture-en-git-ce.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed github-webhook/images/workaround.jpg
Binary file not shown.
Binary file added github-webhook/images/workaround.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading