Class: AWSCDK::Pipelines::CodePipelineSource
- Inherits:
-
Step
- Object
- Step
- AWSCDK::Pipelines::CodePipelineSource
- Includes:
- ICodePipelineActionFactory
- Defined in:
- pipelines/code_pipeline_source.rb
Overview
Factory for CodePipeline source steps.
This class contains a number of factory methods for the different types of sources that CodePipeline supports.
Class Method Summary collapse
-
.code_commit(repository, branch, props = nil) ⇒ AWSCDK::Pipelines::CodePipelineSource
Returns a CodeCommit source.
-
.connection(repo_string, branch, props) ⇒ AWSCDK::Pipelines::CodePipelineSource
Returns a CodeStar connection source.
-
.ecr(repository, props = nil) ⇒ AWSCDK::Pipelines::CodePipelineSource
Returns an ECR source.
-
.git_hub(repo_string, branch, props = nil) ⇒ AWSCDK::Pipelines::CodePipelineSource
Returns a GitHub source, using OAuth tokens to authenticate with GitHub and a separate webhook to detect changes.
- .jsii_overridable_methods ⇒ Object
-
.s3(bucket, object_key, props = nil) ⇒ AWSCDK::Pipelines::CodePipelineSource
Returns an S3 source.
Instance Method Summary collapse
-
#add_dependency_file_set(fs) ⇒ void
Add an additional FileSet to the set of file sets required by this step.
-
#add_step_dependency(step) ⇒ void
Add a dependency on another step.
-
#configure_primary_output(fs) ⇒ void
Configure the given FileSet as the primary output of this step.
-
#consumed_stack_outputs ⇒ Array<AWSCDK::Pipelines::StackOutputReference>
StackOutputReferences this step consumes.
-
#dependencies ⇒ Array<AWSCDK::Pipelines::Step>
Return the steps this step depends on, based on the FileSets it requires.
-
#dependency_file_sets ⇒ Array<AWSCDK::Pipelines::FileSet>
The list of FileSets consumed by this Step.
-
#discover_referenced_outputs(structure) ⇒ void
Crawl the given structure for references to StepOutputs and add dependencies on all steps found.
- #get_action(output, action_name, run_order, variables_namespace = nil) ⇒ AWSCDK::CodePipelineActions::Action
-
#id ⇒ String
Identifier for this step.
-
#initialize(id) ⇒ CodePipelineSource
constructor
A new instance of CodePipelineSource.
-
#is_source ⇒ Boolean
Whether or not this is a Source step.
-
#primary_output ⇒ AWSCDK::Pipelines::FileSet?
The primary FileSet produced by this Step.
-
#produce_action(stage, options) ⇒ AWSCDK::Pipelines::CodePipelineActionFactoryResult
Create the desired Action and add it to the pipeline.
-
#source_attribute(name) ⇒ String
Return an attribute of the current source revision.
-
#to_string ⇒ String
Return a string representation of this Step.
Constructor Details
#initialize(id) ⇒ CodePipelineSource
Returns a new instance of CodePipelineSource.
13 14 15 16 |
# File 'pipelines/code_pipeline_source.rb', line 13 def initialize(id) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Object.instance_method(:initialize).bind(self).call(id) end |
Class Method Details
.code_commit(repository, branch, props = nil) ⇒ AWSCDK::Pipelines::CodePipelineSource
Returns a CodeCommit source.
If you need access to symlinks or the repository history, be sure to set
code_build_clone_output.
50 51 52 53 54 55 56 |
# File 'pipelines/code_pipeline_source.rb', line 50 def self.code_commit(repository, branch, props = nil) Jsii::Type.check_type(repository, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWNvbW1pdC5JUmVwb3NpdG9yeSJ9")), "repository") Jsii::Type.check_type(branch, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "branch") props = props.is_a?(Hash) ? ::AWSCDK::Pipelines::CodeCommitSourceOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuQ29kZUNvbW1pdFNvdXJjZU9wdGlvbnMifQ==")), "props") unless props.nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.pipelines.CodePipelineSource", "codeCommit", [repository, branch, props]) end |
.connection(repo_string, branch, props) ⇒ AWSCDK::Pipelines::CodePipelineSource
Returns a CodeStar connection source.
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:
AWSCDK::Pipelines::CodePipelineSource.connection("owner/repo", "main", {
connection_arn: "arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41",
})
If you need access to symlinks or the repository history, be sure to set
code_build_clone_output.
85 86 87 88 89 90 91 |
# File 'pipelines/code_pipeline_source.rb', line 85 def self.connection(repo_string, branch, props) Jsii::Type.check_type(repo_string, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "repoString") Jsii::Type.check_type(branch, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "branch") props = props.is_a?(Hash) ? ::AWSCDK::Pipelines::ConnectionSourceOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuQ29ubmVjdGlvblNvdXJjZU9wdGlvbnMifQ==")), "props") Jsii::Kernel.instance.call_static("aws-cdk-lib.pipelines.CodePipelineSource", "connection", [repo_string, branch, props]) end |
.ecr(repository, props = nil) ⇒ AWSCDK::Pipelines::CodePipelineSource
Returns an ECR source.
104 105 106 107 108 109 |
# File 'pipelines/code_pipeline_source.rb', line 104 def self.ecr(repository, props = nil) Jsii::Type.check_type(repository, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19lY3IuSVJlcG9zaXRvcnlSZWYifQ==")), "repository") props = props.is_a?(Hash) ? ::AWSCDK::Pipelines::ECRSourceOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuRUNSU291cmNlT3B0aW9ucyJ9")), "props") unless props.nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.pipelines.CodePipelineSource", "ecr", [repository, props]) end |
.git_hub(repo_string, branch, props = nil) ⇒ AWSCDK::Pipelines::CodePipelineSource
Returns a GitHub source, using OAuth tokens to authenticate with GitHub and a separate webhook to detect changes.
This is no longer
the recommended method. Please consider using connection()
instead.
Pass in the owner and repository in a single string, like this:
AWSCDK::Pipelines::CodePipelineSource.git_hub("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:
- repo - to read the repository
- admin:repo_hook - if you plan to use webhooks (true by default)
If you need access to symlinks or the repository history, use a source of type
connection instead.
141 142 143 144 145 146 147 |
# File 'pipelines/code_pipeline_source.rb', line 141 def self.git_hub(repo_string, branch, props = nil) Jsii::Type.check_type(repo_string, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "repoString") Jsii::Type.check_type(branch, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "branch") props = props.is_a?(Hash) ? ::AWSCDK::Pipelines::GitHubSourceOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuR2l0SHViU291cmNlT3B0aW9ucyJ9")), "props") unless props.nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.pipelines.CodePipelineSource", "gitHub", [repo_string, branch, props]) end |
.jsii_overridable_methods ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'pipelines/code_pipeline_source.rb', line 18 def self.jsii_overridable_methods { :consumed_stack_outputs => { kind: :property, name: "consumedStackOutputs", is_optional: false }, :dependencies => { kind: :property, name: "dependencies", is_optional: false }, :dependency_file_sets => { kind: :property, name: "dependencyFileSets", is_optional: false }, :id => { kind: :property, name: "id", is_optional: false }, :is_source => { kind: :property, name: "isSource", is_optional: false }, :primary_output => { kind: :property, name: "primaryOutput", is_optional: true }, :add_dependency_file_set => { kind: :method, name: "addDependencyFileSet", is_optional: false }, :add_step_dependency => { kind: :method, name: "addStepDependency", is_optional: false }, :configure_primary_output => { kind: :method, name: "configurePrimaryOutput", is_optional: false }, :discover_referenced_outputs => { kind: :method, name: "discoverReferencedOutputs", is_optional: false }, :to_string => { kind: :method, name: "toString", is_optional: false }, :get_action => { kind: :method, name: "getAction", is_optional: false }, :produce_action => { kind: :method, name: "produceAction", is_optional: false }, :source_attribute => { kind: :method, name: "sourceAttribute", is_optional: false }, } end |
.s3(bucket, object_key, props = nil) ⇒ AWSCDK::Pipelines::CodePipelineSource
Returns an S3 source.
159 160 161 162 163 164 165 |
# File 'pipelines/code_pipeline_source.rb', line 159 def self.s3(bucket, object_key, props = nil) Jsii::Type.check_type(bucket, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuSUJ1Y2tldCJ9")), "bucket") Jsii::Type.check_type(object_key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "objectKey") props = props.is_a?(Hash) ? ::AWSCDK::Pipelines::S3SourceOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuUzNTb3VyY2VPcHRpb25zIn0=")), "props") unless props.nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.pipelines.CodePipelineSource", "s3", [bucket, object_key, props]) end |
Instance Method Details
#add_dependency_file_set(fs) ⇒ void
This method returns an undefined value.
Add an additional FileSet to the set of file sets required by this step.
This will lead to a dependency on the producer of that file set.
220 221 222 223 |
# File 'pipelines/code_pipeline_source.rb', line 220 def add_dependency_file_set(fs) Jsii::Type.check_type(fs, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuRmlsZVNldCJ9")), "fs") jsii_call_method("addDependencyFileSet", [fs]) end |
#add_step_dependency(step) ⇒ void
This method returns an undefined value.
Add a dependency on another step.
229 230 231 232 |
# File 'pipelines/code_pipeline_source.rb', line 229 def add_step_dependency(step) Jsii::Type.check_type(step, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuU3RlcCJ9")), "step") jsii_call_method("addStepDependency", [step]) end |
#configure_primary_output(fs) ⇒ void
This method returns an undefined value.
Configure the given FileSet as the primary output of this step.
238 239 240 241 |
# File 'pipelines/code_pipeline_source.rb', line 238 def configure_primary_output(fs) Jsii::Type.check_type(fs, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuRmlsZVNldCJ9")), "fs") jsii_call_method("configurePrimaryOutput", [fs]) end |
#consumed_stack_outputs ⇒ Array<AWSCDK::Pipelines::StackOutputReference>
StackOutputReferences this step consumes.
170 171 172 |
# File 'pipelines/code_pipeline_source.rb', line 170 def consumed_stack_outputs() jsii_get_property("consumedStackOutputs") end |
#dependencies ⇒ Array<AWSCDK::Pipelines::Step>
Return the steps this step depends on, based on the FileSets it requires.
177 178 179 |
# File 'pipelines/code_pipeline_source.rb', line 177 def dependencies() jsii_get_property("dependencies") end |
#dependency_file_sets ⇒ Array<AWSCDK::Pipelines::FileSet>
The list of FileSets consumed by this Step.
184 185 186 |
# File 'pipelines/code_pipeline_source.rb', line 184 def dependency_file_sets() jsii_get_property("dependencyFileSets") end |
#discover_referenced_outputs(structure) ⇒ void
This method returns an undefined value.
Crawl the given structure for references to StepOutputs and add dependencies on all steps found.
Should be called in the constructor of subclasses based on what the user passes in as construction properties. The format of the structure passed in here does not have to correspond exactly to what gets rendered into the engine, it just needs to contain the same data.
252 253 254 255 |
# File 'pipelines/code_pipeline_source.rb', line 252 def discover_referenced_outputs(structure) Jsii::Type.check_type(structure, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "structure") jsii_call_method("discoverReferencedOutputs", [structure]) end |
#get_action(output, action_name, run_order, variables_namespace = nil) ⇒ AWSCDK::CodePipelineActions::Action
269 270 271 272 273 274 275 |
# File 'pipelines/code_pipeline_source.rb', line 269 def get_action(output, action_name, run_order, variables_namespace = nil) Jsii::Type.check_type(output, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZXBpcGVsaW5lLkFydGlmYWN0In0=")), "output") Jsii::Type.check_type(action_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "actionName") Jsii::Type.check_type(run_order, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "runOrder") Jsii::Type.check_type(variables_namespace, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "variablesNamespace") unless variables_namespace.nil? jsii_call_method("getAction", [output, action_name, run_order, variables_namespace]) end |
#id ⇒ String
Identifier for this step.
191 192 193 |
# File 'pipelines/code_pipeline_source.rb', line 191 def id() jsii_get_property("id") end |
#is_source ⇒ Boolean
Whether or not this is a Source step.
What it means to be a Source step depends on the engine.
200 201 202 |
# File 'pipelines/code_pipeline_source.rb', line 200 def is_source() jsii_get_property("isSource") end |
#primary_output ⇒ AWSCDK::Pipelines::FileSet?
The primary FileSet produced by this Step.
Not all steps produce an output FileSet--if they do
you can substitute the Step object for the FileSet object.
210 211 212 |
# File 'pipelines/code_pipeline_source.rb', line 210 def primary_output() jsii_get_property("primaryOutput") end |
#produce_action(stage, options) ⇒ AWSCDK::Pipelines::CodePipelineActionFactoryResult
Create the desired Action and add it to the pipeline.
282 283 284 285 286 287 |
# File 'pipelines/code_pipeline_source.rb', line 282 def produce_action(stage, ) Jsii::Type.check_type(stage, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZXBpcGVsaW5lLklTdGFnZSJ9")), "stage") = .is_a?(Hash) ? ::AWSCDK::Pipelines::ProduceActionOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuUHJvZHVjZUFjdGlvbk9wdGlvbnMifQ==")), "options") jsii_call_method("produceAction", [stage, ]) end |
#source_attribute(name) ⇒ String
Return an attribute of the current source revision.
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.
313 314 315 316 |
# File 'pipelines/code_pipeline_source.rb', line 313 def source_attribute(name) Jsii::Type.check_type(name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name") jsii_call_method("sourceAttribute", [name]) end |
#to_string ⇒ String
Return a string representation of this Step.
260 261 262 |
# File 'pipelines/code_pipeline_source.rb', line 260 def to_string() jsii_call_method("toString", []) end |