peril icon indicating copy to clipboard operation
peril copied to clipboard

Docker build broken

Open glensc opened this issue 2 years ago • 3 comments

The Dockerfile at 4c7109895ee956183411a3cb635942825d58bd97 fails to build:

  • https://github.com/danger/peril/blob/4c7109895ee956183411a3cb635942825d58bd97/Dockerfile
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 [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" 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 > [email protected]" has unmet peer dependency "sinon@1
".
warning " > [email protected]" 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 " > [email protected]" has incorrect peer dependency "graphql@^0.8.2".
warning "jest > jest-cli > @jest/core > [email protected]" has unmet peer dependency "jest-resolve@^24
.1.0".
warning "jest > jest-cli > jest-config > [email protected]" 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<T> { }
              ~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6
    41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
            ~~~~~~~~~~~~~~
    'IteratorResult' was also declared here.


node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 - error TS2300: Duplicate identifier 'IteratorResult'.

41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
        ~~~~~~~~~~~~~~

  node_modules/@types/node/index.d.ts:166:11
    166 interface IteratorResult<T> { }
                  ~~~~~~~~~~~~~~
    '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:

  • https://github.com/danger/danger-js/pull/1258

glensc avatar May 03 '22 20:05 glensc

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

└─ @types/[email protected]
$ 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 avatar May 03 '22 20:05 glensc

Error about delete operand explained here:

  • https://stackoverflow.com/questions/63702057/what-is-the-logic-behind-the-typescript-error-the-operand-of-a-delete-operato

glensc avatar May 03 '22 20:05 glensc

The ExitCodeContainer.exitCode was fixed in:

  • https://github.com/danger/danger-js/commit/14a4dc5aae7922cde8d3b87ca4c7aea28cb05558

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 😭

glensc avatar May 03 '22 21:05 glensc