Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit74d5ef1

Browse files
committed
ecsTaskRun
1 parent31d0f59 commit74d5ef1

File tree

4 files changed

+92
-2
lines changed

4 files changed

+92
-2
lines changed

‎server/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
},
3636
"dependencies": {
3737
"@aws-sdk/client-s3":"3.332.0",
38+
"@aws-sdk/client-ecs":"3.332.0",
3839
"@aws-sdk/s3-request-presigner":"3.332.0",
3940
"@grucloud/docker-axios":"12.7.0",
4041
"async-busboy":"https://github.com/amit777/async-busboy.git",

‎server/src/plugins/cloudDiagram/index.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ module.exports = (app) => {
137137
tap(({ image})=>{
138138
assert(image);
139139
}),
140-
dockerClient.image.pull,
141-
()=>fs.mkdir(app.config.infra.localInputPath,{recursive:true}),
140+
//TODO
141+
// dockerClient.image.pull,
142+
// () => fs.mkdir(app.config.infra.localInputPath, { recursive: true }),
142143
]),
143144
stop:pipe([
144145
tap(()=>{
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
constassert=require("assert");
2+
3+
consttestMngr=require("test/testManager");
4+
const{ ecsTaskRun}=require("../utils/ecsTaskRun");
5+
6+
describe("EcsTask",function(){
7+
const{ app}=testMngr;
8+
before(asyncfunction(){
9+
if(!app.config.infra){
10+
this.skip();
11+
}
12+
});
13+
14+
it("list",async()=>{
15+
try{
16+
constres=awaitecsTaskRun({
17+
provider:"aws",
18+
});
19+
}catch(error){
20+
throwerror;
21+
}
22+
});
23+
});
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
constassert=require("assert");
2+
const{ pipe, tap, get, tryCatch}=require("rubico");
3+
const{ first}=require("rubico/x");
4+
5+
const{ RunTaskCommand, ECSClient}=require("@aws-sdk/client-ecs");
6+
7+
const{ AWSAccessKeyId, AWSSecretKey,AWS_REGION}=process.env;
8+
9+
constlog=require("logfilename")(__filename);
10+
11+
exports.ecsTaskRun=({})=>
12+
tryCatch(
13+
pipe([
14+
tap(()=>{
15+
log.debug(`ecsTaskRun`);
16+
assert(AWSAccessKeyId);
17+
assert(AWSSecretKey);
18+
assert(AWS_REGION);
19+
}),
20+
// TODO
21+
()=>({
22+
cluster:"grucloud-console-dev",
23+
taskDefinition:"grucloud-cli:6",
24+
launchType:"FARGATE",
25+
networkConfiguration:{
26+
awsvpcConfiguration:{
27+
subnets:["subnet-b80a4ff5"],
28+
assignPublicIp:"ENABLED",
29+
securityGroups:["sg-4e82a670"],
30+
},
31+
},
32+
overrides:{
33+
containerOverrides:[
34+
{
35+
name:"grucloud-cli",
36+
command:["list","--provider","aws"],
37+
environment:[
38+
{name:"AWSAccessKeyId",value:AWSAccessKeyId},
39+
{name:"AWSSecretKey",value:AWSSecretKey},
40+
{name:"AWS_REGION",value:AWS_REGION},
41+
],
42+
},
43+
],
44+
},
45+
}),
46+
tap((taskArn)=>{
47+
assert(taskArn);
48+
}),
49+
(input)=>newRunTaskCommand(input),
50+
(command)=>newECSClient({region:AWS_REGION}).send(command),
51+
tap((params)=>{
52+
assert(params);
53+
}),
54+
get("tasks"),
55+
first,
56+
get("taskArn"),
57+
tap((taskArn)=>{
58+
console.log(taskArn);
59+
assert(taskArn);
60+
}),
61+
]),
62+
(error)=>{
63+
throwerror;
64+
}
65+
)();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp