CodeBuild Remote Runner

Jets uses CodeBuild as the remote runner. CodeBuild provides a consistent build environment, CPU architecture, raw horsepower, and ec2 internet speed. The faster internet speed is particularly useful for pushing Docker images. The CodeBuild project is created as part of jets deploy during the bootstrap phase.

CodeBuild Project Properties

You can control and customize the CodeBuild project.

config/jets/bootstrap.rb

Jets.bootstrap.configure do
  config.codebuild.project.environment = {
    ComputeType: "BUILD_GENERAL1_SMALL",
    Image: "aws/codebuild/amazonlinux2-aarch64-standard:3.0",
    Type: "ARM_CONTAINER",
  }
  config.codebuild.project.env.vars = {
    BUNDLE_GITHUB__COM: "SSM:/#{ssm_env}/BUNDLE_GITHUB__COM",
    DOCKER_PASS: "SSM:/#{ssm_env}/DOCKER_PASS",
    DOCKER_USER: "SSM:/#{ssm_env}/DOCKER_USER",
  }
end
  • You can use different ComputeType instance sizes with different costs.
  • Jets mainly uses the EC2 CodeBuild ComputeType. This is because the Docker Lambda Compute types have limitations. For example, you cannot use yum install, apt install, or docker build with Lambda Compute types compared to Linux compute types.
  • You can configure environment variables that should be set on the remote runner.

Faster Builds

If you want faster builds, consider using a Remmote Docker Host or CodeBuild Fleets.

Reference

The table below covers each setting. Each option is configured with config.OPTION. The config. portion is not shown for conciseness. IE: logger.level vs config.logger.level.

Name Default Description
codebuild.fleet_override nil Existing Reserved CodeBuild Fleet ARN. This takes precedence over the Jets Managed Fleet created with codebuild.fleet.enable. You should only use one or the other.
codebuild.fleet.base_capacity 1 The initial number of machines allocated to the compute fleet, which defines the number of builds that can run in parallel.
codebuild.fleet.enable false Enable creation of a Jets Managed Reserved CodeBuild Fleet. Please read for cost considerations: CodeBuild Fleets
codebuild.iam.policy [] Custom User IAM Policy. Add addition IAM permission for the CodeBuild Remote Runner.
codebuild.iam.managed_policy [] Custom User Managed IAM Policies.
codebuild.iam.default_policy (too long to show) The main default IAM policy.
codebuild.iam.default_managed_policy (too long to show) The main default Managed IAM policy.
codebuild.iam.default_vpc_policy [“ec2”] The main default VPC policy. You can set this to empty if you do not need VPC config.
codebuild.lambda.enable   false
codebuild.lambda.project.compute_type see docs See Docs: Default Compute Types.
codebuild.project.compute_type see docs See Docs: Default Compute Types.
codebuild.project.env.block [] Environment variables from your machine that will be blocked. Block rules always win over pass rules. Can be Strings or Regexps.
codebuild.project.env.default_pass %w[JETS_API JETS_ENV JETS_EXTRA JETS_PROJECT JETS_RESET] Default patterns for environment variables that will be passed through from your machine to the CodeBuild remote runner. Can be Strings or Regexps.
codebuild.project.env.pass [] Environment variables from your machine that should be passed through to the CodeBuild env. Can be Strings or Regexps.
codebuild.project.env.vars {} A Hash of environment variables to set for the CodeBuild remote runner.
codebuild.project.environment {} A generalized enviroment Hash that gets passed to the CodeBuild project environment properties.
codebuild.project.timeout_in_minutes 60 CodeBuild Remote Runner timeout. You can also use codebuild.timeout for shorthand. It’s still in minutes.

See Full Config Reference