Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class AWSCloudFormationTemplates {

public static getSecretDefinitionTemplate(p1: string, p2: string) {
return `
Secrets:
- Name: '${p1}'
ValueFrom: !Ref ${p2}Secret
`;
Expand Down
10 changes: 9 additions & 1 deletion src/model/cloud-runner/providers/aws/aws-job-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class AWSJobStack {
);
taskDefCloudFormation = AWSCloudFormationTemplates.insertAtTemplate(
taskDefCloudFormation,
'p3 - container def',
'# template secrets p3 - container def',
AWSCloudFormationTemplates.getSecretDefinitionTemplate(secret.EnvironmentVariable, secret.ParameterKey),
);
}
Expand Down Expand Up @@ -113,9 +113,13 @@ export class AWSJobStack {
},
...secretsMappedToCloudFormationParameters,
];

CloudRunnerLogger.log(`TaskDef: ${taskDefCloudFormation}`);

CloudRunnerLogger.log(
`Starting AWS job with memory: ${CloudRunner.buildParameters.containerMemory} cpu: ${CloudRunner.buildParameters.containerCpu}`,
);

let previousStackExists = true;
while (previousStackExists) {
previousStackExists = false;
Expand All @@ -132,13 +136,17 @@ export class AWSJobStack {
}
}
}

const createStackInput: SDK.CloudFormation.CreateStackInput = {
StackName: taskDefStackName,
TemplateBody: taskDefCloudFormation,
Capabilities: ['CAPABILITY_IAM'],
Parameters: parameters,
};

CloudRunnerLogger.log(`StackInput: ${createStackInput}`);
try {
CloudRunnerLogger.log(`TaskDef Cloud formation: ${taskDefCloudFormation}`);
CloudRunnerLogger.log(`Creating job aws formation ${taskDefStackName}`);
await CF.createStack(createStackInput).promise();
await CF.waitFor('stackCreateComplete', { StackName: taskDefStackName }).promise();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@ Resources:
MountPoints:
- SourceVolume: efs-data
ContainerPath: !Ref EFSMountDirectory
ReadOnly: false
Secrets:
# template secrets p3 - container def
ReadOnly: false
# template secrets p3 - container def
LogConfiguration:
LogDriver: awslogs
Options:
Expand Down