All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cloudsnorkel.cdk.github.runners.CodeBuildImageBuilder Maven / Gradle / Ivy

Go to download

CDK construct to create GitHub Actions self-hosted runners. A webhook listens to events and creates ephemeral runners on the fly.

There is a newer version: 0.14.6
Show newest version
package com.cloudsnorkel.cdk.github.runners;

/**
 * (deprecated) An image builder that uses CodeBuild to build Docker images pre-baked with all the GitHub Actions runner requirements.
 * 

* Builders can be used with runner providers. *

* Each builder re-runs automatically at a set interval to make sure the images contain the latest versions of everything. *

* You can create an instance of this construct to customize the image used to spin-up runners. Each provider has its own requirements for what an image should do. That's why they each provide their own Dockerfile. *

* For example, to set a specific runner version, rebuild the image every 2 weeks, and add a few packages for the Fargate provider, use: *

*

 * const builder = new CodeBuildImageBuilder(this, 'Builder', {
 *     dockerfilePath: FargateRunnerProvider.LINUX_X64_DOCKERFILE_PATH,
 *     runnerVersion: RunnerVersion.specific('2.293.0'),
 *     rebuildInterval: Duration.days(14),
 * });
 * builder.setBuildArg('EXTRA_PACKAGES', 'nginx xz-utils');
 * new FargateRunnerProvider(this, 'Fargate provider', {
 *     labels: ['customized-fargate'],
 *     imageBuilder: builder,
 * });
 * 
*

* @deprecated use RunnerImageBuilder */ @javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-14T02:42:19.384Z") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated @software.amazon.jsii.Jsii(module = com.cloudsnorkel.cdk.github.runners.$Module.class, fqn = "@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder") public class CodeBuildImageBuilder extends software.constructs.Construct implements com.cloudsnorkel.cdk.github.runners.IRunnerImageBuilder { protected CodeBuildImageBuilder(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); } protected CodeBuildImageBuilder(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { super(initializationMode); } /** * @param scope This parameter is required. * @param id This parameter is required. * @param props This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated public CodeBuildImageBuilder(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull com.cloudsnorkel.cdk.github.runners.CodeBuildImageBuilderProps props) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(props, "props is required") }); } /** * (deprecated) Add extra trusted certificates. This helps deal with self-signed certificates for GitHub Enterprise Server. *

* All first party Dockerfiles support this. Others may not. *

* @param path path to directory containing a file called certs.pem containing all the required certificates. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated public void addExtraCertificates(final @org.jetbrains.annotations.NotNull java.lang.String path) { software.amazon.jsii.Kernel.call(this, "addExtraCertificates", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(path, "path is required") }); } /** * (deprecated) Uploads a folder to the build server at a given folder name. *

* @param sourcePath path to source directory. This parameter is required. * @param destName name of destination folder. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated public void addFiles(final @org.jetbrains.annotations.NotNull java.lang.String sourcePath, final @org.jetbrains.annotations.NotNull java.lang.String destName) { software.amazon.jsii.Kernel.call(this, "addFiles", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(sourcePath, "sourcePath is required"), java.util.Objects.requireNonNull(destName, "destName is required") }); } /** * (deprecated) Add a policy statement to the builder to access resources required to the image build. *

* @param statement IAM policy statement. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated public void addPolicyStatement(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.PolicyStatement statement) { software.amazon.jsii.Kernel.call(this, "addPolicyStatement", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(statement, "statement is required") }); } /** * (deprecated) Adds a command that runs after docker build and docker push. *

* @param command command to add. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated public void addPostBuildCommand(final @org.jetbrains.annotations.NotNull java.lang.String command) { software.amazon.jsii.Kernel.call(this, "addPostBuildCommand", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(command, "command is required") }); } /** * (deprecated) Adds a command that runs before docker build. *

* @param command command to add. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated public void addPreBuildCommand(final @org.jetbrains.annotations.NotNull java.lang.String command) { software.amazon.jsii.Kernel.call(this, "addPreBuildCommand", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(command, "command is required") }); } /** * (deprecated) Build and return an AMI with GitHub Runner installed in it. *

* Anything that ends up with a launch template pointing to an AMI that runs GitHub self-hosted runners can be used. A simple implementation could even point to an existing AMI and nothing else. *

* The AMI can be further updated over time manually or using a schedule as long as it is always written to the same launch template. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated @Override public @org.jetbrains.annotations.NotNull com.cloudsnorkel.cdk.github.runners.RunnerAmi bindAmi() { return software.amazon.jsii.Kernel.call(this, "bindAmi", software.amazon.jsii.NativeType.forClass(com.cloudsnorkel.cdk.github.runners.RunnerAmi.class)); } /** * (deprecated) Called by IRunnerProvider to finalize settings and create the image builder. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated @Override public @org.jetbrains.annotations.NotNull com.cloudsnorkel.cdk.github.runners.RunnerImage bindDockerImage() { return software.amazon.jsii.Kernel.call(this, "bindDockerImage", software.amazon.jsii.NativeType.forClass(com.cloudsnorkel.cdk.github.runners.RunnerImage.class)); } /** * (deprecated) Adds a build argument for Docker. *

* See the documentation for the Dockerfile you're using for a list of supported build arguments. *

* @param name build argument name. This parameter is required. * @param value build argument value. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated public void setBuildArg(final @org.jetbrains.annotations.NotNull java.lang.String name, final @org.jetbrains.annotations.NotNull java.lang.String value) { software.amazon.jsii.Kernel.call(this, "setBuildArg", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(name, "name is required"), java.util.Objects.requireNonNull(value, "value is required") }); } /** */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.Connections getConnections() { return software.amazon.jsii.Kernel.get(this, "connections", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.Connections.class)); } /** */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated public @org.jetbrains.annotations.NotNull com.cloudsnorkel.cdk.github.runners.CodeBuildImageBuilderProps getProps() { return software.amazon.jsii.Kernel.get(this, "props", software.amazon.jsii.NativeType.forClass(com.cloudsnorkel.cdk.github.runners.CodeBuildImageBuilderProps.class)); } /** * (deprecated) A fluent builder for {@link com.cloudsnorkel.cdk.github.runners.CodeBuildImageBuilder}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated public static final class Builder implements software.amazon.jsii.Builder { /** * @return a new instance of {@link Builder}. * @param scope This parameter is required. * @param id This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated public static Builder create(final software.constructs.Construct scope, final java.lang.String id) { return new Builder(scope, id); } private final software.constructs.Construct scope; private final java.lang.String id; private final com.cloudsnorkel.cdk.github.runners.CodeBuildImageBuilderProps.Builder props; private Builder(final software.constructs.Construct scope, final java.lang.String id) { this.scope = scope; this.id = id; this.props = new com.cloudsnorkel.cdk.github.runners.CodeBuildImageBuilderProps.Builder(); } /** * (experimental) Path to Dockerfile to be built. *

* It can be a path to a Dockerfile, a folder containing a Dockerfile, or a zip file containing a Dockerfile. *

* @return {@code this} * @param dockerfilePath Path to Dockerfile to be built. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder dockerfilePath(final java.lang.String dockerfilePath) { this.props.dockerfilePath(dockerfilePath); return this; } /** * (experimental) Image architecture. *

* Default: Architecture.X86_64 *

* @return {@code this} * @param architecture Image architecture. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder architecture(final com.cloudsnorkel.cdk.github.runners.Architecture architecture) { this.props.architecture(architecture); return this; } /** * (experimental) Build image to use in CodeBuild. *

* This is the image that's going to run the code that builds the runner image. *

* The only action taken in CodeBuild is running docker build. You would therefore not need to change this setting often. *

* Default: Ubuntu 22.04 for x64 and Amazon Linux 2 for ARM64 *

* @return {@code this} * @param buildImage Build image to use in CodeBuild. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder buildImage(final software.amazon.awscdk.services.codebuild.IBuildImage buildImage) { this.props.buildImage(buildImage); return this; } /** * (experimental) The type of compute to use for this build. *

* See the {@link ComputeType} enum for the possible values. *

* Default: {@link ComputeType#SMALL } *

* @return {@code this} * @param computeType The type of compute to use for this build. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder computeType(final software.amazon.awscdk.services.codebuild.ComputeType computeType) { this.props.computeType(computeType); return this; } /** * (experimental) Removal policy for logs of image builds. *

* If deployment fails on the custom resource, try setting this to RemovalPolicy.RETAIN. This way the CodeBuild logs can still be viewed, and you can see why the build failed. *

* We try to not leave anything behind when removed. But sometimes a log staying behind is useful. *

* Default: RemovalPolicy.DESTROY *

* @return {@code this} * @param logRemovalPolicy Removal policy for logs of image builds. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder logRemovalPolicy(final software.amazon.awscdk.RemovalPolicy logRemovalPolicy) { this.props.logRemovalPolicy(logRemovalPolicy); return this; } /** * (experimental) The number of days log events are kept in CloudWatch Logs. *

* When updating * this property, unsetting it doesn't remove the log retention policy. To * remove the retention policy, set the value to INFINITE. *

* Default: logs.RetentionDays.ONE_MONTH *

* @return {@code this} * @param logRetention The number of days log events are kept in CloudWatch Logs. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder logRetention(final software.amazon.awscdk.services.logs.RetentionDays logRetention) { this.props.logRetention(logRetention); return this; } /** * (experimental) Image OS. *

* Default: OS.LINUX *

* @return {@code this} * @param os Image OS. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder os(final com.cloudsnorkel.cdk.github.runners.Os os) { this.props.os(os); return this; } /** * (experimental) Schedule the image to be rebuilt every given interval. *

* Useful for keeping the image up-do-date with the latest GitHub runner version and latest OS updates. *

* Set to zero to disable. *

* Default: Duration.days(7) *

* @return {@code this} * @param rebuildInterval Schedule the image to be rebuilt every given interval. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder rebuildInterval(final software.amazon.awscdk.Duration rebuildInterval) { this.props.rebuildInterval(rebuildInterval); return this; } /** * (experimental) Version of GitHub Runners to install. *

* Default: latest version available *

* @return {@code this} * @param runnerVersion Version of GitHub Runners to install. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder runnerVersion(final com.cloudsnorkel.cdk.github.runners.RunnerVersion runnerVersion) { this.props.runnerVersion(runnerVersion); return this; } /** * (experimental) Security Group to assign to this instance. *

* Default: public project with no security group *

* @return {@code this} * @param securityGroup Security Group to assign to this instance. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder securityGroup(final software.amazon.awscdk.services.ec2.ISecurityGroup securityGroup) { this.props.securityGroup(securityGroup); return this; } /** * (experimental) Where to place the network interfaces within the VPC. *

* Default: no subnet *

* @return {@code this} * @param subnetSelection Where to place the network interfaces within the VPC. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder subnetSelection(final software.amazon.awscdk.services.ec2.SubnetSelection subnetSelection) { this.props.subnetSelection(subnetSelection); return this; } /** * (experimental) The number of minutes after which AWS CodeBuild stops the build if it's not complete. *

* For valid values, see the timeoutInMinutes field in the AWS * CodeBuild User Guide. *

* Default: Duration.hours(1) *

* @return {@code this} * @param timeout The number of minutes after which AWS CodeBuild stops the build if it's not complete. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder timeout(final software.amazon.awscdk.Duration timeout) { this.props.timeout(timeout); return this; } /** * (experimental) VPC to build the image in. *

* Default: no VPC *

* @return {@code this} * @param vpc VPC to build the image in. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder vpc(final software.amazon.awscdk.services.ec2.IVpc vpc) { this.props.vpc(vpc); return this; } /** * @return a newly built instance of {@link com.cloudsnorkel.cdk.github.runners.CodeBuildImageBuilder}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated @Override public com.cloudsnorkel.cdk.github.runners.CodeBuildImageBuilder build() { return new com.cloudsnorkel.cdk.github.runners.CodeBuildImageBuilder( this.scope, this.id, this.props.build() ); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy