insert test template into cloud formation at all 3 template positions and log
parent
fc7d03d0d6
commit
4ac7f91e71
|
|
@ -478,17 +478,44 @@ class AWS {
|
||||||
`;
|
`;
|
||||||
const taskDefStackName = `${stackName}-${buildUid}`;
|
const taskDefStackName = `${stackName}-${buildUid}`;
|
||||||
let taskDefCloudFormation = fs.readFileSync(`${__dirname}/cloud-formations/task-def-formation.yml`, 'utf8');
|
let taskDefCloudFormation = fs.readFileSync(`${__dirname}/cloud-formations/task-def-formation.yml`, 'utf8');
|
||||||
|
const p1string = 'p1 - input';
|
||||||
|
const p2string = 'p2 - secret';
|
||||||
const p3string = 'p3 - container def';
|
const p3string = 'p3 - container def';
|
||||||
|
const indexp1 = taskDefCloudFormation.search(p1string) + p1string.length + '\n'.length;
|
||||||
|
const template1 = `
|
||||||
|
AWSSecretAccessKeyssss:
|
||||||
|
Type: String
|
||||||
|
Default: '0'
|
||||||
|
`;
|
||||||
|
taskDefCloudFormation = [
|
||||||
|
taskDefCloudFormation.slice(0, indexp1),
|
||||||
|
template1,
|
||||||
|
taskDefCloudFormation.slice(indexp1),
|
||||||
|
].join('');
|
||||||
|
const indexp2 = taskDefCloudFormation.search(p2string) + p2string.length + '\n'.length;
|
||||||
|
const template2 = `
|
||||||
|
TestSec:
|
||||||
|
Type: AWS::SecretsManager::Secret
|
||||||
|
Properties:
|
||||||
|
Name: !Join [ "", [ 'testsec', !Ref BUILDID ] ]
|
||||||
|
SecretString: !Ref AWSSecretAccessKey
|
||||||
|
`;
|
||||||
|
taskDefCloudFormation = [
|
||||||
|
taskDefCloudFormation.slice(0, indexp2),
|
||||||
|
template2,
|
||||||
|
taskDefCloudFormation.slice(indexp2),
|
||||||
|
].join('');
|
||||||
const indexp3 = taskDefCloudFormation.search(p3string) + p3string.length + '\n'.length;
|
const indexp3 = taskDefCloudFormation.search(p3string) + p3string.length + '\n'.length;
|
||||||
const template = `
|
const template3 = `
|
||||||
- Name: 'test'
|
- Name: 'test'
|
||||||
ValueFrom: !Ref GithubTokenSecret
|
ValueFrom: !Ref GithubTokenSecret
|
||||||
`;
|
`;
|
||||||
taskDefCloudFormation = [
|
taskDefCloudFormation = [
|
||||||
taskDefCloudFormation.slice(0, indexp3),
|
taskDefCloudFormation.slice(0, indexp3),
|
||||||
template,
|
template3,
|
||||||
taskDefCloudFormation.slice(indexp3),
|
taskDefCloudFormation.slice(indexp3),
|
||||||
].join('');
|
].join('');
|
||||||
|
core.info(taskDefCloudFormation);
|
||||||
yield CF.createStack({
|
yield CF.createStack({
|
||||||
StackName: taskDefStackName,
|
StackName: taskDefStackName,
|
||||||
TemplateBody: taskDefCloudFormation,
|
TemplateBody: taskDefCloudFormation,
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -333,18 +333,46 @@ class AWS {
|
||||||
`;
|
`;
|
||||||
const taskDefStackName = `${stackName}-${buildUid}`;
|
const taskDefStackName = `${stackName}-${buildUid}`;
|
||||||
let taskDefCloudFormation = fs.readFileSync(`${__dirname}/cloud-formations/task-def-formation.yml`, 'utf8');
|
let taskDefCloudFormation = fs.readFileSync(`${__dirname}/cloud-formations/task-def-formation.yml`, 'utf8');
|
||||||
|
const p1string = 'p1 - input';
|
||||||
|
const p2string = 'p2 - secret';
|
||||||
const p3string = 'p3 - container def';
|
const p3string = 'p3 - container def';
|
||||||
|
const indexp1 = taskDefCloudFormation.search(p1string) + p1string.length + '\n'.length;
|
||||||
|
const template1 = `
|
||||||
|
AWSSecretAccessKeyssss:
|
||||||
|
Type: String
|
||||||
|
Default: '0'
|
||||||
|
`;
|
||||||
|
taskDefCloudFormation = [
|
||||||
|
taskDefCloudFormation.slice(0, indexp1),
|
||||||
|
template1,
|
||||||
|
taskDefCloudFormation.slice(indexp1),
|
||||||
|
].join('');
|
||||||
|
const indexp2 = taskDefCloudFormation.search(p2string) + p2string.length + '\n'.length;
|
||||||
|
const template2 = `
|
||||||
|
TestSec:
|
||||||
|
Type: AWS::SecretsManager::Secret
|
||||||
|
Properties:
|
||||||
|
Name: !Join [ "", [ 'testsec', !Ref BUILDID ] ]
|
||||||
|
SecretString: !Ref AWSSecretAccessKey
|
||||||
|
`;
|
||||||
|
taskDefCloudFormation = [
|
||||||
|
taskDefCloudFormation.slice(0, indexp2),
|
||||||
|
template2,
|
||||||
|
taskDefCloudFormation.slice(indexp2),
|
||||||
|
].join('');
|
||||||
const indexp3 = taskDefCloudFormation.search(p3string) + p3string.length + '\n'.length;
|
const indexp3 = taskDefCloudFormation.search(p3string) + p3string.length + '\n'.length;
|
||||||
const template = `
|
const template3 = `
|
||||||
- Name: 'test'
|
- Name: 'test'
|
||||||
ValueFrom: !Ref GithubTokenSecret
|
ValueFrom: !Ref GithubTokenSecret
|
||||||
`;
|
`;
|
||||||
taskDefCloudFormation = [
|
taskDefCloudFormation = [
|
||||||
taskDefCloudFormation.slice(0, indexp3),
|
taskDefCloudFormation.slice(0, indexp3),
|
||||||
template,
|
template3,
|
||||||
taskDefCloudFormation.slice(indexp3),
|
taskDefCloudFormation.slice(indexp3),
|
||||||
].join('');
|
].join('');
|
||||||
|
|
||||||
|
core.info(taskDefCloudFormation);
|
||||||
|
|
||||||
await CF.createStack({
|
await CF.createStack({
|
||||||
StackName: taskDefStackName,
|
StackName: taskDefStackName,
|
||||||
TemplateBody: taskDefCloudFormation,
|
TemplateBody: taskDefCloudFormation,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue