Skip to content
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

feat(deadline): add WorkerInstanceConfiguration construct #209

Merged
merged 6 commits into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions packages/aws-rfdk/lib/core/lib/script-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ export interface ConventionalScriptPathParams {
*/
function getConventionalScriptPath(params: ConventionalScriptPathParams): string {
const { rootDir: scriptDir, baseName: scriptName, osType } = params;
// Make sure we have a known osType. The error message is pretty obtuse if we don't:
// The "path" argument must be of type string. Received undefined
if (ScriptPathPrefix[osType] === undefined || ScriptExtension[osType] == undefined) {
throw Error(`Unknown osType: ${osType}`);
}
return path.join(
scriptDir,
ScriptPathPrefix[osType],
Expand Down
225 changes: 225 additions & 0 deletions packages/aws-rfdk/lib/core/test/asset-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,228 @@ export const INSTALL_MONGODB_3_6_SCRIPT_LINUX = {
export const MONGODB_INSTANCE_3_6_SCRIPT = {
Bucket: stringLike('AssetParameters*S3Bucket352E624B'),
};

export function linuxDownloadRunScriptBoilerplate(script: { Bucket: string, Key: string }) {
return [
{
'Fn::Select': [
0,
{
'Fn::Split': [
'||',
{Ref: script.Key},
],
},
],
},
{
'Fn::Select': [
1,
{
'Fn::Split': [
'||',
{Ref: script.Key},
],
},
],
},
'\')\naws s3 cp \'s3://',
{Ref: script.Bucket},
'/',
{
'Fn::Select': [
0,
{
'Fn::Split': [
'||',
{Ref: script.Key},
],
},
],
},
{
'Fn::Select': [
1,
{
'Fn::Split': [
'||',
{Ref: script.Key},
],
},
],
},
'\' \'/tmp/',
{
'Fn::Select': [
0,
{
'Fn::Split': [
'||',
{Ref: script.Key},
],
},
],
},
{
'Fn::Select': [
1,
{
'Fn::Split': [
'||',
{Ref: script.Key},
],
},
],
},
'\'\n' +
'set -e\n' +
'chmod +x \'/tmp/',
{
'Fn::Select': [
0,
{
'Fn::Split': [
'||',
{
Ref: script.Key,
},
],
},
],
},
{
'Fn::Select': [
1,
{
'Fn::Split': [
'||',
{Ref: script.Key},
],
},
],
},
'\'\n\'/tmp/',
{
'Fn::Select': [
0,
{
'Fn::Split': [
'||',
{Ref: script.Key},
],
},
],
},
{
'Fn::Select': [
1,
{
'Fn::Split': [
'||',
{Ref: script.Key},
],
},
],
},
];
}

export function windowsDownloadRunScriptBoilerplate(script: { Bucket: string, Key: string }) {
return [
{
'Fn::Select': [
0,
{
'Fn::Split': [
'||',
{Ref: script.Key},
],
},
],
},
{
'Fn::Select': [
1,
{
'Fn::Split': [
'||',
{Ref: script.Key},
],
},
],
},
'\' ) -ea 0\nRead-S3Object -BucketName \'',
{Ref: script.Bucket},
'\' -key \'',
{
'Fn::Select': [
0,
{
'Fn::Split': [
'||',
{Ref: script.Key},
],
},
],
},
{
'Fn::Select': [
1,
{
'Fn::Split': [
'||',
{Ref: script.Key},
],
},
],
},
'\' -file \'C:/temp/',
{
'Fn::Select': [
0,
{
'Fn::Split': [
'||',
{Ref: script.Key},
],
},
],
},
{
'Fn::Select': [
1,
{
'Fn::Split': [
'||',
{Ref: script.Key},
],
},
],
},
'\' -ErrorAction Stop\n&\'C:/temp/',
{
'Fn::Select': [
0,
{
'Fn::Split': [
'||',
{
Ref: script.Key,
},
],
},
],
},
{
'Fn::Select': [
1,
{
'Fn::Split': [
'||',
{Ref: script.Key},
],
},
],
},
];
}
1 change: 1 addition & 0 deletions packages/aws-rfdk/lib/deadline/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ export * from './thinkbox-docker-recipes';
export * from './version';
export * from './version-query';
export * from './version-ref';
export * from './worker-configuration';
Loading