Skip to content

Commit

Permalink
chore: add no refs option to yaml dump
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Feb 7, 2023
1 parent 40f65d7 commit 30280dd
Showing 1 changed file with 61 additions and 54 deletions.
115 changes: 61 additions & 54 deletions .evergreen/generate_evergreen_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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 => ({
Expand Down Expand Up @@ -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 };
Expand All @@ -416,7 +420,7 @@ for (const
}

BUILD_VARIANTS.push({ name, display_name, run_on, expansions, tasks: taskNames });
};
}

const configureLatestNodeSmokeTest = os.match(/^rhel/);
if (configureLatestNodeSmokeTest) {
Expand All @@ -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,
Expand Down Expand Up @@ -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 {
Expand All @@ -521,7 +526,7 @@ function* makeTypescriptTasks() {
}
}
]
}
};
}
return {
name: 'run-typescript-next',
Expand All @@ -535,7 +540,7 @@ function* makeTypescriptTasks() {
},
{ func: 'run typescript next' }
]
}
};
}

BUILD_VARIANTS.push({
Expand Down Expand Up @@ -590,7 +595,7 @@ BUILD_VARIANTS.push({
tasks: AWS_AUTH_TASKS
});

const oneOffFuncAsTasks = []
const oneOffFuncAsTasks = [];

for (const version of ['5.0', 'rapid', 'latest']) {
for (const ref of ['67bec571c0c21f4db8a96b6bd61cb24dfc87a223', 'master']) {
Expand Down Expand Up @@ -674,7 +679,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)
Expand All @@ -685,18 +692,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'));
Expand All @@ -708,4 +711,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'
);

0 comments on commit 30280dd

Please sign in to comment.