-
Notifications
You must be signed in to change notification settings - Fork 478
/
bootstrap.ps1
66 lines (46 loc) · 2.61 KB
/
bootstrap.ps1
1
2
3
4
5
6
7
8
9
10
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
param (
[Parameter(Mandatory = $true, HelpMessage = "Pipeline Account ID.")]
[string] $PipelineAccountId,
[Parameter(Mandatory = $false, HelpMessage = "Pipeline name suffix.")]
[string] $PipelineNameSuffix,
[Parameter(Mandatory = $true, HelpMessage = "Region.")]
[string] $Region,
[Parameter(Mandatory = $true, HelpMessage = "The name of the secret in Secret Manager that contains the GitHub Access Token.")]
[string] $GitHubTokenSecretName,
[Parameter(Mandatory = $true, HelpMessage = "The secret key in Secret Manager that contains the GitHub Access Token.")]
[string] $GitHubTokenSecretKey,
[Parameter(Mandatory = $true, HelpMessage = "GitHub repository owner name.")]
[string] $GitHubRepoOwner,
[Parameter(Mandatory = $true, HelpMessage = "GitHub repository name.")]
[string] $GitHubRepoName,
[Parameter(Mandatory = $true, HelpMessage = "GitHub repository branch name.")]
[string] $GitHubRepoBranch,
[Parameter(Mandatory = $false, HelpMessage = "ECR URI to store Stage images.")]
[string] $StageEcr,
[Parameter(Mandatory = $false, HelpMessage = "Semicolon separated ECR URIs to store Beta images.")]
[string] $BetaEcrs,
[Parameter(Mandatory = $false, HelpMessage = "Semicolon separated ECR URIs to store Prod images.")]
[string] $ProdEcrs,
[Parameter(Mandatory = $true, HelpMessage = "ECR repository name for Stage, Beta and Prod images.")]
[string] $EcrRepositoryName,
[Parameter(Mandatory = $true, HelpMessage = "The target .NET framework to create a pipeline for.")]
[string] $TargetFramework,
[Parameter(Mandatory = $true, HelpMessage = "The .NET channel corresponding to the Target Framework.")]
[string] $DotnetChannel
)
$env:AWS_LAMBDA_PIPELINE_ACCOUNT_ID = $PipelineAccountId
$env:AWS_LAMBDA_PIPELINE_REGION = $Region
$env:AWS_LAMBDA_PIPELINE_NAME_SUFFIX = $PipelineNameSuffix
$env:AWS_LAMBDA_GITHUB_TOKEN_SECRET_NAME = $GitHubTokenSecretName
$env:AWS_LAMBDA_GITHUB_TOKEN_SECRET_KEY = $GitHubTokenSecretKey
$env:AWS_LAMBDA_GITHUB_REPO_OWNER = $GitHubRepoOwner
$env:AWS_LAMBDA_GITHUB_REPO_NAME = $GitHubRepoName
$env:AWS_LAMBDA_GITHUB_REPO_BRANCH = $GitHubRepoBranch
$env:AWS_LAMBDA_STAGE_ECR = $StageEcr
$env:AWS_LAMBDA_BETA_ECRS = $BetaEcrs
$env:AWS_LAMBDA_PROD_ECRS = $ProdEcrs
$env:AWS_LAMBDA_ECR_REPOSITORY_NAME = $EcrRepositoryName
$env:AWS_LAMBDA_DOTNET_FRAMEWORK_VERSION = $TargetFramework
$env:AWS_LAMBDA_DOTNET_FRAMEWORK_CHANNEL = $DotnetChannel
npx cdk bootstrap --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess aws://$PipelineAccountId/$Region
npx cdk deploy --require-approval never --all