Fix: aws injects it's own required -c prefix to commands

pull/273/head
Frostebite 2021-06-19 22:07:24 +01:00
parent 7b6dce89e7
commit f659a87ce2
5 changed files with 9 additions and 16 deletions

12
dist/index.js vendored
View File

@ -858,7 +858,7 @@ class AWSBuildEnvironment {
const entrypoint = ['/bin/sh'];
const taskDef = yield this.setupCloudFormations(CF, buildId, image, entrypoint, commands, mountdir, workingdir, secrets);
try {
yield aws_build_runner_1.default.runTask(taskDef, ECS, CF, environment, buildId);
yield aws_build_runner_1.default.runTask(taskDef, ECS, CF, environment, buildId, commands);
}
finally {
yield this.cleanupResources(CF, taskDef);
@ -925,7 +925,7 @@ class AWSBuildEnvironment {
},
{
ParameterKey: 'Command',
ParameterValue: commands.join(','),
ParameterValue: 'echo "this template should be overwritten when running a task"',
},
{
ParameterKey: 'EntryPoint',
@ -1071,7 +1071,7 @@ const AWS = __importStar(__webpack_require__(71786));
const core = __importStar(__webpack_require__(42186));
const zlib = __importStar(__webpack_require__(78761));
class AWSBuildRunner {
static runTask(taskDef, ECS, CF, environment, buildUid) {
static runTask(taskDef, ECS, CF, environment, buildUid, commands) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
return __awaiter(this, void 0, void 0, function* () {
const cluster = ((_b = (_a = taskDef.baseResources) === null || _a === void 0 ? void 0 : _a.find((x) => x.LogicalResourceId === 'ECSCluster')) === null || _b === void 0 ? void 0 : _b.PhysicalResourceId) || '';
@ -1089,6 +1089,7 @@ class AWSBuildRunner {
{
name: taskDef.taskDefStackName,
environment: [...environment, { name: 'BUILDID', value: buildUid }],
command: ['-c', ...commands],
},
],
},
@ -1776,7 +1777,6 @@ class RemoteBuilder {
return __awaiter(this, void 0, void 0, function* () {
core.info('Starting step 1/4 clone and restore cache)');
yield this.RemoteBuilderProviderPlatform.runBuildTask(buildUid, 'alpine/git', [
'-c',
`apk update;
apk add unzip;
apk add git-lfs;
@ -1888,7 +1888,6 @@ class RemoteBuilder {
});
core.info('Starting part 2/4 (build unity project)');
yield this.RemoteBuilderProviderPlatform.runBuildTask(buildUid, baseImage.toString(), [
'-c',
`
cp -r /${buildVolumeFolder}/${buildUid}/builder/dist/default-build-script/ /UnityBuilderAction;
cp -r /${buildVolumeFolder}/${buildUid}/builder/dist/entrypoint.sh /entrypoint.sh;
@ -1958,7 +1957,6 @@ class RemoteBuilder {
core.info('Starting step 3/4 build compression');
// Cleanup
yield this.RemoteBuilderProviderPlatform.runBuildTask(buildUid, 'alpine', [
'-c',
`
apk update
apk add zip
@ -1985,7 +1983,6 @@ class RemoteBuilder {
return __awaiter(this, void 0, void 0, function* () {
core.info('Starting step 4/4 upload build to s3');
yield this.RemoteBuilderProviderPlatform.runBuildTask(buildUid, 'amazon/aws-cli', [
'-c',
`
aws s3 cp ${buildUid}/build-${buildUid}.zip s3://game-ci-storage/
# no need to upload Library cache for now
@ -2020,7 +2017,6 @@ class RemoteBuilder {
return __awaiter(this, void 0, void 0, function* () {
core.info('Starting steam deployment');
yield this.RemoteBuilderProviderPlatform.runBuildTask(buildUid, 'cm2network/steamcmd:root', [
'-c',
`
ls
ls /

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -41,7 +41,7 @@ class AWSBuildEnvironment implements RemoteBuilderProviderInterface {
secrets,
);
try {
await AWSBuildRunner.runTask(taskDef, ECS, CF, environment, buildId);
await AWSBuildRunner.runTask(taskDef, ECS, CF, environment, buildId, commands);
} finally {
await this.cleanupResources(CF, taskDef);
}
@ -133,7 +133,7 @@ class AWSBuildEnvironment implements RemoteBuilderProviderInterface {
},
{
ParameterKey: 'Command',
ParameterValue: commands.join(','),
ParameterValue: 'echo "this template should be overwritten when running a task"',
},
{
ParameterKey: 'EntryPoint',

View File

@ -11,6 +11,7 @@ class AWSBuildRunner {
CF: AWS.CloudFormation,
environment: RemoteBuilderEnvironmentVariable[],
buildUid: string,
commands: string[],
) {
const cluster = taskDef.baseResources?.find((x) => x.LogicalResourceId === 'ECSCluster')?.PhysicalResourceId || '';
const taskDefinition =
@ -33,6 +34,7 @@ class AWSBuildRunner {
{
name: taskDef.taskDefStackName,
environment: [...environment, { name: 'BUILDID', value: buildUid }],
command: ['-c', ...commands],
},
],
},

View File

@ -72,7 +72,6 @@ class RemoteBuilder {
buildUid,
'alpine/git',
[
'-c',
`apk update;
apk add unzip;
apk add git-lfs;
@ -206,7 +205,6 @@ class RemoteBuilder {
buildUid,
baseImage.toString(),
[
'-c',
`
cp -r /${buildVolumeFolder}/${buildUid}/builder/dist/default-build-script/ /UnityBuilderAction;
cp -r /${buildVolumeFolder}/${buildUid}/builder/dist/entrypoint.sh /entrypoint.sh;
@ -288,7 +286,6 @@ class RemoteBuilder {
buildUid,
'alpine',
[
'-c',
`
apk update
apk add zip
@ -327,7 +324,6 @@ class RemoteBuilder {
buildUid,
'amazon/aws-cli',
[
'-c',
`
aws s3 cp ${buildUid}/build-${buildUid}.zip s3://game-ci-storage/
# no need to upload Library cache for now
@ -373,7 +369,6 @@ class RemoteBuilder {
buildUid,
'cm2network/steamcmd:root',
[
'-c',
`
ls
ls /