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!: port mutexbot actions to rust and add isolation channels #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jcgruenhage
Copy link
Member

@jcgruenhage jcgruenhage commented Jan 8, 2025

Problem

To send notifcations for dev and prod deployments into different channels we needed to use the isolation channel feature of mutexbot.

Summary of changes

  • Port to rust, to make dynamic inclusion of channel isolation parameters easier. It would've been possible to do this in bash, but I'm confident that the static checks done by rust will help making this less error prone in the long run.
  • Support isolation_channel parameters for reserving/releasing
  • Merge mutexbot/reserve and mutexbot/release into one mutexbot action to dedupe code
  • Parameters change from kebap-case to snake_case, because of rust best practices. I was not able to make rust happy with kebap-case in parameters. If should be possible to do that by patching https://github.com/42ByteLabs/ghactions

Testing

I have created a test workflow in a temporary repo under https://github.com/neondatabase-labs/tmp-mutexbot-test/blob/main/.github/workflows/test.yml, which successfully reserves the resources. A workflow run that shows this working is https://github.com/neondatabase-labs/tmp-mutexbot-test/actions/runs/12694965092/job/35385895290

@jcgruenhage jcgruenhage force-pushed the jcgruenhage/mutexbot-isolation-channels branch 2 times, most recently from 38c3cf9 to 91d2619 Compare January 9, 2025 13:40
@jcgruenhage jcgruenhage marked this pull request as ready for review January 9, 2025 16:42
@jcgruenhage jcgruenhage requested a review from a team as a code owner January 9, 2025 16:42
@jcgruenhage jcgruenhage force-pushed the jcgruenhage/mutexbot-isolation-channels branch from 91d2619 to 024fe18 Compare January 9, 2025 16:47
Copy link
Member

@bayandin bayandin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I think Rust is a bit too much for this task: we have less Rust experience in the company than in Python, for example. Also it's (relatively) harder to install and configure locally.
But, if you think that Rust is the best tool for this task, let's keep it.

The thing that we need to fix — it shouldn't take 5 minutes to setup the action

@jcgruenhage jcgruenhage force-pushed the jcgruenhage/mutexbot-isolation-channels branch 2 times, most recently from 4f41d5a to 01e42e9 Compare January 10, 2025 10:37
@jcgruenhage
Copy link
Member Author

if you think that Rust is the best tool for this task, let's keep it.

I'm not sure about "best tool for the task", but it's the one I'm most accustomed to. We could probably achieve the same in python, even with static checks using mypy to ensure type safety and other static analysis tools, but getting this going in Rust was the quicker route for me personally, as I'm more used to that ecosystem than to python and the static analysis tools there.

The thing that we need to fix — it shouldn't take 5 minutes to setup the action

It will not:

  • I've cut down the dependencies, which reduced build times to ~2 minutes instead of ~5
  • If I'm not mistaken, a runner that sees this action for a second time will already have the image cached, so as soon as this runs on our own runners instead of shared github runners, it will be instant most of the times. I need to verify this assumption before rolling this out.
  • There's always the alternative of pre-building the images instead of having gha build them on demand, which is what I'll do if this my previous assumption turns out to be false

@jcgruenhage jcgruenhage force-pushed the jcgruenhage/mutexbot-isolation-channels branch from 01e42e9 to cdf6d05 Compare January 10, 2025 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants