primaryOutputFileSetprimary_outputFileSetprimaryOutputFileSetPrimaryOutputFileSetPrimaryOutputFileSet#Not all steps produce an output FileSet--if they do you can substitute the Step object for the FileSet object.
Factory for CodePipeline source steps.
This class contains a number of factory methods for the different types of sources that CodePipeline supports.
pipelines/lib/codepipeline/codepipeline-source.ts// Access the CommitId of a GitHub source in the synth
const source = pipelines.CodePipelineSource.gitHub('owner/repo', 'main');
const pipeline = new pipelines.CodePipeline(scope, 'MyPipeline', {
synth: new pipelines.ShellStep('Synth', {
input: source,
commands: [],
env: {
'COMMIT_ID': source.sourceAttribute('CommitId'),
}
})
});
new CodePipelineSource(id: string)
CodePipelineSource(id: str)
new CodePipelineSource(String id)
new CodePipelineSource(string id)
NewCodePipelineSource(Id *string)
consumedStackOutputsStackOutputReference[]consumed_stack_outputstyping.List[StackOutputReference]consumedStackOutputsList<StackOutputReference>ConsumedStackOutputsStackOutputReference[]ConsumedStackOutputs*[]StackOutputReferencerequired#dependenciesStep[]dependenciestyping.List[Step]dependenciesList<Step>DependenciesStep[]Dependencies*[]Steprequired#dependencyFileSetsFileSet[]dependency_file_setstyping.List[FileSet]dependencyFileSetsList<FileSet>DependencyFileSetsFileSet[]DependencyFileSets*[]FileSetrequired#What it means to be a Source step depends on the engine.
addStepDependency(step: Step): voiddef add_step_dependency(self, step: Step) -> Nonepublic void addStepDependency(Step step)public void AddStepDependency(Step step)func AddStepDependency(Step Step)#codeCommit(repository: IRepository, branch: string, props?: CodeCommitSourceOptions): CodePipelineSource // chainable@staticmethod def code_commit(repository: IRepository, branch: str, props: typing.Optional[CodeCommitSourceOptions] = None) -> CodePipelineSourcepublic static CodePipelineSource codeCommit(IRepository repository, String branch, CodeCommitSourceOptions props)public static CodePipelineSource CodeCommit(IRepository repository, string branch, CodeCommitSourceOptions? props = null)func CodeCommit(Repository IRepository, Branch *string, Props CodeCommitSourceOptions) CodePipelineSourcestatic#If you need access to symlinks or the repository history, be sure to set codeBuildCloneOutput.
Parameters
repositoryrepositoryrepositoryrepositoryRepository — The CodeCommit repository.branchbranchbranchbranchBranch — The branch to use.propspropspropspropsProps — The source properties.declare const repository: codecommit.IRepository;
pipelines.CodePipelineSource.codeCommit(repository, 'main');
connection(repoString: string, branch: string, props: ConnectionSourceOptions): CodePipelineSource // chainable@staticmethod def connection(repo_string: str, branch: str, props: ConnectionSourceOptions) -> CodePipelineSourcepublic static CodePipelineSource connection(String repoString, String branch, ConnectionSourceOptions props)public static CodePipelineSource Connection(string repoString, string branch, ConnectionSourceOptions props)func Connection(RepoString *string, Branch *string, Props ConnectionSourceOptions) CodePipelineSourcestatic#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:
pipelines.CodePipelineSource.connection('owner/repo', 'main', {
connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console
});
If you need access to symlinks or the repository history, be sure to set codeBuildCloneOutput.
Parameters
repoStringrepo_stringrepoStringrepoStringRepoString — A string that encodes owner and repository separated by a slash (e.g. 'owner/repo'). The provided string must be resolvable at runtime.branchbranchbranchbranchBranch — The branch to use.propspropspropspropsProps — The source properties, including the connection ARN.ecr(repository: IRepositoryRef, props?: ECRSourceOptions): CodePipelineSource // chainable@staticmethod def ecr(repository: IRepositoryRef, props: typing.Optional[ECRSourceOptions] = None) -> CodePipelineSourcepublic static CodePipelineSource ecr(IRepositoryRef repository, ECRSourceOptions props)public static CodePipelineSource Ecr(IRepositoryRef repository, ECRSourceOptions? props = null)func Ecr(Repository IRepositoryRef, Props ECRSourceOptions) CodePipelineSourcestatic#Parameters
repositoryrepositoryrepositoryrepositoryRepository — The repository that will be watched for changes.propspropspropspropsProps — The options, which include the image tag to be checked for changes.declare const repository: ecr.IRepository;
pipelines.CodePipelineSource.ecr(repository, {
imageTag: 'latest',
});
gitHub(repoString: string, branch: string, props?: GitHubSourceOptions): CodePipelineSource // chainable@staticmethod def git_hub(repo_string: str, branch: str, props: typing.Optional[GitHubSourceOptions] = None) -> CodePipelineSourcepublic static CodePipelineSource gitHub(String repoString, String branch, GitHubSourceOptions props)public static CodePipelineSource GitHub(string repoString, string branch, GitHubSourceOptions? props = null)func GitHub(RepoString *string, Branch *string, Props GitHubSourceOptions) CodePipelineSourcestatic#This is no longer the recommended method. Please consider using connection() instead.
Pass in the owner and repository in a single string, like this:
pipelines.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.
produceAction(stage: IStage, options: ProduceActionOptions): CodePipelineActionFactoryResultdef produce_action(self, stage: IStage, options: ProduceActionOptions) -> CodePipelineActionFactoryResultpublic CodePipelineActionFactoryResult produceAction(IStage stage, ProduceActionOptions options)public CodePipelineActionFactoryResult ProduceAction(IStage stage, ProduceActionOptions options)func ProduceAction(Stage IStage, Options ProduceActionOptions) CodePipelineActionFactoryResult#s3(bucket: IBucket, objectKey: string, props?: S3SourceOptions): CodePipelineSource // chainable@staticmethod def s3(bucket: IBucket, object_key: str, props: typing.Optional[S3SourceOptions] = None) -> CodePipelineSourcepublic static CodePipelineSource s3(IBucket bucket, String objectKey, S3SourceOptions props)public static CodePipelineSource S3(IBucket bucket, string objectKey, S3SourceOptions? props = null)func S3(Bucket IBucket, ObjectKey *string, Props S3SourceOptions) CodePipelineSourcestatic#Parameters
bucketbucketbucketbucketBucket — The bucket where the source code is located.propspropspropspropsProps — The options, which include the key that identifies the source code file and and how the pipeline should be triggered.declare const bucket: s3.Bucket;
pipelines.CodePipelineSource.s3(bucket, 'path/to/file.zip');
sequence(steps: Step[]): Step[]@staticmethod def sequence(steps: typing.List[Step]) -> typing.List[Step]public static List<Step> sequence(List<Step> steps)public static Step[] Sequence(Step[] steps)func Sequence(Steps *[]Step) *[]Stepstatic#If you need more fine-grained step ordering, use the addStepDependency() API. For example, if you want secondStep to occur after firstStep, call secondStep.addStepDependency(firstStep).
sourceAttribute(name: string): stringdef source_attribute(self, name: str) -> strpublic String sourceAttribute(String name)public string SourceAttribute(string name)func SourceAttribute(Name *string) *string#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.
// Access the CommitId of a GitHub source in the synth
const source = pipelines.CodePipelineSource.gitHub('owner/repo', 'main');
const pipeline = new pipelines.CodePipeline(scope, 'MyPipeline', {
synth: new pipelines.ShellStep('Synth', {
input: source,
commands: [],
env: {
'COMMIT_ID': source.sourceAttribute('CommitId'),
}
})
});
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#