Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@circleci/circleci-config-parser
Advanced tools
A parsing library for CircleCI configuration files, powered by the CircleCI Config SDK
A parsing library for CircleCI configuration files, powered by the CircleCI Config SDK
Used by the CircleCI Visual Config Editor to generate an interactive and editable visual representation of your CircleCI config.
Using npm:
$ npm i @circleci/circleci-config-parser
Using yarn:
$ yarn add @circleci/circleci-config-parser
In Node.js:
import ConfigParser from '@circleci/circleci-config-parser';
In Browser:
const ConfigParser = require('@circleci/circleci-config-parser');
Loading a Config instance from a config file
import fs from 'fs';
const configSrc = fs.readFileSync('./config.yml', 'utf8');
const config = ConfigParser.parseConfig(configSrc);
Parsing a job config equivalent object, into a CircleCI Config SDK Job
instance.
const jobIn = {
docker: [{ image: 'cimg/base:2022.08' }],
resource_class: 'medium',
steps: [
{
run: {
command: 'echo << parameters.greeting >>',
},
},
],
parameters: {
greeting: {
type: 'string',
},
},
};
// Parsing function
ConfigParser.parseJob('Job Name', jobIn);
The equivalent config-sdk instantiation for that object:
new CircleCI.reusable.ParameterizedJob(
'my_job',
new CircleCI.executors.DockerExecutor('cimg/node:lts'),
new CircleCI.parameters.CustomParametersList([
new CircleCI.parameters.CustomParameter('greeting', 'string'),
]),
[
new CircleCI.commands.Run({
command: 'echo << parameters.greeting >>',
}),
],
);
Parsing Orb references requires an OrbManifest, which is a representation of Orbs outward facing properties.
import fs from 'fs';
const customOrbProps = {
// component type
jobs: {
// name of component
say_hello: {
// component parameters
greeting: {
type: 'string',
},
},
},
commands: {
say_it: {
what: {
type: 'string',
},
},
},
executors: {
python: {
version: {
type: 'string',
default: '1.0.0',
},
},
},
};
const customOrbManifest = ConfigParser.parseOrbManifest(customOrbProps);
const configSrc = fs.readFileSync('./config.yml', 'utf8');
const config = ConfigParser.parseConfig(configSrc, {
'custom-orb': customOrbManifest,
});
FAQs
A parsing library for CircleCI configuration files, powered by the CircleCI Config SDK
The npm package @circleci/circleci-config-parser receives a total of 4,934 weekly downloads. As such, @circleci/circleci-config-parser popularity was classified as popular.
We found that @circleci/circleci-config-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 179 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.