Page MenuHomePhabricator

[CI] Improve handling of JS dependencies in build-configurations CI
Needs ReviewPublic

Authored by bytesofman on Thu, Dec 26, 16:03.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Summary

The modular use of "DEPENDS_" variables made sense when we were dealing with only 1 or 2 dependencies. Now we have many, and also the order matters.

Refactor build-configurations.py to accept yml definitions of dependencies. Organize dependency actions in a specific yml file.

Test Plan

CI tests for js-mocha and js-mocha-integration-tests templates

Potentially I called the bot wrong (can you call e.g. @bot alias-server-tests mock-chronik-client-tests or do you need to do @bot alias-server-tests @bot mock-chronik-client-tests).

Also should make sure this change doesn't impact other builds, not sure on the best approach there

Diff Detail

Repository
rABC Bitcoin ABC
Branch
ci-improvements-take-two
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31778
Build 63049: Build Diff
Build 63048: arc lint + arc unit

Event Timeline

js-mocha tests

@bot alias-server-tests ecash-herald-tests token-server-tests mock-chronik-client-tests b58-ts-tests chronik-client-tests ecash-lib-tests ecash-agora-tests ecashaddrjs-tests ecash-script-tests ecash-coinselect-tests

js-mocha-integration-tests

@bot ecash-agora-integration-tests ecash-lib-integration-tests chronik-client-integration-tests

Tail of the build log:

> mock-chronik-client@2.1.1 build
> tsc

/work/apps/alias-server /work/modules/mock-chronik-client /work/modules/chronik-client /work/modules/ecash-script /work/modules/ecashaddrjs /work/abc-ci-builds/alias-server-tests
npm warn deprecated har-validator@5.1.5: this library is no longer supported
npm warn deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm warn deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

added 612 packages, and audited 616 packages in 6s

94 packages are looking for funding
  run `npm fund` for details

15 vulnerabilities (3 low, 7 moderate, 5 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
CI not configured to test build.

> alias-server@1.0.0 test
> mocha --reporter mocha-junit-reporter --reporter-options mochaFile=test_results/alias-server-junit.xml --reporter-options testsuitesTitle=Alias Server Unit Tests --reporter-options rootSuiteTitle=Alias Server

Connected successfully to MongoDB server
Error in function updateServerState. MongoServerError: interrupted at shutdown
    at Connection.sendCommand (/work/apps/alias-server/node_modules/mongodb/lib/cmap/connection.js:290:27)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Connection.command (/work/apps/alias-server/node_modules/mongodb/lib/cmap/connection.js:317:26)
    at async Server.command (/work/apps/alias-server/node_modules/mongodb/lib/sdam/server.js:167:29)
    at async UpdateOneOperation.executeCommand (/work/apps/alias-server/node_modules/mongodb/lib/operations/command.js:73:16)
    at async UpdateOneOperation.execute (/work/apps/alias-server/node_modules/mongodb/lib/operations/update.js:55:21)
    at async UpdateOneOperation.execute (/work/apps/alias-server/node_modules/mongodb/lib/operations/update.js:69:21)
    at async tryOperation (/work/apps/alias-server/node_modules/mongodb/lib/operations/execute_operation.js:199:20)
    at async executeOperation (/work/apps/alias-server/node_modules/mongodb/lib/operations/execute_operation.js:69:16)
    at async Collection.updateOne (/work/apps/alias-server/node_modules/mongodb/lib/collection.js:204:16)
    at async Object.updateServerState (/work/apps/alias-server/src/db.js:28:92)
    at async initializeDb (/work/apps/alias-server/src/db.js:21:26)
    at async Context.<anonymous> (/work/apps/alias-server/test/app.test.js:35:18) {
  errorResponse: {
    ok: 0,
    errmsg: 'interrupted at shutdown',
    code: 11600,
    codeName: 'InterruptedAtShutdown'
  },
  ok: 0,
  code: 11600,
  codeName: 'InterruptedAtShutdown',
  [Symbol(errorLabels)]: Set(1) { 'ResetPool' }
}
Initialized serverState on app startup
Configured connection to database ecashAliases
Connected successfully to MongoDB server
Initialized serverState on app startup
Configured connection to database ecashAliases
Build alias-server-tests timed out after 3600.0s

Tail of the build log:

> mock-chronik-client@2.1.1 build
> tsc

/work/apps/alias-server /work/modules/mock-chronik-client /work/modules/chronik-client /work/modules/ecash-script /work/modules/ecashaddrjs /work/abc-ci-builds/alias-server-tests
npm warn deprecated har-validator@5.1.5: this library is no longer supported
npm warn deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm warn deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

added 612 packages, and audited 616 packages in 6s

94 packages are looking for funding
  run `npm fund` for details

15 vulnerabilities (3 low, 7 moderate, 5 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
CI not configured to test build.

> alias-server@1.0.0 test
> mocha --reporter mocha-junit-reporter --reporter-options mochaFile=test_results/alias-server-junit.xml --reporter-options testsuitesTitle=Alias Server Unit Tests --reporter-options rootSuiteTitle=Alias Server

Connected successfully to MongoDB server
Error in function updateServerState. MongoServerError: interrupted at shutdown
    at Connection.sendCommand (/work/apps/alias-server/node_modules/mongodb/lib/cmap/connection.js:290:27)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Connection.command (/work/apps/alias-server/node_modules/mongodb/lib/cmap/connection.js:317:26)
    at async Server.command (/work/apps/alias-server/node_modules/mongodb/lib/sdam/server.js:167:29)
    at async UpdateOneOperation.executeCommand (/work/apps/alias-server/node_modules/mongodb/lib/operations/command.js:73:16)
    at async UpdateOneOperation.execute (/work/apps/alias-server/node_modules/mongodb/lib/operations/update.js:55:21)
    at async UpdateOneOperation.execute (/work/apps/alias-server/node_modules/mongodb/lib/operations/update.js:69:21)
    at async tryOperation (/work/apps/alias-server/node_modules/mongodb/lib/operations/execute_operation.js:199:20)
    at async executeOperation (/work/apps/alias-server/node_modules/mongodb/lib/operations/execute_operation.js:69:16)
    at async Collection.updateOne (/work/apps/alias-server/node_modules/mongodb/lib/collection.js:204:16)
    at async Object.updateServerState (/work/apps/alias-server/src/db.js:28:92)
    at async initializeDb (/work/apps/alias-server/src/db.js:21:26)
    at async Context.<anonymous> (/work/apps/alias-server/test/app.test.js:35:18) {
  errorResponse: {
    ok: 0,
    errmsg: 'interrupted at shutdown',
    code: 11600,
    codeName: 'InterruptedAtShutdown'
  },
  ok: 0,
  code: 11600,
  codeName: 'InterruptedAtShutdown',
  [Symbol(errorLabels)]: Set(1) { 'ResetPool' }
}
Initialized serverState on app startup
Configured connection to database ecashAliases
Connected successfully to MongoDB server
Initialized serverState on app startup
Configured connection to database ecashAliases
Build alias-server-tests timed out after 3600.0s

the timeout failure here does not appear related to this CI patch. running alias-server-tests again in isolation to confirm

Fabien requested changes to this revision.Thu, Dec 26, 21:30
Fabien added a subscriber: Fabien.

I like the top level API, but this can be simplified a bit. See suggestions.

contrib/teamcity/build-configurations.py
172 ↗(On Diff #51747)

See my other comment: you probably want to insert a build step for each dependency instead.

contrib/teamcity/build-configurations.yml
758 ↗(On Diff #51747)

I prefer depends over dependencies. This can be used for some pre-build script as well and the syntax still remains correct

contrib/teamcity/dependencies.yml
1 ↗(On Diff #51747)

I don't think you need this file at all. These "dependencies" can actually be simple builds with a script instead of adding a new syntax.
.+ No new file, no new syntax
.+ These simple builds can be called by the bot if needed
.+ You can use a template to avoid the boilerplate if needed
.+ You can easily imagine making dependencies recursive. This is easy to define in the yaml, a bit more difficult to handle in the python (let's not do that for this diff)
.- The build file is a bit longer ?

This revision now requires changes to proceed.Thu, Dec 26, 21:30
bytesofman marked an inline comment as done.

Simplifying by removing dependencies.yml and its custom methods, instead creating script steps for the dependencies, parsing these before building

bytesofman marked an inline comment as done.

lint

Much better logic. I am not totally sure if my implementation here is the right approach (parsing dependencies, making new BuildConfigurations for each one, adding to steps), though I was able to get it to work locally.

test here

js-mocha tests and js-mocha-integration-tests

@bot alias-server-tests ecash-herald-tests token-server-tests mock-chronik-client-tests b58-ts-tests chronik-client-tests ecash-lib-tests ecash-agora-tests ecashaddrjs-tests ecash-script-tests ecash-coinselect-tests ecash-agora-integration-tests ecash-lib-integration-tests chronik-client-integration-tests

contrib/teamcity/build-configurations.py
134

not sure if I really want to be doing this. But without it, ran into errors w/ these directories not existing.