CodePipelineConfig¶
Bases: BaseModel, AwsTypesValidationMixin
Configuration model for AWS CodePipeline creation and management.
Defines the complete structure and validation rules for creating CodePipeline workflows with different usage patterns (BUILD_RELEASE, BUILD_DEPLOY, DEPLOY), git integration, artifact management, and comprehensive stage validation.
Attributes:
| Name | Type | Description |
|---|---|---|
usage |
Usage
|
Pipeline usage pattern determining required stages and validation |
stages |
StagesConfig
|
Complete stage configuration with individual actions |
restart_execution_on_update |
bool
|
Restart pipeline execution when updated |
git_provider |
GitProvider
|
Git provider for source code (currently CodeCommit only) |
git_repo |
Any
|
Git repository containing source code |
git_branch |
str
|
Git branch to monitor for changes |
is_dev_branch |
bool
|
Flag indicating development branch for different behaviors |
artifact_bucket |
Optional[Any]
|
S3 bucket for storing pipeline artifacts |
release_bucket |
Optional[Any]
|
S3 bucket for storing release artifacts |
target_env |
Optional[str]
|
Target environment for deployment pipelines |
Validation Rules
- Usage-specific stage requirements
- Stage-specific field requirements based on action types
- Artifact reference validation between stages
- CloudFormation deployment parameter validation
Source code in mare_aws_common_lib/models/codepipeline_config.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | |
typed
property
¶
Access to type-safe AWS CDK resource properties, references the Typed inner class.
Typed
¶
Inner class, Type-safe accessor for AWS CDK resources with proper typing.
Source code in mare_aws_common_lib/models/codepipeline_config.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
validate_artifact_bucket(value)
classmethod
¶
Validate S3 bucket objects implement s3.IBucket interface.
Source code in mare_aws_common_lib/models/codepipeline_config.py
239 240 241 242 243 | |
validate_git_provider(value)
classmethod
¶
Validate git provider is supported (currently CodeCommit only).
Source code in mare_aws_common_lib/models/codepipeline_config.py
225 226 227 228 229 230 231 | |
validate_git_repo(value, info)
classmethod
¶
Validate git repository object implements codecommit.IRepository interface.
Source code in mare_aws_common_lib/models/codepipeline_config.py
233 234 235 236 237 | |
validate_stages_configuration()
¶
Validate complete stage configuration for consistency and requirements.
Returns:
| Type | Description |
|---|---|
CodePipelineConfig
|
Self with validated stage configuration |
Raises:
| Type | Description |
|---|---|
ValueError
|
If stage configuration is invalid for the usage type |
ValueError
|
If required stage items or fields are missing |
ValueError
|
If artifact references are invalid |
Source code in mare_aws_common_lib/models/codepipeline_config.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
validate_usage_requirements()
¶
Validate usage-specific required fields are present.
Returns:
| Type | Description |
|---|---|
CodePipelineConfig
|
Self with validated usage requirements |
Raises:
| Type | Description |
|---|---|
ValueError
|
If required fields for the usage type are missing |
Source code in mare_aws_common_lib/models/codepipeline_config.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
Example
from mare_aws_common_lib.models import CodePipelineConfig, StagesConfig, StageItemConfig
from mare_aws_common_lib.enums import Usage, GitProvider, ActionType
from aws_cdk import aws_codecommit as codecommit, aws_codebuild as codebuild
config = CodePipelineConfig(
usage=Usage.BUILD_RELEASE,
git_provider=GitProvider.CODECOMMIT,
git_repo=codecommit_repository,
git_branch="main",
is_dev_branch=False,
artifact_bucket=artifacts_s3_bucket,
release_bucket=releases_s3_bucket,
restart_execution_on_update=True,
stages=StagesConfig(
build={
"compile": StageItemConfig(
run_order=1,
build_project=build_codebuild_project,
output_names=["BuildArtifact"]
)
},
release={
"publish": StageItemConfig(
run_order=1,
action_type=ActionType.S3,
artifact_id="compile",
deploy_bucket=releases_s3_bucket
)
}
)
)
StagesConfig
¶
Bases: BaseModel
Configuration model for CodePipeline stage definitions.
Defines the complete set of pipeline stages with their individual action configurations. Each stage contains a dictionary of named actions that execute according to their run_order and action_type specifications.
Attributes:
| Name | Type | Description |
|---|---|---|
source |
Optional[Dict[str, StageItemConfig]]
|
Source stage for automatic git repository polling |
manual_source |
Optional[Dict[str, StageItemConfig]]
|
Manual source stage for artifact-based deployments |
control |
Optional[Dict[str, StageItemConfig]]
|
Control stage for pipeline validation and gating |
manual_approval |
Optional[bool]
|
Flag to include manual approval stage |
self_mutate |
Optional[Dict[str, StageItemConfig]]
|
Self-mutation stage for pipeline updates |
build |
Optional[Dict[str, StageItemConfig]]
|
Build stage for compilation and testing |
release |
Optional[Dict[str, StageItemConfig]]
|
Release stage for artifact publishing |
publish |
Optional[Dict[str, StageItemConfig]]
|
Publish stage for package/image publishing |
deploy |
Optional[Dict[str, StageItemConfig]]
|
Deploy stage for environment deployment |
Source code in mare_aws_common_lib/models/codepipeline_config.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
Example
from mare_aws_common_lib.models import StagesConfig, StageItemConfig
stages = StagesConfig(
build={
"unit-tests": StageItemConfig(
run_order=1,
build_project=unit_test_project,
output_names=["TestResults"]
),
"compile": StageItemConfig(
run_order=2,
build_project=compilation_project,
output_names=["BuildArtifacts"]
),
"integration-tests": StageItemConfig(
run_order=3,
build_project=integration_test_project,
extra_inputs=["TestResults"],
artifact_id="compile"
)
}
)
StageItemConfig
¶
Bases: BaseModel, AwsTypesValidationMixin
Configuration model for individual CodePipeline stage actions.
Defines the structure and validation rules for pipeline stage actions including build actions, deployment actions, and artifact management. Supports different action types with specific validation requirements for each action configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
run_order |
int
|
Execution order within the stage (determines parallel vs sequential execution) |
action_type |
Optional[ActionType]
|
Type of action (CODEBUILD, CLOUDFORMATION, S3, etc.) |
build_project |
Optional[Any]
|
CodeBuild project for build and custom actions |
action_env_vars |
Optional[Dict[str, Any]]
|
Environment variables for CodeBuild actions |
extra_inputs |
Optional[List[str]]
|
Additional input artifact names beyond primary input |
artifact_id |
Optional[str]
|
ID of the input artifact from previous stages |
output_names |
Optional[List[str]]
|
Names of output artifacts produced by this action |
action_role |
Optional[Any]
|
IAM role for action execution permissions |
deployment_role |
Optional[Any]
|
IAM role for CloudFormation deployment operations |
stack_base_path |
Optional[str]
|
Base path for CloudFormation templates in repository |
stack_name |
Optional[str]
|
CloudFormation stack name for deployment actions |
deploy_env |
Optional[str]
|
Target environment for deployment (dev, test, prod) |
deploy_bucket |
Optional[Any]
|
S3 bucket for S3 deployment actions |
Source code in mare_aws_common_lib/models/codepipeline_config.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
typed
property
¶
Access to type-safe AWS CDK resource properties, references the Typed inner class.
Typed
¶
Inner class, Type-safe accessor for AWS CDK resources with proper typing.
Source code in mare_aws_common_lib/models/codepipeline_config.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
validate_action_env_vars(value)
classmethod
¶
Validate environment variables are proper CodeBuild format.
Source code in mare_aws_common_lib/models/codepipeline_config.py
95 96 97 98 99 | |
validate_action_role(value)
classmethod
¶
Validate IAM role objects implement iam.IRole interface.
Source code in mare_aws_common_lib/models/codepipeline_config.py
101 102 103 104 105 | |
validate_build_project(value)
classmethod
¶
Validate CodeBuild project object implements proper interface.
Source code in mare_aws_common_lib/models/codepipeline_config.py
87 88 89 90 91 92 93 | |
validate_deploy_bucket(value)
classmethod
¶
Validate S3 bucket object implements s3.IBucket interface.
Source code in mare_aws_common_lib/models/codepipeline_config.py
107 108 109 110 111 | |
Example
from mare_aws_common_lib.models import StageItemConfig
from aws_cdk import aws_codebuild as codebuild
# Build action with CodeBuild project
build_action = StageItemConfig(
run_order=1,
build_project=my_codebuild_project,
action_env_vars={
"ENVIRONMENT": codebuild.BuildEnvironmentVariable(value="production"),
"BUILD_NUMBER": codebuild.BuildEnvironmentVariable(value="${CODEBUILD_BUILD_NUMBER}")
},
output_names=["BuildArtifacts", "TestReports"]
)