@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:42.933Z") @Stability(value=Stable) public abstract class CodePipelineSource extends Step implements ICodePipelineActionFactory
This class contains a number of factory methods for the different types of sources that CodePipeline supports.
Example:
// Access the CommitId of a GitHub source in the synth
CodePipelineSource source = CodePipelineSource.gitHub("owner/repo", "main");
CodePipeline pipeline = CodePipeline.Builder.create(scope, "MyPipeline")
.synth(ShellStep.Builder.create("Synth")
.input(source)
.commands(List.of())
.env(Map.of(
"COMMIT_ID", source.sourceAttribute("CommitId")))
.build())
.build();
software.amazon.jsii.JsiiObject.InitializationModeICodePipelineActionFactory.Jsii$DefaultIFileSetProducer.Jsii$Default| Modifier | Constructor and Description |
|---|---|
protected |
CodePipelineSource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CodePipelineSource(software.amazon.jsii.JsiiObjectRef objRef) |
protected |
CodePipelineSource(String id) |
| Modifier and Type | Method and Description |
|---|---|
static CodePipelineSource |
codeCommit(IRepository repository,
String branch)
Returns a CodeCommit source.
|
static CodePipelineSource |
codeCommit(IRepository repository,
String branch,
CodeCommitSourceOptions props)
Returns a CodeCommit source.
|
static CodePipelineSource |
connection(String repoString,
String branch,
ConnectionSourceOptions props)
Returns a CodeStar connection source.
|
static CodePipelineSource |
ecr(IRepository repository)
Returns an ECR source.
|
static CodePipelineSource |
ecr(IRepository repository,
ECRSourceOptions props)
Returns an ECR source.
|
protected abstract Action |
getAction(Artifact output,
String actionName,
Number runOrder) |
protected abstract Action |
getAction(Artifact output,
String actionName,
Number runOrder,
String variablesNamespace) |
Boolean |
getIsSource()
Whether or not this is a Source step.
|
static CodePipelineSource |
gitHub(String repoString,
String branch)
Returns a GitHub source, using OAuth tokens to authenticate with GitHub and a separate webhook to detect changes.
|
static CodePipelineSource |
gitHub(String repoString,
String branch,
GitHubSourceOptions props)
Returns a GitHub source, using OAuth tokens to authenticate with GitHub and a separate webhook to detect changes.
|
CodePipelineActionFactoryResult |
produceAction(IStage stage,
ProduceActionOptions options)
Create the desired Action and add it to the pipeline.
|
static CodePipelineSource |
s3(IBucket bucket,
String objectKey)
Returns an S3 source.
|
static CodePipelineSource |
s3(IBucket bucket,
String objectKey,
S3SourceOptions props)
Returns an S3 source.
|
String |
sourceAttribute(String name)
Return an attribute of the current source revision.
|
addDependencyFileSet, addStepDependency, configurePrimaryOutput, discoverReferencedOutputs, getDependencies, getDependencyFileSets, getId, getPrimaryOutput, sequence, toStringjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected CodePipelineSource(software.amazon.jsii.JsiiObjectRef objRef)
protected CodePipelineSource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
protected CodePipelineSource(@NotNull
String id)
id - Identifier for this step. This parameter is required.@Stability(value=Stable) @NotNull public static CodePipelineSource codeCommit(@NotNull IRepository repository, @NotNull String branch, @Nullable CodeCommitSourceOptions props)
If you need access to symlinks or the repository history, be sure to set
codeBuildCloneOutput.
Example:
IRepository repository; CodePipelineSource.codeCommit(repository, "main");
repository - The CodeCommit repository. This parameter is required.branch - The branch to use. This parameter is required.props - The source properties.@Stability(value=Stable) @NotNull public static CodePipelineSource codeCommit(@NotNull IRepository repository, @NotNull String branch)
If you need access to symlinks or the repository history, be sure to set
codeBuildCloneOutput.
Example:
IRepository repository; CodePipelineSource.codeCommit(repository, "main");
repository - The CodeCommit repository. This parameter is required.branch - The branch to use. This parameter is required.@Stability(value=Stable) @NotNull public static CodePipelineSource connection(@NotNull String repoString, @NotNull String branch, @NotNull ConnectionSourceOptions props)
A CodeStar connection allows AWS CodePipeline to access external resources, such as repositories in GitHub, GitHub Enterprise or BitBucket.
To use this method, you first need to create a CodeStar connection using the AWS console. In the process, you may have to sign in to the external provider -- GitHub, for example -- to authorize AWS to read and modify your repository. Once you have done this, copy the connection ARN and use it to create the source.
Example:
CodePipelineSource.connection("owner/repo", "main", ConnectionSourceOptions.builder()
.connectionArn("arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41")
.build());
If you need access to symlinks or the repository history, be sure to set
codeBuildCloneOutput.
repoString - A string that encodes owner and repository separated by a slash (e.g. 'owner/repo'). This parameter is required.branch - The branch to use. This parameter is required.props - The source properties, including the connection ARN. This parameter is required.@Stability(value=Stable) @NotNull public static CodePipelineSource ecr(@NotNull IRepository repository, @Nullable ECRSourceOptions props)
Example:
IRepository repository;
CodePipelineSource.ecr(repository, ECRSourceOptions.builder()
.imageTag("latest")
.build());
repository - The repository that will be watched for changes. This parameter is required.props - The options, which include the image tag to be checked for changes.@Stability(value=Stable) @NotNull public static CodePipelineSource ecr(@NotNull IRepository repository)
Example:
IRepository repository;
CodePipelineSource.ecr(repository, ECRSourceOptions.builder()
.imageTag("latest")
.build());
repository - The repository that will be watched for changes. This parameter is required.@Stability(value=Stable) @NotNull public static CodePipelineSource gitHub(@NotNull String repoString, @NotNull String branch, @Nullable GitHubSourceOptions props)
This is no longer
the recommended method. Please consider using connection()
instead.
Pass in the owner and repository in a single string, like this:
CodePipelineSource.gitHub("owner/repo", "main");
Authentication will be done by a secret called github-token in AWS
Secrets Manager (unless specified otherwise).
If you rotate the value in the Secret, you must also change at least one property on the Pipeline, to force CloudFormation to re-read the secret.
The token should have these permissions:
If you need access to symlinks or the repository history, use a source of type
connection instead.
repoString - This parameter is required.branch - This parameter is required.props - @Stability(value=Stable) @NotNull public static CodePipelineSource gitHub(@NotNull String repoString, @NotNull String branch)
This is no longer
the recommended method. Please consider using connection()
instead.
Pass in the owner and repository in a single string, like this:
CodePipelineSource.gitHub("owner/repo", "main");
Authentication will be done by a secret called github-token in AWS
Secrets Manager (unless specified otherwise).
If you rotate the value in the Secret, you must also change at least one property on the Pipeline, to force CloudFormation to re-read the secret.
The token should have these permissions:
If you need access to symlinks or the repository history, use a source of type
connection instead.
repoString - This parameter is required.branch - This parameter is required.@Stability(value=Stable) @NotNull public static CodePipelineSource s3(@NotNull IBucket bucket, @NotNull String objectKey, @Nullable S3SourceOptions props)
Example:
Bucket bucket; CodePipelineSource.s3(bucket, "path/to/file.zip");
bucket - The bucket where the source code is located. This parameter is required.objectKey - This parameter is required.props - The options, which include the key that identifies the source code file and and how the pipeline should be triggered.@Stability(value=Stable) @NotNull public static CodePipelineSource s3(@NotNull IBucket bucket, @NotNull String objectKey)
Example:
Bucket bucket; CodePipelineSource.s3(bucket, "path/to/file.zip");
bucket - The bucket where the source code is located. This parameter is required.objectKey - This parameter is required.@Stability(value=Stable) @NotNull protected abstract Action getAction(@NotNull Artifact output, @NotNull String actionName, @NotNull Number runOrder, @Nullable String variablesNamespace)
output - This parameter is required.actionName - This parameter is required.runOrder - This parameter is required.variablesNamespace - @Stability(value=Stable) @NotNull protected abstract Action getAction(@NotNull Artifact output, @NotNull String actionName, @NotNull Number runOrder)
output - This parameter is required.actionName - This parameter is required.runOrder - This parameter is required.@Stability(value=Stable) @NotNull public CodePipelineActionFactoryResult produceAction(@NotNull IStage stage, @NotNull ProduceActionOptions options)
produceAction in interface ICodePipelineActionFactorystage - This parameter is required.options - This parameter is required.@Stability(value=Stable) @NotNull public String sourceAttribute(@NotNull String name)
These values can be passed into the environment variables of pipeline steps, so your steps can access information about the source revision.
Pipeline synth step has some source attributes predefined in the environment. If these suffice, you don't need to use this method for the synth step.
Example:
// Access the CommitId of a GitHub source in the synth
CodePipelineSource source = CodePipelineSource.gitHub("owner/repo", "main");
CodePipeline pipeline = CodePipeline.Builder.create(scope, "MyPipeline")
.synth(ShellStep.Builder.create("Synth")
.input(source)
.commands(List.of())
.env(Map.of(
"COMMIT_ID", source.sourceAttribute("CommitId")))
.build())
.build();
name - This parameter is required.@Stability(value=Stable) @NotNull public Boolean getIsSource()
What it means to be a Source step depends on the engine.
getIsSource in class StepCopyright © 2022. All rights reserved.