kibana/scripts/enabled_ftr_configs.js
Elena Shostak 28aa274f66
Updated js-yaml to v4 (#190678)
## Summary
Updated `js-yaml` to `4.1.0`.

This PR also introduces a type override for the `js-yaml` load function
to maintain compatibility across the codebase. Specifically, updated
type definition of the load function looks as follows:

```typescript
function load<T = any>(str: string, opts?: jsyaml.LoadOptions): T;
```

The original type definition of the load function in `js-yaml` changed
from `any` to `unknown`. This change would require extensive type
updates throughout the entire repository to accommodate the `unknown`
type. To avoid widespread type changes and potential issues in the
codebase, the type is overriden back to `any` for now.
This is a temporary measure, we plan to address the necessary type
changes in subsequent PRs, where teams will gradually update the
codebase to work with the `unknown` type.


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

## Release note
Updated `js-yaml` to `4.1.0`.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
2024-09-19 12:25:03 +02:00

34 lines
1.2 KiB
JavaScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
require('../src/setup_node_env');
var yaml = require('js-yaml');
var fs = require('fs');
var path = require('path');
var manifestsJsonPath = path.resolve(__dirname, '../.buildkite/ftr_configs_manifests.json');
console.log(manifestsJsonPath);
var manifestsSource = JSON.parse(fs.readFileSync(manifestsJsonPath, 'utf8'));
var allManifestPaths = Object.values(manifestsSource).flat();
try {
for (var manifestRelPath of allManifestPaths) {
var manifest = yaml.load(fs.readFileSync(manifestRelPath, 'utf8'));
if (manifest.enabled) {
manifest.enabled.forEach(function (x) {
console.log(x);
});
} else {
console.log(`${manifestRelPath} has no enabled FTR configs`);
}
}
} catch (e) {
console.log(e);
}