cleanup
parent
a466819340
commit
5a53241802
File diff suppressed because one or more lines are too long
|
|
@ -11,8 +11,8 @@ class AWS {
|
||||||
static async runBuildJob(buildParameters, baseImage) {
|
static async runBuildJob(buildParameters, baseImage) {
|
||||||
try{
|
try{
|
||||||
|
|
||||||
let buildId = nanoid();
|
let buildUid = nanoid();
|
||||||
await this.run(
|
await this.run(buildUid,
|
||||||
buildParameters.awsStackName,
|
buildParameters.awsStackName,
|
||||||
'alpine/git',
|
'alpine/git',
|
||||||
['/bin/sh'],
|
['/bin/sh'],
|
||||||
|
|
@ -22,9 +22,9 @@ class AWS {
|
||||||
apk add git-lfs;
|
apk add git-lfs;
|
||||||
apk add jq;
|
apk add jq;
|
||||||
ls;
|
ls;
|
||||||
git clone https://github.com/${process.env.GITHUB_REPOSITORY}.git $BUILD_ID/repo;
|
git clone https://github.com/${process.env.GITHUB_REPOSITORY}.git $BUILDID/repo;
|
||||||
git clone https://github.com/webbertakken/unity-builder.git $BUILD_ID/builder;
|
git clone https://github.com/webbertakken/unity-builder.git $BUILDID/builder;
|
||||||
cd $BUILD_ID/repo;
|
cd $BUILDID/repo;
|
||||||
git checkout $GITHUB_SHA;
|
git checkout $GITHUB_SHA;
|
||||||
`],
|
`],
|
||||||
'/data',
|
'/data',
|
||||||
|
|
@ -42,7 +42,7 @@ class AWS {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
await this.run(
|
await this.run(buildUid,
|
||||||
buildParameters.awsStackName,
|
buildParameters.awsStackName,
|
||||||
baseImage.toString(),
|
baseImage.toString(),
|
||||||
['/bin/sh'],
|
['/bin/sh'],
|
||||||
|
|
@ -62,11 +62,11 @@ class AWS {
|
||||||
ls
|
ls
|
||||||
`],
|
`],
|
||||||
'/data',
|
'/data',
|
||||||
`/data/${buildId}/repo/`,
|
`/data/${buildUid}/repo/`,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
name: 'GITHUB_WORKSPACE',
|
name: 'GITHUB_WORKSPACE',
|
||||||
value: `/data/${buildId}/repo/`,
|
value: `/data/${buildUid}/repo/`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'PROJECT_PATH',
|
name: 'PROJECT_PATH',
|
||||||
|
|
@ -133,7 +133,7 @@ class AWS {
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
// Cleanup
|
// Cleanup
|
||||||
await this.run(
|
await this.run(buildUid,
|
||||||
buildParameters.awsStackName,
|
buildParameters.awsStackName,
|
||||||
'alpine',
|
'alpine',
|
||||||
['/bin/sh'],
|
['/bin/sh'],
|
||||||
|
|
@ -160,7 +160,7 @@ class AWS {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
await this.run(
|
await this.run(buildUid,
|
||||||
buildParameters.awsStackName,
|
buildParameters.awsStackName,
|
||||||
'amazon/aws-cli',
|
'amazon/aws-cli',
|
||||||
['/bin/sh'],
|
['/bin/sh'],
|
||||||
|
|
@ -206,12 +206,11 @@ class AWS {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async run(stackName, image, entrypoint, commands, mountdir, workingdir, environment, secrets) {
|
static async run(buildUid, stackName, image, entrypoint, commands, mountdir, workingdir, environment, secrets) {
|
||||||
const ECS = new SDK.ECS();
|
const ECS = new SDK.ECS();
|
||||||
const CF = new SDK.CloudFormation();
|
const CF = new SDK.CloudFormation();
|
||||||
const jobId = nanoid();
|
|
||||||
|
|
||||||
const taskDefStackName = `${stackName}-taskDef-${image}-${jobId}`
|
const taskDefStackName = `${stackName}-taskDef-${image}-${buildUid}`
|
||||||
.toString()
|
.toString()
|
||||||
.replace(/[^\da-z]/gi, '');
|
.replace(/[^\da-z]/gi, '');
|
||||||
core.info('Creating build job resources');
|
core.info('Creating build job resources');
|
||||||
|
|
@ -246,7 +245,7 @@ class AWS {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ParameterKey: 'BUILDID',
|
ParameterKey: 'BUILDID',
|
||||||
ParameterValue: jobId,
|
ParameterValue: buildUid,
|
||||||
}
|
}
|
||||||
].concat(secrets),
|
].concat(secrets),
|
||||||
}).promise();
|
}).promise();
|
||||||
|
|
@ -276,7 +275,7 @@ class AWS {
|
||||||
{
|
{
|
||||||
name: taskDefStackName,
|
name: taskDefStackName,
|
||||||
environment: environment.concat([
|
environment: environment.concat([
|
||||||
{name:'BUILDID', value: jobId}
|
{name:'BUILDID', value: buildUid}
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue