From 2abb84df90fcfce5504c7cd34bc32206619dcb34 Mon Sep 17 00:00:00 2001 From: Simon Kok Date: Wed, 30 Sep 2020 16:55:20 +0200 Subject: [PATCH] Fix specific role usage to be used in Build and Deploy only **Why?** A bug prevented stages like Approvals to be included in a pipeline. As the _generate_role_arn function tried to retrieve the specific role for the approval stage, while that stage doesn't support such properties. **What changed?** Added a check to look for specific roles in Build and Deploy stages only. All other stages should not use a specific role. --- .../adf-build/shared/cdk/cdk_constructs/adf_codepipeline.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/cdk/cdk_constructs/adf_codepipeline.py b/src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/cdk/cdk_constructs/adf_codepipeline.py index 4d07f25a8..7672f9651 100644 --- a/src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/cdk/cdk_constructs/adf_codepipeline.py +++ b/src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/cdk/cdk_constructs/adf_codepipeline.py @@ -43,6 +43,8 @@ def __init__(self, **kwargs): self.config = self.generate() def _generate_role_arn(self): + if self.category not in ['Build', 'Deploy']: + return None default_provider = self.map_params['default_providers'][self.category.lower()] specific_role = self.target.get('properties', {}).get('role') or default_provider.get('properties', {}).get('role') if specific_role: