![JAR search and dependency download from the Maven repository](/logo.png)
io.github.cdklabs.cdkpipelines.github.GitHubWorkflow Maven / Gradle / Ivy
package io.github.cdklabs.cdkpipelines.github;
/**
* (experimental) CDK Pipelines for GitHub workflows.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.98.0 (build 00b106d)", date = "2024-06-02T18:14:52.322Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdkpipelines.github.$Module.class, fqn = "cdk-pipelines-github.GitHubWorkflow")
public class GitHubWorkflow extends software.amazon.awscdk.pipelines.PipelineBase {
protected GitHubWorkflow(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected GitHubWorkflow(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.Experimental)
public GitHubWorkflow(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkpipelines.github.GitHubWorkflowProps 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") });
}
/**
* @param id This parameter is required.
* @param options
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkpipelines.github.GitHubWave addGitHubWave(final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.Nullable software.amazon.awscdk.pipelines.WaveOptions options) {
return software.amazon.jsii.Kernel.call(this, "addGitHubWave", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdkpipelines.github.GitHubWave.class), new Object[] { java.util.Objects.requireNonNull(id, "id is required"), options });
}
/**
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkpipelines.github.GitHubWave addGitHubWave(final @org.jetbrains.annotations.NotNull java.lang.String id) {
return software.amazon.jsii.Kernel.call(this, "addGitHubWave", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdkpipelines.github.GitHubWave.class), new Object[] { java.util.Objects.requireNonNull(id, "id is required") });
}
/**
* (experimental) Deploy a single Stage by itself with options for further GitHub configuration.
*
* Add a Stage to the pipeline, to be deployed in sequence with other Stages added to the pipeline.
* All Stacks in the stage will be deployed in an order automatically determined by their relative dependencies.
*
* @param stage This parameter is required.
* @param options
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.pipelines.StageDeployment addStageWithGitHubOptions(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.Stage stage, final @org.jetbrains.annotations.Nullable io.github.cdklabs.cdkpipelines.github.AddGitHubStageOptions options) {
return software.amazon.jsii.Kernel.call(this, "addStageWithGitHubOptions", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.pipelines.StageDeployment.class), new Object[] { java.util.Objects.requireNonNull(stage, "stage is required"), options });
}
/**
* (experimental) Deploy a single Stage by itself with options for further GitHub configuration.
*
* Add a Stage to the pipeline, to be deployed in sequence with other Stages added to the pipeline.
* All Stacks in the stage will be deployed in an order automatically determined by their relative dependencies.
*
* @param stage This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.pipelines.StageDeployment addStageWithGitHubOptions(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.Stage stage) {
return software.amazon.jsii.Kernel.call(this, "addStageWithGitHubOptions", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.pipelines.StageDeployment.class), new Object[] { java.util.Objects.requireNonNull(stage, "stage is required") });
}
/**
* (experimental) Add a Wave to the pipeline, for deploying multiple Stages in parallel.
*
* Use the return object of this method to deploy multiple stages in parallel.
*
* Example:
*
*
* GitHubWorkflow pipeline;
* // assign pipeline a value
* Wave wave = pipeline.addWave("MyWave");
* wave.addStage(new MyStage(this, "Stage1"));
* wave.addStage(new MyStage(this, "Stage2"));
*
*
* @param id This parameter is required.
* @param options
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.pipelines.Wave addWave(final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.Nullable software.amazon.awscdk.pipelines.WaveOptions options) {
return software.amazon.jsii.Kernel.call(this, "addWave", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.pipelines.Wave.class), new Object[] { java.util.Objects.requireNonNull(id, "id is required"), options });
}
/**
* (experimental) Add a Wave to the pipeline, for deploying multiple Stages in parallel.
*
* Use the return object of this method to deploy multiple stages in parallel.
*
* Example:
*
*
* GitHubWorkflow pipeline;
* // assign pipeline a value
* Wave wave = pipeline.addWave("MyWave");
* wave.addStage(new MyStage(this, "Stage1"));
* wave.addStage(new MyStage(this, "Stage2"));
*
*
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.pipelines.Wave addWave(final @org.jetbrains.annotations.NotNull java.lang.String id) {
return software.amazon.jsii.Kernel.call(this, "addWave", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.pipelines.Wave.class), new Object[] { java.util.Objects.requireNonNull(id, "id is required") });
}
/**
* (experimental) Implemented by subclasses to do the actual pipeline construction.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
protected void doBuildPipeline() {
software.amazon.jsii.Kernel.call(this, "doBuildPipeline", software.amazon.jsii.NativeType.VOID);
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkpipelines.github.YamlFile getWorkflowFile() {
return software.amazon.jsii.Kernel.get(this, "workflowFile", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdkpipelines.github.YamlFile.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getWorkflowName() {
return software.amazon.jsii.Kernel.get(this, "workflowName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.String getWorkflowPath() {
return software.amazon.jsii.Kernel.get(this, "workflowPath", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* (experimental) A fluent builder for {@link io.github.cdklabs.cdkpipelines.github.GitHubWorkflow}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
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.Experimental)
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 io.github.cdklabs.cdkpipelines.github.GitHubWorkflowProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
this.props = new io.github.cdklabs.cdkpipelines.github.GitHubWorkflowProps.Builder();
}
/**
* The build step that produces the CDK Cloud Assembly.
*
* The primary output of this step needs to be the cdk.out
directory
* generated by the cdk synth
command.
*
* If you use a ShellStep
here and you don't configure an output directory,
* the output directory will automatically be assumed to be cdk.out
.
*
* @return {@code this}
* @param synth The build step that produces the CDK Cloud Assembly. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder synth(final software.amazon.awscdk.pipelines.IFileSetProducer synth) {
this.props.synth(synth);
return this;
}
/**
* (deprecated) Names of GitHub repository secrets that include AWS credentials for deployment.
*
* Default: - `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.
*
* @return {@code this}
* @deprecated Use awsCreds.fromGitHubSecrets()
instead.
* @param awsCredentials Names of GitHub repository secrets that include AWS credentials for deployment. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder awsCredentials(final io.github.cdklabs.cdkpipelines.github.AwsCredentialsSecrets awsCredentials) {
this.props.awsCredentials(awsCredentials);
return this;
}
/**
* (experimental) Configure provider for AWS credentials used for deployment.
*
* Default: - Get AWS credentials from GitHub secrets `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.
*
* @return {@code this}
* @param awsCreds Configure provider for AWS credentials used for deployment. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder awsCreds(final io.github.cdklabs.cdkpipelines.github.AwsCredentialsProvider awsCreds) {
this.props.awsCreds(awsCreds);
return this;
}
/**
* (experimental) Build container options.
*
* Default: - GitHub defaults
*
* @return {@code this}
* @param buildContainer Build container options. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder buildContainer(final io.github.cdklabs.cdkpipelines.github.ContainerOptions buildContainer) {
this.props.buildContainer(buildContainer);
return this;
}
/**
* (experimental) Version of the CDK CLI to use.
*
* Default: - automatic
*
* @return {@code this}
* @param cdkCliVersion Version of the CDK CLI to use. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder cdkCliVersion(final java.lang.String cdkCliVersion) {
this.props.cdkCliVersion(cdkCliVersion);
return this;
}
/**
* (experimental) GitHub workflow concurrency.
*
* Default: - no concurrency settings
*
* @return {@code this}
* @param concurrency GitHub workflow concurrency. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder concurrency(final io.github.cdklabs.cdkpipelines.github.ConcurrencyOptions concurrency) {
this.props.concurrency(concurrency);
return this;
}
/**
* (experimental) Job level settings applied to all docker asset publishing jobs in the workflow.
*
* Default: - no additional settings
*
* @return {@code this}
* @param dockerAssetJobSettings Job level settings applied to all docker asset publishing jobs in the workflow. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder dockerAssetJobSettings(final io.github.cdklabs.cdkpipelines.github.DockerAssetJobSettings dockerAssetJobSettings) {
this.props.dockerAssetJobSettings(dockerAssetJobSettings);
return this;
}
/**
* (experimental) The Docker Credentials to use to login.
*
* If you set this variable,
* you will be logged in to docker when you upload Docker Assets.
*
* @return {@code this}
* @param dockerCredentials The Docker Credentials to use to login. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder dockerCredentials(final java.util.List extends io.github.cdklabs.cdkpipelines.github.DockerCredential> dockerCredentials) {
this.props.dockerCredentials(dockerCredentials);
return this;
}
/**
* (deprecated) A role that utilizes the GitHub OIDC Identity Provider in your AWS account.
*
* If supplied, this will be used instead of awsCredentials
.
*
* You can create your own role in the console with the necessary trust policy
* to allow gitHub actions from your gitHub repository to assume the role, or
* you can utilize the GitHubActionRole
construct to create a role for you.
*
* Default: - GitHub repository secrets are used instead of OpenId Connect role.
*
* @return {@code this}
* @deprecated Use awsCreds.fromOpenIdConnect()
instead.
* @param gitHubActionRoleArn A role that utilizes the GitHub OIDC Identity Provider in your AWS account. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder gitHubActionRoleArn(final java.lang.String gitHubActionRoleArn) {
this.props.gitHubActionRoleArn(gitHubActionRoleArn);
return this;
}
/**
* (experimental) Job level settings that will be applied to all jobs in the workflow, including synth and asset deploy jobs.
*
* Currently the only valid setting
* is 'if'. You can use this to run jobs only in specific repositories.
*
* @return {@code this}
* @see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-run-job-for-specific-repository
* @param jobSettings Job level settings that will be applied to all jobs in the workflow, including synth and asset deploy jobs. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder jobSettings(final io.github.cdklabs.cdkpipelines.github.JobSettings jobSettings) {
this.props.jobSettings(jobSettings);
return this;
}
/**
* (experimental) GitHub workflow steps to execute after build.
*
* Default: []
*
* @return {@code this}
* @param postBuildSteps GitHub workflow steps to execute after build. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder postBuildSteps(final java.util.List extends io.github.cdklabs.cdkpipelines.github.JobStep> postBuildSteps) {
this.props.postBuildSteps(postBuildSteps);
return this;
}
/**
* (experimental) GitHub workflow steps to execute before build.
*
* Default: []
*
* @return {@code this}
* @param preBuildSteps GitHub workflow steps to execute before build. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder preBuildSteps(final java.util.List extends io.github.cdklabs.cdkpipelines.github.JobStep> preBuildSteps) {
this.props.preBuildSteps(preBuildSteps);
return this;
}
/**
* (experimental) Indicates if the repository already contains a synthesized cdk.out
directory, in which case we will simply checkout the repo in jobs that require cdk.out
.
*
* Default: false
*
* @return {@code this}
* @param preSynthed Indicates if the repository already contains a synthesized cdk.out
directory, in which case we will simply checkout the repo in jobs that require cdk.out
. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder preSynthed(final java.lang.Boolean preSynthed) {
this.props.preSynthed(preSynthed);
return this;
}
/**
* (experimental) Will assume the GitHubActionRole in this region when publishing assets.
*
* This is NOT the region in which the assets are published.
*
* In most cases, you do not have to worry about this property, and can safely
* ignore it.
*
* Default: "us-west-2"
*
* @return {@code this}
* @param publishAssetsAuthRegion Will assume the GitHubActionRole in this region when publishing assets. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder publishAssetsAuthRegion(final java.lang.String publishAssetsAuthRegion) {
this.props.publishAssetsAuthRegion(publishAssetsAuthRegion);
return this;
}
/**
* (experimental) The type of runner to run the job on.
*
* The runner can be either a
* GitHub-hosted runner or a self-hosted runner.
*
* Default: Runner.UBUNTU_LATEST
*
* @return {@code this}
* @param runner The type of runner to run the job on. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder runner(final io.github.cdklabs.cdkpipelines.github.Runner runner) {
this.props.runner(runner);
return this;
}
/**
* (experimental) Name of the workflow.
*
* Default: "deploy"
*
* @return {@code this}
* @param workflowName Name of the workflow. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder workflowName(final java.lang.String workflowName) {
this.props.workflowName(workflowName);
return this;
}
/**
* (experimental) File path for the GitHub workflow.
*
* Default: ".github/workflows/deploy.yml"
*
* @return {@code this}
* @param workflowPath File path for the GitHub workflow. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder workflowPath(final java.lang.String workflowPath) {
this.props.workflowPath(workflowPath);
return this;
}
/**
* (experimental) GitHub workflow triggers.
*
* Default: - By default, workflow is triggered on push to the `main` branch
* and can also be triggered manually (`workflow_dispatch`).
*
* @return {@code this}
* @param workflowTriggers GitHub workflow triggers. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder workflowTriggers(final io.github.cdklabs.cdkpipelines.github.WorkflowTriggers workflowTriggers) {
this.props.workflowTriggers(workflowTriggers);
return this;
}
/**
* @return a newly built instance of {@link io.github.cdklabs.cdkpipelines.github.GitHubWorkflow}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public io.github.cdklabs.cdkpipelines.github.GitHubWorkflow build() {
return new io.github.cdklabs.cdkpipelines.github.GitHubWorkflow(
this.scope,
this.id,
this.props.build()
);
}
}
}