Skip to content

Commit

Permalink
making multiple variables
Browse files Browse the repository at this point in the history
  • Loading branch information
eamonnfaherty committed Oct 15, 2024
1 parent 8f99909 commit a52ff38
Showing 1 changed file with 55 additions and 9 deletions.
64 changes: 55 additions & 9 deletions servicecatalog_puppet/template_builder/hub/bootstrap.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import json

import troposphere as t
import yaml
Expand All @@ -17,8 +18,6 @@

from servicecatalog_puppet import config, constants, environmental_variables

single_account_or_action_configuration_parameter_name="single_account_or_action_configuration"

def get_template(
puppet_version,
all_regions,
Expand Down Expand Up @@ -962,7 +961,14 @@ def get_template(
Configuration={
"ProjectName": t.Ref("DeployProject"),
"PrimarySource": "Source",
"EnvironmentVariables": '[{"name":"EXECUTION_ID","value":"#{codepipeline.PipelineExecutionId}","type":"PLAINTEXT"},{"name":"SINGLE_ACCOUNT_OR_ACTION_CONFIGURATION","value":"#{variables.'+single_account_or_action_configuration_parameter_name+'}","type":"PLAINTEXT"}]', #EPF
"EnvironmentVariables": json.dumps([
{"name": "EXECUTION_ID", "value": "#{codepipeline.PipelineExecutionId}", "type": "PLAINTEXT"},
{"name":"SINGLE_ACCOUNT","value":"#{variables.SINGLE_ACCOUNT}","type":"PLAINTEXT"},
{"name":"SINGLE_ACTION_SECTION","value":"#{variables.SINGLE_ACTION_SECTION}","type":"PLAINTEXT"},
{"name":"SINGLE_ACTION_ITEM","value":"#{variables.SINGLE_ACTION_ITEM}","type":"PLAINTEXT"},
{"name":"SINGLE_ACTION_INCLUDE_DEPENDENCIES","value":"#{variables.SINGLE_ACTION_INCLUDE_DEPENDENCIES}","type":"PLAINTEXT"},
{"name":"SINGLE_ACTION_INCLUDE_REVERSE_DEPENDENCIES","value":"#{variables.SINGLE_ACTION_INCLUDE_REVERSE_DEPENDENCIES}","type":"PLAINTEXT"},
])
},
RunOrder=1,
),
Expand All @@ -988,9 +994,29 @@ def get_template(
PipelineType="V2",
Variables=[
codepipeline.VariableDeclaration(
Name=single_account_or_action_configuration_parameter_name,
Description="YAML configuration to configure this solution to run a subset of the pipeline",
DefaultValue="{}"
Name="SINGLE_ACCOUNT",
Description="Account id you want to perform a single run on",
DefaultValue="None"
),
codepipeline.VariableDeclaration(
Name="SINGLE_ACTION_SECTION",
Description="The name of the section you want to run a single action for",
DefaultValue="*"
),
codepipeline.VariableDeclaration(
Name="SINGLE_ACTION_ITEM",
Description="The name of the item you want to run a single action for",
DefaultValue="*"
),
codepipeline.VariableDeclaration(
Name="SINGLE_ACTION_INCLUDE_DEPENDENCIES",
Description="Do you want to include dependencies for single action",
DefaultValue="Yes"
),
codepipeline.VariableDeclaration(
Name="SINGLE_ACTION_INCLUDE_REVERSE_DEPENDENCIES",
Description="Do you want to include reverse dependencies for single action",
DefaultValue="Yes"
),
]
)
Expand Down Expand Up @@ -1085,9 +1111,29 @@ def get_template(
},
{
"Type": "PLAINTEXT",
"Name": "SINGLE_ACCOUNT_OR_ACTION_CONFIGURATION",
"Value": "{}"
}
"Name": "SINGLE_ACCOUNT",
"Value": "None"
},
{
"Type": "PLAINTEXT",
"Name": "SINGLE_ACTION_SECTION",
"Value": "*"
},
{
"Type": "PLAINTEXT",
"Name": "SINGLE_ACTION_ITEM",
"Value": "*"
},
{
"Type": "PLAINTEXT",
"Name": "SINGLE_ACTION_INCLUDE_DEPENDENCIES",
"Value": "Yes"
},
{
"Type": "PLAINTEXT",
"Name": "SINGLE_ACTION_INCLUDE_REVERSE_DEPENDENCIES",
"Value": "Yes"
},
]
+ deploy_env_vars,
),
Expand Down

0 comments on commit a52ff38

Please sign in to comment.