From 154c451beef9d97b39e3032227b6781171aa5cd8 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Tue, 7 Feb 2023 16:05:21 -0500 Subject: [PATCH] chore: add no refs option to yaml dump --- .evergreen/generate_evergreen_tasks.js | 115 +++++++++++++------------ 1 file changed, 61 insertions(+), 54 deletions(-) diff --git a/.evergreen/generate_evergreen_tasks.js b/.evergreen/generate_evergreen_tasks.js index 5b3ada808e..6ef348d3c6 100644 --- a/.evergreen/generate_evergreen_tasks.js +++ b/.evergreen/generate_evergreen_tasks.js @@ -7,7 +7,7 @@ const versions = [ { codeName: 'gallium', versionNumber: 16 }, { codeName: 'hydrogen', versionNumber: 18 } ]; -const NODE_VERSIONS = versions.map(({ codeName }) => codeName) +const NODE_VERSIONS = versions.map(({ codeName }) => codeName); NODE_VERSIONS.sort(); const LOWEST_LTS = NODE_VERSIONS[0]; const LATEST_LTS = NODE_VERSIONS[NODE_VERSIONS.length - 1]; @@ -334,8 +334,8 @@ for (const VERSION of AWS_AUTH_VERSIONS) { { func: 'run aws auth test with aws credentials as environment variables' }, { func: 'run aws auth test with aws credentials and session token as environment variables' }, { func: 'run aws ECS auth test' }, - { func: 'run aws auth test AssumeRoleWithWebIdentity with AWS_ROLE_SESSION_NAME unset'}, - { func: 'run aws auth test AssumeRoleWithWebIdentity with AWS_ROLE_SESSION_NAME set'} + { func: 'run aws auth test AssumeRoleWithWebIdentity with AWS_ROLE_SESSION_NAME unset' }, + { func: 'run aws auth test AssumeRoleWithWebIdentity with AWS_ROLE_SESSION_NAME set' } ]; const awsTasks = awsFuncs.map(fn => ({ @@ -385,27 +385,31 @@ for (const VERSION of AWS_AUTH_VERSIONS) { const BUILD_VARIANTS = []; -for (const - { - name: osName, - display_name: osDisplayName, - run_on, - nodeVersions = NODE_VERSIONS, - clientEncryption, - } of OPERATING_SYSTEMS) { +for (const { + name: osName, + display_name: osDisplayName, + run_on, + nodeVersions = NODE_VERSIONS, + clientEncryption +} of OPERATING_SYSTEMS) { const testedNodeVersions = NODE_VERSIONS.filter(version => nodeVersions.includes(version)); const os = osName.split('-')[0]; - const tasks = BASE_TASKS.concat(TASKS) - .filter(task => { - const isAWSTask = task.name.match(/^aws/); - const isSkippedTaskOnWindows = task.tags && os.match(/^windows/) && task.tags.filter(tag => WINDOWS_SKIP_TAGS.has(tag)).length - - return !isAWSTask && !isSkippedTaskOnWindows; - }); + const tasks = BASE_TASKS.concat(TASKS).filter(task => { + const isAWSTask = task.name.match(/^aws/); + const isSkippedTaskOnWindows = + task.tags && + os.match(/^windows/) && + task.tags.filter(tag => WINDOWS_SKIP_TAGS.has(tag)).length; + + return !isAWSTask && !isSkippedTaskOnWindows; + }); for (const NODE_LTS_NAME of testedNodeVersions) { - const nodeVersionNumber = versions.find(({ codeName }) => codeName === NODE_LTS_NAME).versionNumber; - const nodeLtsDisplayName = nodeVersionNumber === undefined ? `Node Latest` : `Node${nodeVersionNumber}`; + const nodeVersionNumber = versions.find( + ({ codeName }) => codeName === NODE_LTS_NAME + ).versionNumber; + const nodeLtsDisplayName = + nodeVersionNumber === undefined ? `Node Latest` : `Node${nodeVersionNumber}`; const name = `${osName}-${NODE_LTS_NAME}`; const display_name = `${osDisplayName} ${nodeLtsDisplayName}`; const expansions = { NODE_LTS_NAME }; @@ -416,7 +420,7 @@ for (const } BUILD_VARIANTS.push({ name, display_name, run_on, expansions, tasks: taskNames }); - }; + } const configureLatestNodeSmokeTest = os.match(/^rhel/); if (configureLatestNodeSmokeTest) { @@ -426,18 +430,20 @@ for (const run_on, expansions: { NODE_LTS_NAME: 'latest' }, tasks: tasks.map(({ name }) => name) - } + }; if (clientEncryption) { buildVariantData.expansions.CLIENT_ENCRYPTION = true; } - BUILD_VARIANTS.push(buildVariantData) + BUILD_VARIANTS.push(buildVariantData); } } BUILD_VARIANTS.push({ name: 'macos-1100', - display_name: `MacOS 11 Node${versions.find(version => version.codeName === LATEST_LTS).versionNumber}`, + display_name: `MacOS 11 Node${ + versions.find(version => version.codeName === LATEST_LTS).versionNumber + }`, run_on: 'macos-1100', expansions: { NODE_LTS_NAME: LATEST_LTS, @@ -480,28 +486,27 @@ SINGLETON_TASKS.push( ); function* makeTypescriptTasks() { - for (const TS_VERSION of ["next", "current", "4.1.6"]) { + for (const TS_VERSION of ['next', 'current', '4.1.6']) { // 4.1.6 can consume the public API but not compile the driver - if (TS_VERSION !== '4.1.6' - && TS_VERSION !== 'next') { + if (TS_VERSION !== '4.1.6' && TS_VERSION !== 'next') { yield { - name: `compile-driver-typescript-${TS_VERSION}`, - tags: [`compile-driver-typescript-${TS_VERSION}`], - commands: [ - { - func: 'install dependencies', - vars: { - NODE_LTS_NAME: LOWEST_LTS - } - }, - { - func: 'compile driver', - vars: { - TS_VERSION - } + name: `compile-driver-typescript-${TS_VERSION}`, + tags: [`compile-driver-typescript-${TS_VERSION}`], + commands: [ + { + func: 'install dependencies', + vars: { + NODE_LTS_NAME: LOWEST_LTS } - ] - } + }, + { + func: 'compile driver', + vars: { + TS_VERSION + } + } + ] + }; } yield { @@ -521,7 +526,7 @@ function* makeTypescriptTasks() { } } ] - } + }; } return { name: 'run-typescript-next', @@ -535,7 +540,7 @@ function* makeTypescriptTasks() { }, { func: 'run typescript next' } ] - } + }; } BUILD_VARIANTS.push({ @@ -590,7 +595,7 @@ BUILD_VARIANTS.push({ tasks: AWS_AUTH_TASKS }); -const oneOffFuncAsTasks = [] +const oneOffFuncAsTasks = []; const FLE_PINNED_COMMIT = '77b51c00ab4ff58916dd39f55657e1ecc0af281c' @@ -676,7 +681,9 @@ BUILD_VARIANTS.push({ // TODO(NODE-4575): unskip zstd and snappy on node 16 for (const variant of BUILD_VARIANTS.filter( - variant => variant.expansions && ['gallium', 'hydrogen', 'latest'].includes(variant.expansions.NODE_LTS_NAME) + variant => + variant.expansions && + ['gallium', 'hydrogen', 'latest'].includes(variant.expansions.NODE_LTS_NAME) )) { variant.tasks = variant.tasks.filter( name => !['test-zstd-compression', 'test-snappy-compression'].includes(name) @@ -687,18 +694,14 @@ for (const variant of BUILD_VARIANTS.filter( for (const variant of BUILD_VARIANTS.filter( variant => variant.expansions && ['latest'].includes(variant.expansions.NODE_LTS_NAME) )) { - variant.tasks = variant.tasks.filter( - name => !['test-auth-kerberos'].includes(name) - ); + variant.tasks = variant.tasks.filter(name => !['test-auth-kerberos'].includes(name)); } // TODO(NODE-4897): Debug socks5 tests on node latest for (const variant of BUILD_VARIANTS.filter( variant => variant.expansions && ['latest'].includes(variant.expansions.NODE_LTS_NAME) )) { - variant.tasks = variant.tasks.filter( - name => !['test-socks5'].includes(name) - ); + variant.tasks = variant.tasks.filter(name => !['test-socks5'].includes(name)); } const fileData = yaml.load(fs.readFileSync(`${__dirname}/config.in.yml`, 'utf8')); @@ -710,4 +713,8 @@ fileData.tasks = (fileData.tasks || []) .concat(AWS_LAMBDA_HANDLER_TASKS); fileData.buildvariants = (fileData.buildvariants || []).concat(BUILD_VARIANTS); -fs.writeFileSync(`${__dirname}/config.yml`, yaml.dump(fileData, { lineWidth: 120 }), 'utf8'); +fs.writeFileSync( + `${__dirname}/config.yml`, + yaml.dump(fileData, { lineWidth: 120, noRefs: true }), + 'utf8' +);