CloudSnorkel / cdk-github-runners

CDK constructs for self-hosted GitHub Actions runners
https://constructs.dev/packages/@cloudsnorkel/cdk-github-runners/
Apache License 2.0
255 stars 37 forks source link

feat: Option to speed up deploys by not waiting for runner images to build #549

Closed kichik closed 2 weeks ago

kichik commented 2 weeks ago

If you add a lot of components to your runner image that can take a long time to build, you may want your CDK deployment to not wait for the image to finish. This can speed up the trial-and-error cycle of updating your image. It can make sure a random timeout in the image build process won't roll everything back.

Note that this does have some downsides.

  1. Updating components doesn't trigger a new build. You may have to wait up to a week (rebuild interval) for a new image, unless you manually trigger it.
  2. Fresh deployments will not be ready to use until the image is done. CDK deployment being done won't mean your setup is ready as the runner image may not be built yet.
  3. With the right build timing, some resources may be left behind on stack destruction. This includes log groups and AWS Image Builder resources.
const builder = FargateRunnerProvider.imageBuilder(stack, 'Fargate builder no wait 4', {
  waitOnDeploy: false,
  codeBuildOptions: {
    timeout: cdk.Duration.hours(6),
  },
});
builder.addComponent(RunnerImageComponent.custom({
  commands: [
    // some commands that can take a long time to complete...
    'sleep 5h', // toy example
  ],
}));

See #540