#release-engineering (2024-04)

jenkins_ci All things CI/CD. Specific emphasis on Codefresh and CodeBuild with CodePipeline.

CI/CD Discussions

Archive: https://archive.sweetops.com/release-engineering/

2024-04-24

loren avatar

Very cool feature here, super easy self hosted runners for GitHub actions, using Codebuild… https://aws.amazon.com/about-aws/whats-new/2024/04/aws-codebuild-managed-github-action-runners/

1
Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Wow, interesting…

loren avatar

Finally closed my feature request for this… https://github.com/aws-actions/aws-codebuild-run-build/issues/80

#80 Codebuild as a Self-hosted runner for Github Actions?

I was curious if you had thought about a mechanism to register/run CodeBuild jobs as self-hosted runners for GitHub Actions? I think it would be a great feature, to avoid costs for Actions minutes, as self-hosted runners are free.

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)
cloudposse/terraform-aws-codebuild

Terraform Module to easily leverage AWS CodeBuild for Continuous Integration

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Same for organizational runners?

loren avatar

i don’t see how this would support organizational runners, exactly. the webhook is to a specific repository

loren avatar

i think you could either have a codebuild job per repository each with 1 webhook, or 1 codebuild job with a webhook per repository. but something has to scale per repository, rather than one and done at the org level

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Oh, just build a lambda and…

loren avatar

sorry, i feel like i missed something. lambda?

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Oh, sorry, I was being facetious! Just whenever something isn’t supported out of the box in AWS, for example, when there’s a new exciting announcement of native support for GitHub Runners, and when it doesn’t actually do what is needed, the fall back is always, “Just write a lambda”

2
loren avatar

I guess you could schedule a lambda that describes your github org repos, and creates the webhook

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Perhaps my problem is coming at this from a Actions Runner Controller / Philips Labs Runners perspective, so the expectation is a more drop-in replacement than yet another apparatus.

loren avatar

Yeah, I was a little bummed that I couldn’t override ENVs as part of the StartBuild request. But then I realized it would read all that from the Github Actions config, not it’s own BuildSpec (which gets ignored in this setup)

loren avatar

There are org-level webhooks on the github side. I wonder if maybe some future feature on the Codebuild side might support an org-level codebuild job as a runner…

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

(thinking back to the other thread, about managing GitHub with Terraform, this would probably be pretty neat to incorporate with that)

1
loren avatar

this is the syntax for your github action config:

runs-on: codebuild-<project-name>-${{ github.run_id }}-${{ github.run_attempt }}
loren avatar

I was thinking that also. Create github repo, apply config, create codebuild job/webhook. Easy.

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Would make it easy to provide specific types of runners for specific repos

loren avatar

Compared to the Actions Runner Controller / Philips Labs Runners setup, everything using the codebuild approach would be ephemeral. 1 job and done, scale to zero are just natural features

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Yea, which is nice, although a bit slow waiting for instances to boot up

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Slow but scalable

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

What are the options to speed that up?

loren avatar

i find codebuild startup to be very fast, just seconds really. unless i’ve hit some quota limiting how many i can launch at once

loren avatar

that’s for container jobs. you can use the lambda runner if you want faster startup

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

THat’s cool so it’s very flexible based on execution parameters. Fast/lightweight builds can use Lambda, and so on.

loren avatar

yeah they say you can use the lambda runners with this feature, but the docs don’t show an example yet… this is supposed to be the syntax for customizing the runner from the github action config:

runs-on: codebuild-<project-name>-${{ github.run_id }}-${{ github.run_attempt }}-<image>-<image-version>-<instance-size>

and there’s a table of the “values” for each of those tokens, but it doesn’t talk about lambda. i wonder if maybe you have to setup lambda on the job itself so it’s the default, and then you could “override” that from the action config…

2024-04-25

    keyboard_arrow_up