fridaystreet / drone-ecs-node

Apache License 2.0
0 stars 0 forks source link

Task_Definition not really optional #1

Open matteosuppo opened 8 years ago

matteosuppo commented 8 years ago

If you leave out the task_definition option it registers as undefined instead of null ans so the plugin crashes with

Dron Plugin Error { Error: ENOENT: no such file or directory, open '/drone/src/github.com/my/repo/undefined'
   at Error (native)
   at Object.fs.openSync (fs.js:634:18)
   at Object.fs.readFileSync (fs.js:502:33)
   at Object.readFileSync (/drone-ecs-node/node_modules/jsonfile/index.js:61:20)
   at /drone-ecs-node/app.js:845:37
   at process._tickDomainCallback (internal/process/next_tick.js:129:7)
   at Module.runMain (module.js:577:11)
   at run (node.js:348:7)
   at startup (node.js:140:9)
   at node.js:463:3
 errno: -2,
 code: 'ENOENT',
 syscall: 'open',
 path: '/drone/src/github.com/my/repo/undefined' } Error: ENOENT: no such file or directory, open '/drone/src/github.com/my/repo/undefined'
   at Error (native)
   at Object.fs.openSync (fs.js:634:18)
   at Object.fs.readFileSync (fs.js:502:33)
   at Object.readFileSync (/drone-ecs-node/node_modules/jsonfile/index.js:61:20)
   at /drone-ecs-node/app.js:845:37
   at process._tickDomainCallback (internal/process/next_tick.js:129:7)
   at Module.runMain (module.js:577:11)
   at run (node.js:348:7)
   at startup (node.js:140:9)
   at node.js:463:3
[info] build failed (exit code 1)
fridaystreet commented 8 years ago

hi matteosuppo

Sorry only just seen this, will have a look as soon as I can. Can you provide a bit more context around what you're trying to do please? Maybe the ecs section of drone.yml too?

Cheers Paul

matteosuppo commented 8 years ago

Sure:

deploy:
    ecs:
        image: arduino/drone-ecs-node

        access_key: $$ECR_ACCESS
        secret_key: $$ECR_SECRET
        region: us-east-1
        cluster: auth-$${TAG:4}
        family: id-$${TAG:4}
        container_names:
          - id-$${TAG:4}
        image_name: $$ECS_IMAGE
        image_tag: "$$TAG"
        service: id-$${TAG:4}
        task_definition: false
        disable_dry_run: true

Basically we had to explictly set task_definition: false or it would give the error above.

I think it's because in https://github.com/fridaystreet/drone-ecs-node/blob/master/app.js#L840 it's not checking for an undefined value.