danger / peril

☢️ Serious and immediate danger.
https://danger.systems
MIT License
461 stars 58 forks source link

Docker build broken #502

Open glensc opened 2 years ago

glensc commented 2 years ago

The Dockerfile at 4c7109895ee956183411a3cb635942825d58bd97 fails to build:

``` glen@lima danger/peril$ docker build . [63/96775] Sending build context to Docker daemon 41.54MB Step 1/7 : FROM node:10-slim 10-slim: Pulling from library/node ... Status: Downloaded newer image for node:10-slim ---> 6fbcbbb5c603 Step 2/7 : ADD . /app ---> 6188f77eef6a Step 3/7 : WORKDIR /app/api ---> Running in a3133dba2b88 Removing intermediate container a3133dba2b88 ---> 72e4482e49f0 Step 4/7 : RUN yarn install ---> Running in 2978282311bb yarn install v1.22.5 [1/5] Validating package.json... [2/5] Resolving packages... [3/5] Fetching packages... info fsevents@1.2.4: The platform "linux" is incompatible with this module. info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation. [4/5] Linking dependencies... [4/5] Linking dependencies... warning "danger-plugin-spellcheck > markdown-spellcheck > sinon-as-promised@4.0.3" has unmet peer dependency "sinon@1 ". warning " > graphql-relay-tools@0.1.1" has incorrect peer dependency "graphql@^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0-b || ^0.9.0 || ^0.10.0 || ^0.11.0". warning " > graphql-schema-utils@0.6.5" has incorrect peer dependency "graphql@^0.8.2". warning "jest > jest-cli > @jest/core > jest-resolve-dependencies@24.5.0" has unmet peer dependency "jest-resolve@^24 .1.0". warning "jest > jest-cli > jest-config > jest-resolve@24.5.0" has unmet peer dependency "jest-haste-map@^24.0.0". [5/5] Building fresh packages... $ yarn build; if [ $DATABASE_JSON_FILE ]; then yarn run setup; fi yarn run v1.22.5 $ tsc node_modules/@types/node/index.d.ts:166:11 - error TS2300: Duplicate identifier 'IteratorResult'. 166 interface IteratorResult { } ~~~~~~~~~~~~~~ node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 41 type IteratorResult = IteratorYieldResult | IteratorReturnResult; ~~~~~~~~~~~~~~ 'IteratorResult' was also declared here. node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 - error TS2300: Duplicate identifier 'IteratorResult'. 41 type IteratorResult = IteratorYieldResult | IteratorReturnResult; ~~~~~~~~~~~~~~ node_modules/@types/node/index.d.ts:166:11 166 interface IteratorResult { } ~~~~~~~~~~~~~~ 'IteratorResult' was also declared here. source/github/events/handlers/_tests/_events-create-fixture.test.ts:55:10 - error TS2790: The operand of a 'delete' o perator must be optional. 55 delete (payload.payload.dsl as DangerDSLJSONType).github!.api ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Found 3 errors. error Command failed with exit code 2. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Done in 130.58s. Removing intermediate container 2978282311bb ---> 8a63cff0d074 Step 5/7 : ENV PORT=80 ---> Running in 8036fe5bef14 Removing intermediate container 8036fe5bef14 ---> a87df3f67676 Step 6/7 : EXPOSE 80 ---> Running in 5d4d4db887b5 Removing intermediate container 5d4d4db887b5 ---> 3f638a1514c6 Step 7/7 : CMD yarn start ---> Running in db47862f7638 Removing intermediate container db47862f7638 ---> 770951f630be Successfully built 770951f630be ```

also this project package.json suffer same problem as in danger.js:

glensc commented 2 years ago

Some of the errors went away after updating @types/node to 10

└─ @types/node@10.17.60
$ yarn build; if [ $DATABASE_JSON_FILE ]; then yarn run setup; fi
yarn run v1.22.18
$ tsc
source/danger/danger_runner.ts:169:57 - error TS2345: Argument of type 'Process' is not assignable to parameter of type 'ExitCodeContainer'.
  Types of property 'exitCode' are incompatible.
    Type 'number | undefined' is not assignable to type 'number'.
      Type 'undefined' is not assignable to type 'number'.

169   return new Executor(source, platform, runner, config, process)
                                                            ~~~~~~~

source/github/events/handlers/_tests/_events-create-fixture.test.ts:55:10 - error TS2790: The operand of a 'delete' operator must be optional.

55   delete (payload.payload.dsl as DangerDSLJSONType).github!.api
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 2 errors.
glensc commented 2 years ago

Error about delete operand explained here:

glensc commented 2 years ago

The ExitCodeContainer.exitCode was fixed in:

the commit is unreadable because nobody is following atomic commit principle, but scroll down to find ExitCodeContainer to find the diff.

another bummer was, that I spent a some dozen minutes trying to figure out wtf the source code does not match the package source on npm, trying to figure what weird build system inject extra process parameter to class constructor, before realized, I'm on master, not the main branch 😭