-
Notifications
You must be signed in to change notification settings - Fork 492
Add configuration for staging repo #2141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5c0b531
3f3c005
1ac1f9f
f4c1608
b45b0e9
8aaa480
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,9 +29,14 @@ internal class Configuration | |
public string GitHubOwner { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_GITHUB_REPO_OWNER"); | ||
public string GitHubRepository { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_GITHUB_REPO_NAME"); | ||
public string GitHubBranch { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_GITHUB_REPO_BRANCH"); | ||
|
||
public string GitHubOwnerStaging { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_GITHUB_REPO_OWNER_STAGING"); | ||
public string GitHubRepositoryStaging { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_GITHUB_REPO_NAME_STAGING"); | ||
public string GitHubBranchStaging { get; } = Environment.GetEnvironmentVariable("AWS_LAMBDA_GITHUB_REPO_BRANCH_STAGING"); | ||
|
||
public Ecrs Ecrs { get; } = new Ecrs(); | ||
public const string ProjectRoot = "LambdaRuntimeDockerfiles/Infrastructure/src/Infrastructure"; | ||
public static readonly string ProjectName = "aws-lambda-container-images"; | ||
public string ProjectName { get; } = "aws-lambda-container-images"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. made non static to be consistent |
||
|
||
public readonly FrameworkConfiguration[] Frameworks = new[] | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,13 +13,42 @@ public PipelinesStage( | |
string id, | ||
Configuration configuration, | ||
IStageProps props = null) : base(scope, id, props) | ||
{ | ||
// Create pipelines for main repository | ||
CreatePipelinesForRepository(configuration, | ||
configuration.ProjectName, | ||
configuration.GitHubOwner, | ||
configuration.GitHubRepository, | ||
configuration.GitHubBranch); | ||
|
||
// Create pipelines for staging repository | ||
CreatePipelinesForRepository(configuration, | ||
$"{configuration.ProjectName}-staging", | ||
configuration.GitHubOwnerStaging, | ||
configuration.GitHubRepositoryStaging, | ||
configuration.GitHubBranchStaging); | ||
} | ||
|
||
private void CreatePipelinesForRepository( | ||
Configuration configuration, | ||
string pipelinePrefix, | ||
string gitHubOwner, | ||
string gitHubRepository, | ||
string gitHubBranch) | ||
{ | ||
for (var i = 0; i < configuration.Frameworks.Length; i++) | ||
{ | ||
|
||
var pipelineName = $"{pipelinePrefix}-{configuration.Frameworks[i].Framework}"; | ||
|
||
new PipelineStack(this, | ||
configuration.Frameworks[i].Framework, | ||
$"{pipelinePrefix}-{configuration.Frameworks[i].Framework}", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cloudformation seems to automatically uses the parent pipeline name+ this for the name of the stack and we get something like
but i dont really care about the stack name too much to be honest. This was the only way i found to make the pipeline name + what appears in the ui for the pipeline in the main pipeline look correct There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. im not a fan of this, but not a big deal |
||
configuration, | ||
configuration.Frameworks[i], | ||
gitHubOwner, | ||
gitHubRepository, | ||
gitHubBranch, | ||
pipelineName, | ||
new StackProps | ||
{ | ||
TerminationProtection = true, | ||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -65,9 +65,19 @@ internal SelfMutatingPipelineStack( | |||
{ "AWS_LAMBDA_DOTNET_FRAMEWORK_CHANNEL", | ||||
new BuildEnvironmentVariable { Type = BuildEnvironmentVariableType.PLAINTEXT, Value = | ||||
System.Environment.GetEnvironmentVariable("AWS_LAMBDA_DOTNET_FRAMEWORK_CHANNEL") ?? string.Empty } }, | ||||
{ "AWS_LAMBDA_GITHUB_REPO_OWNER_STAGING", | ||||
new BuildEnvironmentVariable { Type = BuildEnvironmentVariableType.PLAINTEXT, Value = | ||||
System.Environment.GetEnvironmentVariable("AWS_LAMBDA_GITHUB_REPO_OWNER_STAGING") ?? string.Empty } }, | ||||
{ "AWS_LAMBDA_GITHUB_REPO_NAME_STAGING", | ||||
new BuildEnvironmentVariable { Type = BuildEnvironmentVariableType.PLAINTEXT, Value = | ||||
System.Environment.GetEnvironmentVariable("AWS_LAMBDA_GITHUB_REPO_NAME_STAGING") ?? string.Empty } }, | ||||
{ "AWS_LAMBDA_GITHUB_REPO_BRANCH_STAGING", | ||||
new BuildEnvironmentVariable { Type = BuildEnvironmentVariableType.PLAINTEXT, Value = | ||||
System.Environment.GetEnvironmentVariable("AWS_LAMBDA_GITHUB_REPO_BRANCH_STAGING") ?? string.Empty } }, | ||||
}; | ||||
|
||||
// Self mutation | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] Remove this empty line as it adds unnecessary whitespace without improving readability.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||
var pipeline = new CodePipeline(this, "SelfMutatingPipeline", new CodePipelineProps | ||||
{ | ||||
PipelineName = id, | ||||
|
@@ -114,6 +124,6 @@ internal SelfMutatingPipelineStack( | |||
}); | ||||
|
||||
// Add a stage in the pipeline to deploy the Lambda container pipelines | ||||
pipeline.AddStage(new PipelinesStage(this, Configuration.ProjectName, configuration)); | ||||
pipeline.AddStage(new PipelinesStage(this, configuration.ProjectName, configuration)); | ||||
} | ||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i didnt bother to move all of these to a json file yet because we would still need to send in the token key as env variables anyway. i may come back to this in the future