diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index a4817b9112a..a51246ad925 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -108,9 +108,10 @@ jobs: - uses: codecov/codecov-action@v3 amqp10: # TODO: move rhea to its own job + needs: + - versions strategy: - matrix: - range: ['3.6.0'] + matrix: ${{fromJson(needs.versions.outputs.matrices).amqp10}} runs-on: ubuntu-latest services: qpid: diff --git a/packages/datadog-instrumentations/src/helpers/matrices.json b/packages/datadog-instrumentations/src/helpers/matrices.json index feb574fbd27..5f8d2d28e0d 100644 --- a/packages/datadog-instrumentations/src/helpers/matrices.json +++ b/packages/datadog-instrumentations/src/helpers/matrices.json @@ -1,7 +1,713 @@ { + "pinned": [ + "generic-pool", + "@playwright/test", + "redis" + ], + "matrices": { "couchbase": { - "node-version": [16], - "range": ["2.6.12 - 2.6.12", "3.0.7 - 3.2.7", "4.0.0 - 4.4.1" ], - "include": [{"node-version": 18, "range": "4.4.1 - 4.4.1"}] + "min-version": "2.4.2", + "node-version": [ + 16 + ], + "range": [ + "2.4.2 - 2.6.12", + "3.0.0 - 3.2.7", + "4.0.0 - 4.4.1" + ], + "include": [ + { + "node-version": 18 + }, + [ + "4.4.1", + "4.4.1" + ] + ] + }, + "aerospike": { + "min-version": "4.0.0", + "range": [ + "4.0.0 - 4.0.5", + "5.0.0 - 5.12.1" + ] + }, + "amqp10": { + "min-version": "3.0.0", + "range": [ + "3.0.0 - 3.6.0" + ] + }, + "amqplib": { + "min-version": "0.5.0", + "range": [ + "0.5.0 - 0.10.4" + ] + }, + "@apollo/gateway": { + "min-version": "0.1.0", + "range": [ + "0.1.0 - 0.54.1", + "2.0.0 - 2.9.1" + ] + }, + "@aws-sdk/smithy-client": { + "min-version": "3.0.0", + "range": [ + "3.0.0 - 3.374.0" + ] + }, + "aws-sdk": { + "min-version": "2.1.35", + "range": [ + "2.1.35 - 2.1691.0" + ] + }, + "bluebird": { + "min-version": "2.0.0", + "range": [ + "2.0.0 - 2.11.0", + "3.0.0 - 3.7.2" + ] + }, + "body-parser": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.20.3" + ] + }, + "bunyan": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.8.15" + ] + }, + "cassandra-driver": { + "min-version": "3.0.0", + "range": [ + "3.0.0 - 3.6.0", + "4.0.0 - 4.7.2" + ] + }, + "connect": { + "min-version": "2.0.0", + "range": [ + "2.0.0 - 2.30.2", + "3.0.0 - 3.7.0" + ] + }, + "cookie-parser": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.4.6" + ] + }, + "cookie": { + "min-version": "0.0.0", + "range": [ + "0.0.0 - 0.6.0" + ] + }, + "@cucumber/cucumber": { + "min-version": "7.0.0", + "range": [ + "7.0.0 - 7.3.2", + "8.0.0 - 8.11.1", + "9.0.0 - 9.6.0", + "10.0.0 - 10.9.0", + "11.0.0 - 11.0.1" + ] + }, + "cypress": { + "min-version": "0.0.1", + "range": [ + "0.0.1 - 0.20.3", + "1.0.0 - 1.4.2", + "2.0.0 - 2.1.0", + "3.0.0 - 3.8.3", + "4.0.0 - 4.12.1", + "5.0.0 - 5.6.0", + "6.0.0 - 6.9.1", + "7.0.0 - 7.7.0", + "8.0.0 - 8.7.0", + "9.0.0 - 9.7.0", + "10.0.0 - 10.11.0", + "11.0.0 - 11.2.0", + "12.0.0 - 12.17.4", + "13.0.0 - 13.14.2" + ] + }, + "@elastic/elasticsearch": { + "min-version": "5.6.16", + "range": [ + "5.6.16 - 5.6.22", + "6.7.0 - 6.8.8", + "7.0.0 - 7.17.14", + "8.0.0 - 8.14.1" + ] + }, + "elasticsearch": { + "min-version": "0.2.0", + "range": [ + "0.2.0 - 0.3.9", + "1.0.0 - 1.5.14", + "2.0.0 - 2.4.3", + "3.0.0 - 3.1.4", + "4.0.0 - 4.1.0", + "5.0.0 - 5.0.0", + "6.0.0 - 6.1.0", + "8.0.1 - 8.2.0", + "9.0.0 - 9.0.2", + "10.0.0 - 10.1.3", + "11.0.0 - 11.0.1", + "12.0.0 - 12.1.3", + "13.0.0 - 13.3.1", + "14.0.0 - 14.2.2", + "15.0.0 - 15.5.0", + "16.0.0 - 16.7.3" + ] + }, + "express-mongo-sanitize": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.3.2", + "2.0.0 - 2.2.0" + ] + }, + "express": { + "min-version": "4.0.0", + "range": [ + "4.0.0 - 4.21.0" + ] + }, + "fastify": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.14.6", + "2.0.0 - 2.15.3", + "3.0.0 - 3.29.5", + "4.0.0 - 4.28.1", + "5.0.0 - 5.0.0" + ] + }, + "find-my-way": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.18.1", + "2.0.0 - 2.2.5", + "3.0.0 - 3.0.5", + "4.0.0 - 4.5.1", + "5.0.0 - 5.6.0", + "6.0.0 - 6.4.0", + "7.0.0 - 7.7.0", + "8.0.0 - 8.2.2", + "9.0.0 - 9.0.1" + ] + }, + "generic-pool": { + "min-version": "2.0.0", + "range": [ + "2.0.0 - 2.5.4", + "3.0.0 - 3.9.0" + ] + }, + "@google-cloud/pubsub": { + "min-version": "1.2.0", + "range": [ + "1.2.0 - 1.7.3", + "2.0.0 - 2.19.4", + "3.0.0 - 3.7.5", + "4.0.0 - 4.7.2" + ] + }, + "@graphql-tools/executor": { + "min-version": "0.0.14", + "range": [ + "0.0.14 - 0.0.20", + "1.0.0 - 1.3.1" + ] + }, + "graphql": { + "min-version": "0.10.0", + "range": [ + "0.10.0 - 0.13.2", + "14.0.0 - 14.7.0", + "15.0.0 - 15.9.0", + "16.0.0 - 16.9.0" + ] + }, + "@grpc/grpc-js": { + "min-version": "1.0.3", + "range": [ + "1.0.3 - 1.11.3" + ] + }, + "@hapi/hapi": { + "min-version": "17.9.0", + "range": [ + "17.9.0 - 17.9.0", + "18.2.0 - 18.4.1", + "19.0.0 - 19.2.0", + "20.0.0 - 20.3.0", + "21.0.0 - 21.3.10" + ] + }, + "hapi": { + "min-version": "16.0.0", + "range": [ + "16.0.0 - 16.8.4", + "17.0.0 - 17.8.5", + "18.0.0 - 18.1.0" + ] + }, + "ioredis": { + "min-version": "2.0.0", + "range": [ + "2.0.0 - 2.5.0", + "3.0.0 - 3.2.2", + "4.0.0 - 4.28.5", + "5.0.0 - 5.4.1" + ] + }, + "jest-environment-node": { + "min-version": "24.8.0", + "range": [ + "24.8.0 - 24.9.0", + "25.0.0 - 25.5.0", + "26.0.0 - 26.6.2", + "27.0.0 - 27.5.1", + "28.0.0 - 28.1.3", + "29.0.0 - 29.7.0" + ] + }, + "kafkajs": { + "min-version": "1.4.0", + "range": [ + "1.4.0 - 1.16.0", + "2.0.0 - 2.2.4" + ] + }, + "knex": { + "min-version": "0.8.0", + "range": [ + "0.8.0 - 0.95.15", + "1.0.0 - 1.0.7", + "2.0.0 - 2.5.1", + "3.0.0 - 3.1.0" + ] + }, + "koa": { + "min-version": "2.0.0", + "range": [ + "2.0.0 - 2.15.3" + ] + }, + "@koa/router": { + "min-version": "8.0.0", + "range": [ + "8.0.0 - 8.0.8", + "9.0.1 - 9.4.0", + "10.0.0 - 10.1.1", + "11.0.0 - 11.0.2", + "12.0.0 - 12.0.2", + "13.0.0 - 13.1.0" + ] + }, + "koa-router": { + "min-version": "7.0.0", + "range": [ + "7.0.0 - 7.4.0", + "8.0.6 - 8.0.8", + "9.0.1 - 9.4.0", + "10.0.0 - 10.1.1", + "11.0.0 - 11.0.2", + "12.0.0 - 12.0.1", + "13.0.1 - 13.0.1" + ] + }, + "ldapjs": { + "min-version": "0.1.0", + "range": [ + "0.1.0 - 0.8.0", + "1.0.0 - 1.0.2", + "2.0.0 - 2.3.3", + "3.0.0 - 3.0.7" + ] + }, + "limitd-client": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.13.1", + "2.0.0 - 2.14.1" + ] + }, + "lodash": { + "min-version": "0.1.0", + "range": [ + "0.1.0 - 0.10.0", + "1.0.0 - 1.0.2", + "2.0.0 - 2.4.2", + "3.0.0 - 3.10.1", + "4.0.0 - 4.17.21" + ] + }, + "mariadb": { + "min-version": "3.0.0", + "range": [ + "3.0.0 - 3.3.2" + ] + }, + "memcached": { + "min-version": "2.2.0", + "range": [ + "2.2.0 - 2.2.2" + ] + }, + "microgateway-core": { + "min-version": "2.1.0", + "range": [ + "2.1.0 - 2.5.17", + "3.0.0 - 3.3.4" + ] + }, + "moleculer": { + "min-version": "0.14.0", + "range": [ + "0.14.0 - 0.14.34" + ] + }, + "mongodb-core": { + "min-version": "2.0.0", + "range": [ + "2.0.0 - 2.1.20", + "3.0.0 - 3.2.7" + ] + }, + "mongodb": { + "min-version": "3.3.0", + "range": [ + "3.3.0 - 3.7.4", + "4.0.0 - 4.17.2", + "5.0.0 - 5.9.2", + "6.0.0 - 6.9.0" + ] + }, + "mongoose": { + "min-version": "4.6.4", + "range": [ + "4.6.4 - 4.13.21", + "5.0.0 - 5.13.22", + "6.0.0 - 6.13.2", + "7.0.0 - 7.8.1", + "8.0.0 - 8.6.3" + ] + }, + "mquery": { + "min-version": "0.0.1", + "range": [ + "0.0.1 - 0.9.0", + "1.0.0 - 1.11.0", + "2.0.0 - 2.3.3", + "3.0.0 - 3.2.5", + "4.0.0 - 4.0.3", + "5.0.0 - 5.0.0" + ] + }, + "mysql": { + "min-version": "2.0.0", + "range": [ + "2.0.0 - 2.18.1" + ] + }, + "mysql2": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.6.6", + "2.0.0 - 2.3.3", + "3.0.0 - 3.11.3" + ] + }, + "next": { + "min-version": "9.5.0", + "range": [ + "9.5.0 - 9.5.5", + "10.0.0 - 10.2.3", + "11.0.0 - 11.1.4", + "12.0.0 - 12.3.4", + "13.0.0 - 13.5.7", + "14.0.0 - 14.2.13" + ] + }, + "openai": { + "min-version": "3.0.0", + "range": [ + "3.0.0 - 3.3.0", + "4.0.0 - 4.63.0" + ] + }, + "@opensearch-project/opensearch": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.2.0", + "2.0.0 - 2.12.0" + ] + }, + "oracledb": { + "min-version": "5.0.0", + "range": [ + "5.0.0 - 5.5.0", + "6.0.0 - 6.6.0" + ] + }, + "paperplane": { + "min-version": "2.3.0", + "range": [ + "2.3.0 - 2.3.2", + "3.0.0 - 3.1.2" + ] + }, + "passport-http": { + "min-version": "0.1.0", + "range": [ + "0.1.0 - 0.3.0" + ] + }, + "passport-local": { + "min-version": "0.1.0", + "range": [ + "0.1.0 - 0.1.6", + "1.0.0 - 1.0.0" + ] + }, + "pg": { + "min-version": "4.0.0", + "range": [ + "4.0.0 - 4.5.7", + "5.0.0 - 5.2.1", + "6.0.0 - 6.4.2", + "7.0.0 - 7.18.2", + "8.0.0 - 8.13.0" + ] + }, + "pino": { + "min-version": "2.0.0", + "range": [ + "2.0.0 - 2.16.0", + "3.0.0 - 3.4.0", + "4.0.0 - 4.17.6", + "5.0.0 - 5.17.0", + "6.0.0 - 6.14.0", + "7.0.0 - 7.11.0", + "8.0.0 - 8.21.0", + "9.0.0 - 9.4.0" + ] + }, + "pino-pretty": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.0.1", + "2.0.0 - 2.6.1", + "3.0.0 - 3.6.1", + "4.0.0 - 4.8.0", + "5.0.0 - 5.1.3", + "6.0.0 - 6.0.0", + "7.0.0 - 7.6.1", + "8.0.0 - 8.1.0", + "9.0.0 - 9.4.1", + "10.0.0 - 10.3.1", + "11.0.0 - 11.2.2" + ] + }, + "@playwright/test": { + "min-version": "0.0.0", + "range": [ + "0.0.0 - 0.1111.0", + "1.12.0 - 1.47.2" + ] + }, + "playwright": { + "min-version": "0.0.0", + "range": [ + "0.0.0 - 0.18.0", + "1.0.0 - 1.47.2" + ] + }, + "promise-js": { + "min-version": "0.0.3", + "range": [ + "0.0.3 - 0.0.7" + ] + }, + "promise": { + "min-version": "7.0.0", + "range": [ + "7.0.0 - 7.3.1", + "8.0.0 - 8.3.0" + ] + }, + "q": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.5.1" + ] + }, + "qs": { + "min-version": "0.0.0", + "range": [ + "0.0.0 - 0.6.6", + "1.0.0 - 1.2.2", + "2.0.0 - 2.4.2", + "3.0.0 - 3.1.0", + "4.0.0 - 4.0.0", + "5.0.0 - 5.2.1", + "6.0.0 - 6.13.0" + ] + }, + "@node-redis/client": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.0.6" + ] + }, + "@redis/client": { + "min-version": "1.1.0", + "range": [ + "1.1.0 - 1.6.0" + ] + }, + "redis": { + "min-version": "0.12.0", + "range": [ + "0.12.0 - 0.12.1", + "1.0.0 - 1.0.0", + "2.0.0 - 2.8.0", + "3.0.0 - 3.1.2", + "4.0.0 - 4.7.0" + ] + }, + "restify": { + "min-version": "3.0.0", + "range": [ + "3.0.0 - 3.0.3", + "4.0.0 - 4.3.4", + "5.0.0 - 5.2.1", + "6.0.0 - 6.4.0", + "7.0.0 - 7.7.0", + "8.0.0 - 8.6.1", + "9.0.0 - 9.1.0", + "10.0.0 - 10.0.0", + "11.0.0 - 11.1.0" + ] + }, + "rhea": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.0.24", + "2.0.0 - 2.0.8", + "3.0.0 - 3.0.3" + ] + }, + "router": { + "min-version": "0.2.1", + "range": [ + "0.2.1 - 0.6.2", + "1.0.0 - 1.3.8" + ] + }, + "selenium-webdriver": { + "min-version": "2.29.0", + "range": [ + "2.29.0 - 2.53.3", + "3.0.0 - 3.6.0", + "4.0.0 - 4.25.0" + ] + }, + "sequelize": { + "min-version": "0.0.0", + "range": [ + "0.0.0 - 0.4.3", + "1.0.0 - 1.7.11", + "2.0.0 - 2.1.3", + "3.0.0 - 3.35.1", + "4.0.0 - 4.44.4", + "5.1.0 - 5.22.5", + "6.1.0 - 6.37.3" + ] + }, + "sharedb": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.9.2", + "2.0.0 - 2.2.6", + "3.0.0 - 3.3.2", + "4.0.0 - 4.1.5", + "5.0.0 - 5.0.4" + ] + }, + "tedious": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.15.0", + "2.0.0 - 2.7.1", + "3.0.0 - 3.0.1", + "4.0.0 - 4.2.0", + "5.0.0 - 5.0.3", + "6.0.0 - 6.7.1", + "7.0.0 - 7.0.0", + "8.0.0 - 8.3.1", + "9.0.0 - 9.2.3", + "10.0.0 - 10.0.0", + "11.0.0 - 11.8.0", + "12.0.0 - 12.3.0", + "13.0.0 - 13.2.0", + "14.0.0 - 14.7.0", + "15.0.0 - 15.1.3", + "16.0.0 - 16.7.1", + "17.0.0 - 17.0.0", + "18.0.0 - 18.6.2" + ] + }, + "undici": { + "min-version": "0.1.0", + "range": [ + "0.1.0 - 0.5.0", + "1.0.0 - 1.3.1", + "2.0.0 - 2.2.1", + "3.0.0 - 3.3.6", + "4.0.0 - 4.16.0", + "5.0.0 - 5.28.4", + "6.0.0 - 6.19.8" + ] + }, + "vitest": { + "min-version": "0.0.0", + "range": [ + "0.0.0 - 0.34.6", + "1.0.0 - 1.6.0", + "2.0.0 - 2.1.1" + ] + }, + "@vitest/runner": { + "min-version": "0.28.0", + "range": [ + "0.28.0 - 0.34.7", + "1.0.0 - 1.6.0", + "2.0.0 - 2.1.1" + ] + }, + "when": { + "min-version": "3.0.0", + "range": [ + "3.0.0 - 3.7.8" + ] + }, + "winston": { + "min-version": "1.0.0", + "range": [ + "1.0.0 - 1.1.2", + "2.0.0 - 2.4.7", + "3.0.0 - 3.14.2" + ] } + } } \ No newline at end of file diff --git a/packages/dd-trace/test/setup/mocha.js b/packages/dd-trace/test/setup/mocha.js index db5544e1d41..d3520c3fe1c 100644 --- a/packages/dd-trace/test/setup/mocha.js +++ b/packages/dd-trace/test/setup/mocha.js @@ -204,8 +204,6 @@ function withVersions (plugin, modules, range, cb) { instrumentations .filter(instrumentation => instrumentation.name === moduleName) .forEach(instrumentation => { - console.log('rabe', process.env.PACKAGE_VERSION_RANGE) - console.log('rabe', process.env.PLUGINS) const versions = process.env.PACKAGE_VERSION_RANGE ? [process.env.PACKAGE_VERSION_RANGE] : instrumentation.versions @@ -223,7 +221,6 @@ function withVersions (plugin, modules, range, cb) { testVersions.set(max, { range: version, test: version }) }) }) - console.log('TEST VERSIONS', testVersions) Array.from(testVersions) .filter(v => !range || semver.satisfies(v[0], range)) diff --git a/scripts/install_plugin_modules.js b/scripts/install_plugin_modules.js index 1b72ceb00a8..682e2d3c5ad 100644 --- a/scripts/install_plugin_modules.js +++ b/scripts/install_plugin_modules.js @@ -145,10 +145,8 @@ async function assertPackage (name, version, dependency, external) { } async function addDependencies (dependencies, name, versionRange) { - console.log('VERSION RANGE', versionRange) const versionList = await getVersionList(name) const version = semver.maxSatisfying(versionList, versionRange) - // console.log('VERSION', version) const pkgJson = await npmView(`${name}@${version}`) for (const dep of deps[name]) { for (const section of ['devDependencies', 'peerDependencies']) { @@ -166,7 +164,6 @@ async function getVersionList (name) { } const list = await npmView(`${name} versions`) versionLists[name] = list - console.log('LIST', list[309]) return list } diff --git a/scripts/outdated.js b/scripts/outdated.js index 007223c9e32..d4f5098512e 100644 --- a/scripts/outdated.js +++ b/scripts/outdated.js @@ -17,17 +17,23 @@ const latestsPath = path.join( 'latests.json' ) -const yamlPath = path.join( +const matricesPath = path.join( __dirname, '..', - '.github', - 'workflows', - 'plugins.yml' + 'packages', + 'datadog-instrumentations', + 'src', + 'helpers', + 'matrices.json' ) + const latestsJson = require(latestsPath) const internalsNames = Array.from(new Set(getInternals().map(n => n.name))) .filter(x => typeof x === 'string' && x !== 'child_process' && !x.startsWith('node:')) +const matricesJson = require(matricesPath) +const pluginsNames = Object.getOwnPropertyNames(yaml.load(fs.readFileSync(matricesPath, 'utf-8')).matrices) + // TODO A lot of this can be optimized by using `npm outdated`. function makeAPR (branchName) { @@ -36,33 +42,72 @@ function makeAPR (branchName) { execSync(`gh pr create --title ${title} --body ${body} --base master --head ${branchName} `) } -function updatePluginsYaml () { - const plugins = yaml.load(fs.readFileSync(yamlPath, 'utf-8')) - const jobs = plugins.jobs +function maxVersion (range) { + if (typeof range === 'string') { + return range + } + return range.pop() +} + +function minVersion (range) { + if (typeof range === 'string') { + return range + } + return range.shift() +} + +function splitting (element) { + return +element.split('.')[0] +} + +async function ranges (name, minimum) { + const distTags = await npmView(`${name} dist-tags`) + const latestVersion = splitting(distTags?.latest) + + const splitMin = splitting(minimum) + + const ranges = [] + let versionRange + let maxRange + let minRange + + for (let major = splitMin; major <= latestVersion; major++) { + try { + versionRange = await npmView(`${name}@${major} version`) + maxRange = maxVersion(versionRange) + minRange = minVersion(versionRange) - for (const job in jobs) { - if (jobs[job]?.strategy?.matrix?.range) { console.log('found range', job, jobs[job]?.strategy?.matrix?.range) } + if (major === splitMin) { + ranges.push(`${minimum} - ${maxRange}`) + } else if (versionRange !== undefined) { + ranges.push(`${minRange} - ${maxRange}`) + } + } catch (e) { + console.log(`No version range found for "${name}" at version ${major}`) + } } + return ranges } async function fix () { - updatePluginsYaml() - const latests = {} - for (const name of internalsNames) { - const distTags = await npmView(name + ' dist-tags') - const latest = distTags.latest - latests[name] = latest + let latests + + for (const name of pluginsNames) { + latests = matricesJson.matrices[name] + const minVersion = latests['min-version'] + const versions = await ranges(name, minVersion) + + latests.range = versions } - latestsJson.latests = latests - fs.writeFileSync(latestsPath, JSON.stringify(latestsJson, null, 2)) + fs.writeFileSync(matricesPath, JSON.stringify(matricesJson, null, 2)) const result = execSync('git status').toString() - if (result.includes(latestsPath)) { - const branchName = 'fix_outdated_integrations' + if (result.includes(matricesPath)) { + const branchName = 'update_outdated_integrations' try { execSync(`git checkout -b ${branchName}`) - execSync(`git add ${latestsPath}`) + execSync(`git add ${matricesPath}`) execSync('git commit -m "fix: update integr latests.json"') execSync(`git push origin ${branchName}`)